def func(parser, options, args): stack = directory.repository.current_stack if options.number < 1: raise common.CmdException('Bad number of undos to redo') state = log.undo_state(stack, -options.number) trans = transaction.StackTransaction(stack, 'redo %d' % options.number, discard_changes = options.hard, allow_bad_head = True) try: log.reset_stack(trans, stack.repository.default_iw, state) except transaction.TransactionHalted: pass return trans.run(stack.repository.default_iw, allow_bad_head = True)
def func(parser, options, args): stack = directory.repository.current_stack if options.number < 1: raise CmdException('Bad number of commands to undo') state = log.undo_state(stack, options.number) trans = transaction.StackTransaction(stack, discard_changes=options.hard) try: log.reset_stack(trans, stack.repository.default_iw, state) except transaction.TransactionHalted: pass return trans.execute('undo %d' % options.number, stack.repository.default_iw, allow_bad_head=True)