예제 #1
0
파일: goto.py 프로젝트: snits/stgit
MERCHANTABILITY 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/.
"""

help = 'Push or pop patches to the given one'
kind = 'stack'
usage = ['[options] [--] <patch-name>']
description = """
Push/pop patches to/from the stack until the one given on the command
line becomes current."""

args = [argparse.other_applied_patches, argparse.unapplied_patches]
options = argparse.keep_option() + argparse.merged_option()

directory = common.DirectoryHasRepositoryLib()

def func(parser, options, args):
    if len(args) != 1:
        parser.error('incorrect number of arguments')
    patch = args[0]

    stack = directory.repository.current_stack
    iw = stack.repository.default_iw
    clean_iw = (not options.keep and iw) or None
    trans = transaction.StackTransaction(stack, 'goto',
                                         check_clean_iw = clean_iw)

    if patch not in trans.all_patches:
예제 #2
0
MERCHANTABILITY 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/.
"""

help = 'Push or pop patches to the given one'
kind = 'stack'
usage = ['[options] [--] <patch-name>']
description = """
Push/pop patches to/from the stack until the one given on the command
line becomes current."""

args = ['other_applied_patches', 'unapplied_patches']
options = argparse.keep_option() + argparse.merged_option()

directory = DirectoryHasRepository()


def func(parser, options, args):
    if len(args) != 1:
        parser.error('incorrect number of arguments')
    name = args[0]

    stack = directory.repository.current_stack
    iw = stack.repository.default_iw

    check_head_top_equal(stack)
    if not options.keep:
        check_index_and_worktree_clean(stack)
예제 #3
0
파일: pop.py 프로젝트: miracle2k/stgit
A series of pop and push operations are performed so that only the
patches passed on the command line are popped from the stack. Some of
the push operations may fail because of conflicts ("stg undo" would
revert the last push operation)."""

args = [argparse.patch_range(argparse.applied_patches)]
options = [
    opt('-a', '--all', action = 'store_true',
        short = 'Pop all the applied patches'),
    opt('-n', '--number', type = 'int',
        short = 'Pop the specified number of patches', long = '''
        Pop the specified number of patches.

        With a negative number, pop all but that many patches.'''),
    ] + argparse.keep_option()

directory = common.DirectoryHasRepositoryLib()

def func(parser, options, args):
    """Pop the given patches or the topmost one from the stack."""
    stack = directory.repository.current_stack
    iw = stack.repository.default_iw
    clean_iw = (not options.keep and iw) or None
    trans = transaction.StackTransaction(stack, 'pop',
                                         check_clean_iw = clean_iw)

    if options.number == 0:
        # explicitly allow this without any warning/error message
        return
예제 #4
0
    opt(
        '--set-tree',
        action='store_true',
        short='Push the patch with the original tree',
        long="""
        Push the patches, but don't perform a merge. Instead, the
        resulting tree will be identical to the tree that the patch
        previously created.

        This can be useful when splitting a patch by first popping the
        patch and creating a new patch with some of the
        changes. Pushing the original patch with '--set-tree' will
        avoid conflicts and only the remaining changes will be in the
        patch.""",
    ),
] + keep_option() + merged_option())

directory = DirectoryHasRepository()


def func(parser, options, args):
    """Pushes the given patches or the first unapplied onto the stack."""
    stack = directory.repository.current_stack
    iw = stack.repository.default_iw
    clean_iw = (not options.keep and iw) or None
    trans = transaction.StackTransaction(stack,
                                         'push',
                                         check_clean_iw=clean_iw)

    if options.number == 0:
        # explicitly allow this without any warning/error message
예제 #5
0
        '-s',
        '--spill',
        action='store_true',
        short='Pop a patch, keeping its modifications in the tree',
    ),
    opt(
        '-n',
        '--number',
        type='int',
        short='Pop the specified number of patches',
        long='''
        Pop the specified number of patches.

        With a negative number, pop all but that many patches.'''
    ),
] + keep_option()

directory = common.DirectoryHasRepositoryLib()


def func(parser, options, args):
    """Pop the given patches or the topmost one from the stack."""
    stack = directory.repository.current_stack
    iw = stack.repository.default_iw
    clean_iw = (not options.keep and not options.spill and iw) or None
    trans = transaction.StackTransaction(stack, 'pop', check_clean_iw=clean_iw)

    if options.number == 0:
        # explicitly allow this without any warning/error message
        return
예제 #6
0
        long="""
        Do not push back on the stack the formerly-applied patches.
        Only the patches to sink are pushed.""",
    ),
    opt(
        '-t',
        '--to',
        metavar='TARGET',
        args=['applied_patches'],
        short='Sink patches below the TARGET patch',
        long="""
        Specify a target patch to place the patches below, instead of
        sinking them to the bottom of the stack.""",
    ),
]
options.extend(keep_option())

directory = DirectoryHasRepository()


def func(parser, options, args):
    """Sink patches down the stack."""
    stack = directory.repository.current_stack

    if options.to and options.to not in stack.patchorder.applied:
        raise CmdException('Cannot sink below %s since it is not applied' %
                           options.to)

    if len(args) > 0:
        patches = parse_patches(args, stack.patchorder.all)
    else:
예제 #7
0
usage = ['[--] <patches>', '-s <series>']
description = """
Push a patch or a range of patches to the top even if applied. The
necessary pop and push operations will be performed to accomplish
this. The '--series' option can be used to rearrange the (top) patches
as specified by the given series file (or the standard input)."""

args = [
    argparse.patch_range(argparse.applied_patches, argparse.unapplied_patches)
]
options = [
    opt('-s',
        '--series',
        metavar='FILE',
        short='Rearrange according to the series FILE')
] + argparse.keep_option()

directory = common.DirectoryHasRepositoryLib()


def func(parser, options, args):
    """Reorder patches to make the named patch the topmost one.
    """
    if options.series and args:
        parser.error('<patches> cannot be used with --series')
    elif not options.series and not args:
        parser.error('incorrect number of arguments')

    stack = directory.repository.current_stack

    if options.series: