示例#1
0
        action='store_true',
        short='Prefix the patch names with order numbers'),
    opt('-t',
        '--template',
        metavar='FILE',
        args=[argparse.files],
        short='Use FILE as a template'),
    opt('-b',
        '--branch',
        args=[argparse.stg_branches],
        short='Use BRANCH instead of the default branch'),
    opt('-s',
        '--stdout',
        action='store_true',
        short='Dump the patches to the standard output'),
] + argparse.diff_opts_option()

directory = common.DirectoryHasRepositoryLib()


def func(parser, options, args):
    """Export a range of patches.
    """
    stack = directory.repository.get_stack(options.branch)

    if options.dir:
        dirname = options.dir
    else:
        dirname = 'patches-%s' % stack.name
        directory.cd_to_topdir()
示例#2
0
文件: mail.py 项目: hasturkun/stgit
        '--mbox',
        action='store_true',
        short='Generate an mbox file instead of sending',
    ),
    opt(
        '--domain',
        metavar='DOMAIN',
        short='Use DOMAIN when generating message IDs '
        '(instead of the system hostname)',
    ),
    opt(
        '--git',
        action='store_true',
        short='Use git send-email (EXPERIMENTAL)',
    ),
] + diff_opts_option()

directory = DirectoryHasRepository()


def __get_sender():
    """Return the 'authname <authemail>' string as read from the
    configuration file
    """
    sender = config.get('stgit.sender')
    if not sender:
        user = Person.user()
        if user.email:
            sender = user.name_email
        else:
            author = Person.author()
示例#3
0
        action='store_false',
        dest='submodules',
        short='Exclude submodules when refreshing patch contents',
    ),
    opt(
        '--spill',
        action='store_true',
        dest='spill',
        short='Spill patch content to worktree and index, erasing patch content.',
    ),
]
options.extend(argparse.message_options(save_template=False))
options.extend(argparse.hook_options())
options.extend(argparse.trailer_options())
options.extend(argparse.author_options())
options.extend(argparse.diff_opts_option())

directory = DirectoryHasRepository()


def get_patch(stack, given_patch):
    """Get the name of the patch we are to refresh."""
    if given_patch:
        patch_name = given_patch
        if patch_name not in stack.patches:
            raise CmdException('%s: no such patch' % patch_name)
        return patch_name
    else:
        if not stack.patchorder.applied:
            raise CmdException(
                'Cannot refresh top patch because no patches are applied'
示例#4
0
文件: files.py 项目: snits/stgit
usage = ['[options] [--] [[<branch>:]<patch>]']
description = """
List the files modified by the given patch (defaulting to the current
one). Passing the '--stat' option shows the diff statistics for the
given patch. Note that this command doesn't show the files modified in
the working tree and not yet included in the patch by a 'refresh'
command. Use the 'diff' or 'status' commands for these files."""

args = [argparse.applied_patches, argparse.unapplied_patches,
        argparse.hidden_patches]
options = [
    opt('-s', '--stat', action = 'store_true',
        short = 'Show the diffstat'),
    opt('--bare', action = 'store_true',
        short = 'Bare file names (useful for scripting)'),
    ] + argparse.diff_opts_option()

directory = DirectoryHasRepository(log=False)
crt_series = None


def func(parser, options, args):
    """Show the files modified by a patch (or the current patch)
    """
    if len(args) == 0:
        patch = 'HEAD'
    elif len(args) == 1:
        patch = args[0]
    else:
        parser.error('incorrect number of arguments')
示例#5
0
文件: edit.py 项目: snits/stgit
the top patch, the index and work tree will be updated to match the
tree.  This low-level option is primarily meant to be used by tools
built on top of StGit, such as the Emacs mode. See also the --set-tree
flag of stg push."""

args = [argparse.applied_patches, argparse.unapplied_patches,
        argparse.hidden_patches]
options = (
    [ opt('-d', '--diff', action = 'store_true',
          short = 'Edit the patch diff'),
      opt('-e', '--edit', action = 'store_true',
          short = 'Invoke interactive editor') ] +
    argparse.sign_options() +
    argparse.message_options(save_template = True) +
    argparse.hook_options() +
    argparse.author_options() + argparse.diff_opts_option() +
    [ opt('-t', '--set-tree', action = 'store',
          metavar = 'TREE-ISH',
          short = 'Set the git tree of the patch to TREE-ISH') ])

directory = common.DirectoryHasRepositoryLib()

def func(parser, options, args):
    """Edit the given patch or the current one.
    """
    stack = directory.repository.current_stack

    if len(args) == 0:
        if not stack.patchorder.applied:
            raise common.CmdException(
                'Cannot edit top patch, because no patches are applied')