Show More
@@ -112,7 +112,8 b' def _commitfiltered(repo, ctx, match, ke' | |||||
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): | |
@@ -128,6 +129,8 b' def uncommit(ui, repo, *pats, **opts):' | |||||
128 | """ |
|
129 | """ | |
129 | opts = pycompat.byteskwargs(opts) |
|
130 | opts = pycompat.byteskwargs(opts) | |
130 |
|
131 | |||
|
132 | cmdutil.resolvecommitoptions(ui, opts) | |||
|
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] |
@@ -100,6 +100,13 b' commitopts2 = [' | |||||
100 | _('record the specified user as committer'), _('USER')), |
|
100 | _('record the specified user as committer'), _('USER')), | |
101 | ] |
|
101 | ] | |
102 |
|
102 | |||
|
103 | commitopts3 = [ | |||
|
104 | (b'D', b'current-date', None, | |||
|
105 | _(b'record the current date as commit date')), | |||
|
106 | (b'U', b'current-user', None, | |||
|
107 | _(b'record the current user as committer')), | |||
|
108 | ] | |||
|
109 | ||||
103 | formatteropts = [ |
|
110 | formatteropts = [ | |
104 | ('T', 'template', '', |
|
111 | ('T', 'template', '', | |
105 | _('display with template'), _('TEMPLATE')), |
|
112 | _('display with template'), _('TEMPLATE')), | |
@@ -175,6 +182,15 b' debugrevlogopts = [' | |||||
175 | # editor text |
|
182 | # editor text | |
176 | _linebelow = "^HG: ------------------------ >8 ------------------------$" |
|
183 | _linebelow = "^HG: ------------------------ >8 ------------------------$" | |
177 |
|
184 | |||
|
185 | def resolvecommitoptions(ui, opts): | |||
|
186 | """modify commit options dict to handle related options | |||
|
187 | """ | |||
|
188 | # N.B. this is extremely similar to setupheaderopts() in mq.py | |||
|
189 | if not opts.get(b'date') and opts.get(b'current_date'): | |||
|
190 | opts[b'date'] = b'%d %d' % dateutil.makedate() | |||
|
191 | if not opts.get(b'user') and opts.get(b'current_user'): | |||
|
192 | opts[b'user'] = ui.username() | |||
|
193 | ||||
178 | def ishunk(x): |
|
194 | def ishunk(x): | |
179 | hunkclasses = (crecordmod.uihunk, patch.recordhunk) |
|
195 | hunkclasses = (crecordmod.uihunk, patch.recordhunk) | |
180 | return isinstance(x, hunkclasses) |
|
196 | return isinstance(x, hunkclasses) |
@@ -118,6 +118,7 b' remoteopts = cmdutil.remoteopts' | |||||
118 | walkopts = cmdutil.walkopts |
|
118 | walkopts = cmdutil.walkopts | |
119 | commitopts = cmdutil.commitopts |
|
119 | commitopts = cmdutil.commitopts | |
120 | commitopts2 = cmdutil.commitopts2 |
|
120 | commitopts2 = cmdutil.commitopts2 | |
|
121 | commitopts3 = cmdutil.commitopts3 | |||
121 | formatteropts = cmdutil.formatteropts |
|
122 | formatteropts = cmdutil.formatteropts | |
122 | templateopts = cmdutil.templateopts |
|
123 | templateopts = cmdutil.templateopts | |
123 | logopts = cmdutil.logopts |
|
124 | logopts = cmdutil.logopts |
@@ -42,6 +42,8 b' Help for uncommit' | |||||
42 | -l --logfile FILE read commit message from file |
|
42 | -l --logfile FILE read commit message from file | |
43 | -d --date DATE record the specified date as commit date |
|
43 | -d --date DATE record the specified date as commit date | |
44 | -u --user USER record the specified user as committer |
|
44 | -u --user USER record the specified user as committer | |
|
45 | -D --current-date record the current date as commit date | |||
|
46 | -U --current-user record the current user as committer | |||
45 |
|
47 | |||
46 | (some details hidden, use --verbose to show complete help) |
|
48 | (some details hidden, use --verbose to show complete help) | |
47 |
|
49 |
General Comments 0
You need to be logged in to leave comments.
Login now