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