Show More
@@ -140,6 +140,8 b' def _fixdirstate(repo, oldctx, newctx, m' | |||
|
140 | 140 | |
|
141 | 141 | @command('uncommit', |
|
142 | 142 | [('', 'keep', None, _('allow an empty commit after uncommiting')), |
|
143 | ('', 'allow-dirty-working-copy', False, | |
|
144 | _('allow uncommit with outstanding changes')) | |
|
143 | 145 | ] + commands.walkopts, |
|
144 | 146 | _('[OPTION]... [FILE]...'), |
|
145 | 147 | helpcategory=command.CATEGORY_CHANGE_MANAGEMENT) |
@@ -160,10 +162,11 b' def uncommit(ui, repo, *pats, **opts):' | |||
|
160 | 162 | |
|
161 | 163 | m, a, r, d = repo.status()[:4] |
|
162 | 164 | isdirtypath = any(set(m + a + r + d) & set(pats)) |
|
163 | if (not repo.ui.configbool('experimental', 'uncommitondirtywdir') and | |
|
164 | (not pats or isdirtypath)): | |
|
165 | allowdirtywcopy = (opts['allow_dirty_working_copy'] or | |
|
166 | repo.ui.configbool('experimental', 'uncommitondirtywdir')) | |
|
167 | if not allowdirtywcopy and (not pats or isdirtypath): | |
|
165 | 168 | cmdutil.bailifchanged(repo, hint=_('requires ' |
|
166 |
' |
|
|
169 | '--allow-dirty-working-copy to uncommit')) | |
|
167 | 170 | old = repo['.'] |
|
168 | 171 | rewriteutil.precheck(repo, [old.rev()], 'uncommit') |
|
169 | 172 | if len(old.parents()) > 1: |
@@ -35,6 +35,7 b' Help for uncommit' | |||
|
35 | 35 | options ([+] can be repeated): |
|
36 | 36 | |
|
37 | 37 | --keep allow an empty commit after uncommiting |
|
38 | --allow-dirty-working-copy allow uncommit with outstanding changes | |
|
38 | 39 | -I --include PATTERN [+] include names matching the given patterns |
|
39 | 40 | -X --exclude PATTERN [+] exclude names matching the given patterns |
|
40 | 41 | |
@@ -156,11 +157,11 b' Uncommit with dirty state' | |||
|
156 | 157 | M files |
|
157 | 158 | $ hg uncommit |
|
158 | 159 | abort: uncommitted changes |
|
159 |
(requires |
|
|
160 | (requires --allow-dirty-working-copy to uncommit) | |
|
160 | 161 | [255] |
|
161 | 162 | $ hg uncommit files |
|
162 | 163 | abort: uncommitted changes |
|
163 |
(requires |
|
|
164 | (requires --allow-dirty-working-copy to uncommit) | |
|
164 | 165 | [255] |
|
165 | 166 | $ cat files |
|
166 | 167 | abcde |
@@ -172,7 +173,7 b" Testing the 'experimental.uncommitondirt" | |||
|
172 | 173 | $ echo "bar" >> files |
|
173 | 174 | $ hg uncommit |
|
174 | 175 | abort: uncommitted changes |
|
175 |
(requires |
|
|
176 | (requires --allow-dirty-working-copy to uncommit) | |
|
176 | 177 | [255] |
|
177 | 178 | $ hg uncommit --config experimental.uncommitondirtywdir=True |
|
178 | 179 | $ hg commit -m "files abcde + foo" |
@@ -395,7 +396,7 b' Add and expect uncommit to fail on both ' | |||
|
395 | 396 | |
|
396 | 397 | $ hg uncommit |
|
397 | 398 | abort: outstanding uncommitted merge |
|
398 |
(requires |
|
|
399 | (requires --allow-dirty-working-copy to uncommit) | |
|
399 | 400 | [255] |
|
400 | 401 | |
|
401 | 402 | $ hg uncommit --config experimental.uncommitondirtywdir=True |
@@ -483,7 +484,7 b' experimental.uncommitondirtywdir should ' | |||
|
483 | 484 | note: keeping empty commit |
|
484 | 485 | $ hg unc b |
|
485 | 486 | abort: uncommitted changes |
|
486 |
(requires |
|
|
487 | (requires --allow-dirty-working-copy to uncommit) | |
|
487 | 488 | [255] |
|
488 | 489 | $ cat a |
|
489 | 490 | super critical info! |
@@ -497,7 +498,7 b' experimental.uncommitondirtywdir should ' | |||
|
497 | 498 | |
|
498 | 499 | $ hg ci -Am 'add b' |
|
499 | 500 | $ echo 'foo bar' > b |
|
500 | $ hg unc --config experimental.uncommitondirtywdir=True b | |
|
501 | $ hg unc --allow-dirty-working-copy b | |
|
501 | 502 | $ hg log |
|
502 | 503 | changeset: 3:30fa958635b2 |
|
503 | 504 | tag: tip |
General Comments 0
You need to be logged in to leave comments.
Login now