comparison hgext/uncommit.py @ 42903:66048f6b5d0d

uncommit: add options to update to the current user or current date These are also from the evolve extension's version of uncommit. I tried adding validation that both forms of user or date can't be specified at the same time, but that fails because these show up in `opts` with a None value whether or not the option was given on the command line. Presumably that means the conditional in `resolvecommitoptions` could be simplified. But this is how both evolve and MQ handle it. Differential Revision: https://phab.mercurial-scm.org/D6828
author Matt Harbison <matt_harbison@yahoo.com>
date Sat, 07 Sep 2019 23:20:11 -0400
parents ff1ff2aae132
children 2da754532dd3
comparison
equal deleted inserted replaced
42902:ff1ff2aae132 42903:66048f6b5d0d
110 110
111 @command('uncommit', 111 @command('uncommit',
112 [('', 'keep', None, _('allow an empty commit after uncommiting')), 112 [('', 'keep', None, _('allow an empty commit after uncommiting')),
113 ('', 'allow-dirty-working-copy', False, 113 ('', 'allow-dirty-working-copy', False,
114 _('allow uncommit with outstanding changes')) 114 _('allow uncommit with outstanding changes'))
115 ] + commands.walkopts + commands.commitopts + commands.commitopts2, 115 ] + commands.walkopts + commands.commitopts + commands.commitopts2
116 + commands.commitopts3,
116 _('[OPTION]... [FILE]...'), 117 _('[OPTION]... [FILE]...'),
117 helpcategory=command.CATEGORY_CHANGE_MANAGEMENT) 118 helpcategory=command.CATEGORY_CHANGE_MANAGEMENT)
118 def uncommit(ui, repo, *pats, **opts): 119 def uncommit(ui, repo, *pats, **opts):
119 """uncommit part or all of a local changeset 120 """uncommit part or all of a local changeset
120 121
125 126
126 If no files are specified, the commit will be pruned, unless --keep is 127 If no files are specified, the commit will be pruned, unless --keep is
127 given. 128 given.
128 """ 129 """
129 opts = pycompat.byteskwargs(opts) 130 opts = pycompat.byteskwargs(opts)
131
132 cmdutil.resolvecommitoptions(ui, opts)
130 133
131 with repo.wlock(), repo.lock(): 134 with repo.wlock(), repo.lock():
132 135
133 m, a, r, d = repo.status()[:4] 136 m, a, r, d = repo.status()[:4]
134 isdirtypath = any(set(m + a + r + d) & set(pats)) 137 isdirtypath = any(set(m + a + r + d) & set(pats))