Example #1
0
            '--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
    else:
        if not stack.patchorder.applied:
Example #2
0
    ),
    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(
                'Cannot refresh top patch because no patches are applied')
Example #3
0
'patchdescr.tmpl' template file (if available) is used to pre-fill the
editor."""

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
Example #4
0
            action="store_true",
            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(
            "-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.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")
Example #5
0
Create a new, empty patch on the current stack. The new patch is
created on top of the currently applied patches, and is made the new
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.
Example #6
0
Create a new, empty patch on the current stack. The new patch is
created on top of the currently applied patches, and is made the new
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())

directory = common.DirectoryHasRepositoryLib()

def func(parser, options, args):
    """Create a new patch."""
    stack = directory.repository.current_stack
    if stack.repository.default_index.conflicts():
        raise common.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:
Example #7
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.
Example #8
0
Create a new, empty patch on the current stack. The new patch is
created on top of the currently applied patches, and is made the new
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())

directory = common.DirectoryHasRepositoryLib()


def func(parser, options, args):
    """Create a new patch."""
    stack = directory.repository.current_stack
    if stack.repository.default_index.conflicts():
        raise common.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:
Example #9
0
'patchdescr.tmpl' template file (if available) is used to pre-fill the
editor."""

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 the textual changes that
        are staged to be committed and the changes in the working tree that have
        not yet been staged (i.e., like the output of git diff).''',
    ),
] + 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:
Example #10
0
        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.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')
        return stack.patchorder.applied[-1]
Example #11
0
File: edit.py Project: 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')