Example #1
0
class RequestList(CommandDescription, Request):
    """List requests.

    By default open requests for a specific project or package will be
    listed.

    Examples:
    osc request list api://
    osc request list api://project
    osc request list api://project/package

    """
    cmd = 'list'
    args = 'api://project?/package?'
    opt_user = Option('U', 'user', 'list only requests for USER')
    opt_group = Option('G', 'group', 'list only requests for GROUP')
    opt_state = Option('s',
                       'state',
                       'list only requests with state STATE',
                       choices=[
                           'new', 'review', 'accepted', 'revoked', 'declined',
                           'superseded'
                       ],
                       action='append',
                       default=['new', 'review'])
    opt_interactive = Option('i',
                             'interactive',
                             'start an interactive request shell',
                             action='store_true')
    func = call(RequestController.list)
    func_defaults = {'shell_cls': RequestShell}
Example #2
0
class ReviewList(CommandDescription, Review, ReviewGlobalOptions):
    """List reviews.

    By default only requests with state review will be listed.

    Examples:
    osc review list api://
    osc review list api://project
    osc review list api://project/package

    """
    cmd = 'list'
    args = 'api://tgt_project?/tgt_package?'
    opt_state = Option('s',
                       'state',
                       ('list only requests which have a review with state '
                        'STATE'),
                       choices=['new', 'accepted', 'revoked', 'declined'],
                       action='append',
                       default=['new'])
    opt_interactive = Option('i',
                             'interactive',
                             'start an interactive request shell',
                             action='store_true')
    func = call(ReviewController.list)
    func_defaults = {'shell_cls': ReviewShell}
Example #3
0
class List(CommandDescription, OscCommand):
    """List projects, packages and files.

    Examples:
    osc list api://                 # list all projects
    osc list api://project          # list all packages in project
    osc list api://project/package  # list all files in package

    """
    cmd = 'list'
    args = '(api://project?/package?)?'
    use_wc = True
    opt_verbose = Option('v',
                         'verbose',
                         'verbose listing (for files only)',
                         action='store_true')
    opt_expand = Option('e',
                        'expand',
                        'expand a source link',
                        action='store_true')
    opt_revision = Option('r',
                          'revision',
                          'list revision (for files only)',
                          default='latest')
    opt_deleted = Option('D',
                         'deleted',
                         'show deleted projects or packages',
                         action='store_true')
    opt_meta = Option('M',
                      'meta',
                      'list package\'s meta files',
                      action='store_true')
    func = call(list.list)
Example #4
0
class ChangeStateOptions(object):
    """Defines a set of options which are needed for a state change.

    All state changing commands should inherit from this class.

    """
    opt_message = Option('m', 'message', 'specify a message')
    opt_force = Option('f',
                       'force',
                       'try to force the state change',
                       action='store_true')
Example #5
0
class ReviewGlobalOptions(object):
    """Defines a set of global options.

    All review subcommands should inherit from this class.

    """
    opt_user = Option('U', 'user', 'use by_user')
    opt_group = Option('G', 'group', 'use by_group')
    opt_project = Option('P', 'project', 'use by_project')
    opt_package = Option('p', 'package', 'use by_package',
                         oargs='project/package', nargs=1, default=[])
Example #6
0
class ChangeStateOptions(ReviewGlobalOptions):
    """Defines a set of options which are needed for a state change.

    All state changing commands should inherit from this class.

    """
    opt_message = Option('m', 'message', 'specify a message')
    opt_force = Option('f', 'force', 'try to force the state change',
                       action='store_true')
    # the options are not required because it is possible to select
    # a review manually
    mutex_group = [ReviewGlobalOptions.opt_user,
                   ReviewGlobalOptions.opt_group,
                   ReviewGlobalOptions.opt_project,
                   ReviewGlobalOptions.opt_package]
Example #7
0
class ReviewChangeStateOptions(ReviewGlobalOptions):
    """Defines options for change state commands (like accept etc.)"""
    opt_message = Option('m', 'message', 'specify a message')
    mutex_req_group = [
        ReviewGlobalOptions.opt_user, ReviewGlobalOptions.opt_group,
        ReviewGlobalOptions.opt_project, ReviewGlobalOptions.opt_package
    ]
Example #8
0
class Update(CommandDescription, OscCommand):
    """Update project or package.

    Examples:
    osc update                  # in a project or package wc
    osc update project          # update project
    osc update package          # update package

    """
    cmd = 'update'
    args = '(wc_path)?'
    opt_expand = Option('u',
                        'unexpand',
                        'do not expand a source link',
                        action='store_true')
    opt_revision = Option('r', 'revision', 'list revision', default='latest')
    func = call(WCUpdateController().update)
