コード例 #1
0
        short='Annotate the patch log entry',
    ),
    opt(
        '-s',
        '--submodules',
        action='store_true',
        short='Include submodules when refreshing patch contents',
    ),
    opt(
        '',
        '--no-submodules',
        action='store_false',
        dest='submodules',
        short='Exclude submodules when refreshing patch contents',
    )
] + (argparse.message_options(save_template=False) + argparse.hook_options() +
     argparse.sign_options() + argparse.author_options())

directory = common.DirectoryHasRepositoryLib()


def get_patch(stack, given_patch):
    """Get the name of the patch we are to refresh."""
    if given_patch:
        patch_name = given_patch
        if not stack.patches.exists(patch_name):
            raise common.CmdException('%s: no such patch' % patch_name)
        return patch_name
    else:
        if not stack.patchorder.applied:
            raise common.CmdException(
コード例 #2
0
ファイル: refresh.py プロジェクト: ctmarinas/stgit-devel
        opt(
            '-s',
            '--submodules',
            action='store_true',
            short='Include submodules when refreshing patch contents',
        ),
        opt(
            '--no-submodules',
            action='store_false',
            dest='submodules',
            short='Exclude submodules when refreshing patch contents',
        ),
    ]
    + (
        argparse.message_options(save_template=False)
        + argparse.hook_options()
        + argparse.sign_options()
        + argparse.author_options()
    )
)

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 not stack.patches.exists(patch_name):
            raise CmdException('%s: no such patch' % patch_name)
        return patch_name
コード例 #3
0
args = []
options = [
    opt(
        '-v',
        '--verbose',
        action='store_true',
        short='show diff in patch commit message template',
        long='''
        In addition to the names of files that have been changed, also show a
        diff of staged and unstaged changes.''',
    ),
]
options.extend(argparse.author_options())
options.extend(argparse.message_options(save_template=True))
options.extend(argparse.trailer_options())
options.extend(argparse.hook_options())

directory = DirectoryHasRepository()


def func(parser, options, args):
    """Create a new patch."""
    stack = directory.repository.current_stack
    if stack.repository.default_index.conflicts():
        raise CmdException(
            'Cannot create a new patch -- resolve conflicts first')

    # Choose a name for the new patch -- or None, which means make one
    # up later when we've gotten hold of the commit message.
    if len(args) == 0:
        name = None
コード例 #4
0
top of the stack. Uncommitted changes in the work tree are not
included in the patch -- that is handled by linkstg:refresh[].

The given name must be unique in the stack, and may only contain
alphanumeric characters, dashes and underscores. If no name is given,
one is generated from the first line of the patch's commit message.

An editor will be launched to edit the commit message to be used for
the patch, unless the '--message' flag already specified one. The
'patchdescr.tmpl' template file (if available) is used to pre-fill the
editor."""

args = []
options = (argparse.author_options() +
           argparse.message_options(save_template=True) +
           argparse.sign_options() + argparse.hook_options())

directory = DirectoryHasRepository()


def func(parser, options, args):
    """Create a new patch."""
    stack = directory.repository.current_stack
    if stack.repository.default_index.conflicts():
        raise CmdException(
            'Cannot create a new patch -- resolve conflicts first')

    # Choose a name for the new patch -- or None, which means make one
    # up later when we've gotten hold of the commit message.
    if len(args) == 0:
        name = None
コード例 #5
0
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 = ['applied_patches', 'unapplied_patches', '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 = DirectoryHasRepository()


def func(parser, options, args):
    """Edit the given patch or the current one.
コード例 #6
0
ファイル: refresh.py プロジェクト: snits/stgit
        short = 'Refresh from index instead of worktree', long = """
        Instead of setting the patch top to the current contents of
        the worktree, set it to the current contents of the index."""),
    opt('-F', '--force', action = 'store_true',
        short = 'Force refresh even if index is dirty', long = """
        Instead of warning the user when some work has already been staged (such
        as with git add interactive mode) force a full refresh."""),
    opt('-p', '--patch', args = [argparse.other_applied_patches,
                                 argparse.unapplied_patches],
        short = 'Refresh (applied) PATCH instead of the top patch'),
    opt('-e', '--edit', action = 'store_true',
        short = 'Invoke an editor for the patch description'),
    opt('-a', '--annotate', metavar = 'NOTE',
        short = 'Annotate the patch log entry')
    ] + (argparse.message_options(save_template = False) +
         argparse.hook_options() +
         argparse.sign_options() + argparse.author_options())

directory = common.DirectoryHasRepositoryLib()

def get_patch(stack, given_patch):
    """Get the name of the patch we are to refresh."""
    if given_patch:
        patch_name = given_patch
        if not stack.patches.exists(patch_name):
            raise common.CmdException('%s: no such patch' % patch_name)
        return patch_name
    else:
        if not stack.patchorder.applied:
            raise common.CmdException(
                'Cannot refresh top patch, because no patches are applied')