Dre4m Shell
Server IP : 127.0.0.2  /  Your IP : 3.145.50.27
Web Server : Apache/2.4.18 (Ubuntu)
System :
User : www-data ( )
PHP Version : 7.0.33-0ubuntu0.16.04.16
Disable Function : disk_free_space,disk_total_space,diskfreespace,dl,exec,fpaththru,getmyuid,getmypid,highlight_file,ignore_user_abord,leak,listen,link,opcache_get_configuration,opcache_get_status,passthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,php_uname,phpinfo,posix_ctermid,posix_getcwd,posix_getegid,posix_geteuid,posix_getgid,posix_getgrgid,posix_getgrnam,posix_getgroups,posix_getlogin,posix_getpgid,posix_getpgrp,posix_getpid,posix,_getppid,posix_getpwnam,posix_getpwuid,posix_getrlimit,posix_getsid,posix_getuid,posix_isatty,posix_kill,posix_mkfifo,posix_setegid,posix_seteuid,posix_setgid,posix_setpgid,posix_setsid,posix_setuid,posix_times,posix_ttyname,posix_uname,pclose,popen,proc_open,proc_close,proc_get_status,proc_nice,proc_terminate,shell_exec,source,show_source,system,virtual
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /usr/bin/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME SHELL ]     

Current File : /usr/bin/lp-milestones
#! /usr/bin/python
#
# Author: Robert Collins <robert.collins@canonical.com>
#
# Copyright 2010 Canonical Ltd.
#
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 3, as published
# by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranties of
# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
# PURPOSE.  See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program.  If not, see <http://www.gnu.org/licenses/>.

"""lp-milestones -- An lptools command to work with milestones in launchpad.
https://launchpad.net/lptools/

lp-milestones help commands -- list commands
"""

import time

# Might want to make errors import lazy.
from bzrlib import errors
from launchpadlib.errors import HTTPError

from lptools.command import *

class cmd_create(LaunchpadCommand):
    """Create a milestone.
    
    lp-milestone create projectname/seriesname/milestonename
    """

    takes_args = ['milestone']

    def run(self, milestone):
        components = milestone.split('/')
        if len(components) != 3:
            raise errors.BzrCommandError("milestone (%s) too short or too long."
                % milestone)
        projectname, seriesname, milestonename = components
        # Direct access takes 50% of the time of doing traversal.
        #proj = self.launchpad.projects[projectname]
        #series = proj.getSeries(name=seriesname)
        series = self.launchpad.load(projectname + '/' + seriesname)
        milestone = series.newMilestone(name=milestonename)


class cmd_delete(LaunchpadCommand):
    """Delete a milestone.
    
    lp-milestone delete projectname/milestonename

    Note that this cannot delete a milestone with releases on it (yet). The
    server will throw a 500 error, and you may see
      File "/srv/////lib/lp/registry/model/milestone.py", line 209, in destroySelf
          "You cannot delete a milestone which has a product release "
          AssertionError: You cannot delete a milestone which has a product release associated with it.
    In the trace if you have appropriate access.
    """

    takes_args = ['milestone']

    def run(self, milestone):
        components = milestone.split('/')
        if len(components) != 2:
            raise errors.BzrCommandError("milestone (%s) too short or too long."
                % milestone)
        m = self.launchpad.load('%s/+milestone/%s' % tuple(components))
        try:
            m.delete()
        except HTTPError, e:
            if e.response.status == 404:
                pass
            elif e.response.status == 500:
                self.outf.write("Perhaps the milestone has been released?\n")
                self.outf.write("If so you can undo this in the web UI.\n")
                raise
            else:
                raise


class cmd_release(LaunchpadCommand):
    """Create a release from a milestone.
    
    lp-milestone release projectname/milestonename
    """

    takes_args = ['milestone']

    def run(self, milestone):
        components = milestone.split('/')
        if len(components) != 2:
            raise errors.BzrCommandError("milestone (%s) too short or too long."
                % milestone)
        m = self.launchpad.load('%s/+milestone/%s' % tuple(components))
        now = time.strftime('%Y-%m-%d-%X', time.gmtime())
        # note: there is a bug with how the releases are created, don't be surprised
        # if they are created 'X hours ago' where 'X' is the hour in UTC.
        m.createProductRelease(date_released=now)


class cmd_rename(LaunchpadCommand):
    """Rename a milestone.
    
    lp-milestone rename projectname/milestonename newname
    """

    takes_args = ['milestone', 'newname']

    def run(self, milestone, newname):
        components = milestone.split('/')
        if len(components) != 2:
            raise errors.BzrCommandError("milestone (%s) too short or too long."
                % milestone)
        if '/' in newname:
            raise errors.BzrCommandError(
                "milestones can only be renamed within a project.")
        m = self.launchpad.load('%s/+milestone/%s' % tuple(components))
        m.name = newname
        m.lp_save()


if __name__ == "__main__":
    main()

Anon7 - 2022
AnonSec Team