Example #9
0
class RequestSupersede(ShellCommand, RequestShellUI, ChangeStateOptions):
    """Supersede a request with another (existing) request.

    Example:
    supersede [--message MESSAGE]

    """
    cmd = 'supersede'
    args = 'supersede_id'
    opt_message = Option('m', 'message', 'specify a message')
    func = call(RequestShellUI.controller.change_request_state)
    func_defaults = {'method': 'supersede'}
Example #10
0
class Checkout(CommandDescription, OscCommand):
    """Checkout project, package, or file.

    Examples:
    osc2 checkout api://project                 # checkout project
    osc2 checkout api://project/package         # checkout package
    osc2 checkout /path/to/project              # revert all local
                                                  modifications in the project
                                                  working copy
    osc2 checkout /path/to/project/package      # revert all local
                                                  modifications in the package
                                                  working copy
    osc2 checkout /path/to/project/package/file # revert the file file

    """
    cmd = 'checkout'
    args = '(api://project/package?|wc_path)*'
    opt_expand = Option('u', 'unexpand', 'do not expand a source link',
                        action='store_true')
    opt_revision = Option('r', 'revision', 'list revision',
                          default='latest')
    func = call(WCCheckoutController().checkout)
Example #11
0
class Commit(CommandDescription, OscCommand):
    """Update project or package.

    Examples:
    osc commit                          # in a project or package wc
    osc commit project                  # update project
    osc commit package                  # update package
    osc commit /path/to/wc/or/wc/file   # update package

    """
    cmd = 'commit'
    args = '(wc_path)?'
    opt_message = Option('m', 'message', 'specify a message')
    func = call(WCCommitController().commit)
Example #12
0
class RequestShow(CommandDescription, Request):
    """Show request.

    Prints more details than the list view.

    Examples:
    osc request show api://reqid
    osc request show api://reqid --diff

    """
    cmd = 'show'
    args = 'api://reqid'
    func = call(RequestController.show)
    opt_diff = Option('d',
                      'diff',
                      'generate a diff for the request',
                      action='store_true')
    opt_interactive = Option('i',
                             'interactive',
                             'start an interactive request shell',
                             action='store_true')
    mutex_group = [opt_diff, opt_interactive]
    func_defaults = {'shell_cls': RequestShell}
Example #13
0
class Add(CommandDescription, OscCommand):
    """Adds a package or a file to a working copy.

    Examples:
    osc2 add /path/prj/pkg      # adds pkg to the prj working copy
    osc2 add /path/prj/pkg/file # adds file to the pkg working copy

    """
    cmd = 'add'
    args = '(wc_path)+'
    opt_package_only = Option('',
                              'package-only',
                              'only add the package, but not its files',
                              action='store_true')
    func = call(add)
Example #14
0
class RequestCreate(CommandDescription, Request):
    """Create a new request.

    Example:
    osc request create --submit api://src_project/src_package api://tgt_project
        [--message MESSAGE]
    osc request create --delete api://project/<package> [--message MESSAGE]
    osc request create --role role user api://project/<package>
    etc.

    It is also possible to specify multiple options at the same time (also
    multiple options of the same name are supported).

    """
    cmd = 'create'
    opt_message = Option('m', 'message', 'specify a message')
    opt_submit = Option('',
                        'submit',
                        'create new submit action',
                        oargs=('api://src_project/src_package@rev? '
                               'api://tgt_project/tgt_package?'),
                        nargs=2,
                        action='append',
                        default=[])
    opt_changedevel = Option('',
                             'changedevel',
                             'create new changedevel action',
                             oargs=('api://src_project/src_package '
                                    'api://tgt_project/tgt_package?'),
                             nargs=2,
                             action='append',
                             default=[])
    opt_role = Option('',
                      'role',
                      'create new role action',
                      oargs='role user api://project/package?',
                      nargs=3,
                      action='append',
                      default=[])
    opt_grouprole = Option('',
                           'grouprole',
                           'create new grouprole action',
                           oargs='role group api://project/package?',
                           nargs=3,
                           action='append',
                           default=[])
    opt_delete = Option('',
                        'delete',
                        'create new delete action',
                        oargs='api://project/package?',
                        nargs=1,
                        action='append',
                        default=[])
    func = call(RequestController.create)
Example #15
0
class Status(CommandDescription, OscCommand):
    """Status of package or package file.

    Examples:
    osc status                          # in a project or package wc
    osc status project                  # update project
    osc status package                  # update package
    osc status /path/to/wc/or/wc/file   # update package

    """
    cmd = 'status'
    args = '(wc_path)?'
    opt_verbose = Option('v',
                         'verbose',
                         'also print unchanged states',
                         action='store_true')
    func = call(status)