diff --git a/hgext/uncommit.py b/hgext/uncommit.py --- a/hgext/uncommit.py +++ b/hgext/uncommit.py @@ -155,9 +155,9 @@ with repo.wlock(), repo.lock(): - if not pats and not repo.ui.configbool('experimental', - 'uncommitondirtywdir'): - cmdutil.bailifchanged(repo) + if not repo.ui.configbool('experimental', 'uncommitondirtywdir'): + cmdutil.bailifchanged(repo, hint=_('requires ' + 'experimental.uncommitondirtywdir to uncommit')) old = repo['.'] rewriteutil.precheck(repo, [old.rev()], 'uncommit') if len(old.parents()) > 1: diff --git a/tests/test-uncommit.t b/tests/test-uncommit.t --- a/tests/test-uncommit.t +++ b/tests/test-uncommit.t @@ -156,8 +156,12 @@ M files $ hg uncommit abort: uncommitted changes + (requires experimental.uncommitondirtywdir to uncommit) [255] $ hg uncommit files + abort: uncommitted changes + (requires experimental.uncommitondirtywdir to uncommit) + [255] $ cat files abcde foo @@ -168,6 +172,7 @@ $ echo "bar" >> files $ hg uncommit abort: uncommitted changes + (requires experimental.uncommitondirtywdir to uncommit) [255] $ hg uncommit --config experimental.uncommitondirtywdir=True $ hg commit -m "files abcde + foo" @@ -191,16 +196,16 @@ +abc $ hg bookmark - foo 10:48e5bd7cd583 + foo 9:48e5bd7cd583 $ hg uncommit 3 new orphan changesets $ hg status M files A file-abc $ hg heads -T '{rev}:{node} {desc}' - 10:48e5bd7cd583eb24164ef8b89185819c84c96ed7 files abcde + foo (no-eol) + 9:48e5bd7cd583eb24164ef8b89185819c84c96ed7 files abcde + foo (no-eol) $ hg bookmark - foo 10:48e5bd7cd583 + foo 9:48e5bd7cd583 $ hg commit -m 'new abc' created new head @@ -222,38 +227,36 @@ +ab $ hg bookmark - foo 10:48e5bd7cd583 + foo 9:48e5bd7cd583 $ hg uncommit file-ab 1 new orphan changesets $ hg status A file-ab $ hg heads -T '{rev}:{node} {desc}\n' - 12:8eb87968f2edb7f27f27fe676316e179de65fff6 added file-ab - 11:5dc89ca4486f8a88716c5797fa9f498d13d7c2e1 new abc - 10:48e5bd7cd583eb24164ef8b89185819c84c96ed7 files abcde + foo + 11:8eb87968f2edb7f27f27fe676316e179de65fff6 added file-ab + 10:5dc89ca4486f8a88716c5797fa9f498d13d7c2e1 new abc + 9:48e5bd7cd583eb24164ef8b89185819c84c96ed7 files abcde + foo $ hg bookmark - foo 10:48e5bd7cd583 + foo 9:48e5bd7cd583 $ hg commit -m 'update ab' $ hg status $ hg heads -T '{rev}:{node} {desc}\n' - 13:f21039c59242b085491bb58f591afc4ed1c04c09 update ab - 11:5dc89ca4486f8a88716c5797fa9f498d13d7c2e1 new abc - 10:48e5bd7cd583eb24164ef8b89185819c84c96ed7 files abcde + foo + 12:f21039c59242b085491bb58f591afc4ed1c04c09 update ab + 10:5dc89ca4486f8a88716c5797fa9f498d13d7c2e1 new abc + 9:48e5bd7cd583eb24164ef8b89185819c84c96ed7 files abcde + foo $ hg log -G -T '{rev}:{node} {desc}' --hidden - @ 13:f21039c59242b085491bb58f591afc4ed1c04c09 update ab + @ 12:f21039c59242b085491bb58f591afc4ed1c04c09 update ab | - o 12:8eb87968f2edb7f27f27fe676316e179de65fff6 added file-ab + o 11:8eb87968f2edb7f27f27fe676316e179de65fff6 added file-ab | - | * 11:5dc89ca4486f8a88716c5797fa9f498d13d7c2e1 new abc + | * 10:5dc89ca4486f8a88716c5797fa9f498d13d7c2e1 new abc | | - | | * 10:48e5bd7cd583eb24164ef8b89185819c84c96ed7 files abcde + foo + | | * 9:48e5bd7cd583eb24164ef8b89185819c84c96ed7 files abcde + foo | | | - | | | x 9:8a6b58c173ca6a2e3745d8bd86698718d664bc6c files abcde + foo - | | |/ - | | | x 8:39ad452c7f684a55d161c574340c5766c4569278 update files for abcde + | | | x 8:84beeba0ac30e19521c036e4d2dd3a5fa02586ff files abcde + foo | | |/ | | | x 7:0977fa602c2fd7d8427ed4e7ee15ea13b84c9173 update files for abcde | | |/ @@ -275,14 +278,14 @@ $ hg uncommit $ hg phase -r . - 12: draft + 11: draft $ hg commit -m 'update ab again' Phase is preserved $ hg uncommit --keep --config phases.new-commit=secret $ hg phase -r . - 15: draft + 14: draft $ hg commit --amend -m 'update ab again' Uncommit with public parent @@ -290,7 +293,7 @@ $ hg phase -p "::.^" $ hg uncommit $ hg phase -r . - 12: public + 11: public Partial uncommit with public parent @@ -301,9 +304,9 @@ $ hg status A xyz $ hg phase -r . - 18: draft + 17: draft $ hg phase -r ".^" - 12: public + 11: public Uncommit leaving an empty changeset @@ -368,6 +371,7 @@ $ hg uncommit abort: outstanding uncommitted merge + (requires experimental.uncommitondirtywdir to uncommit) [255] $ hg uncommit --config experimental.uncommitondirtywdir=True @@ -398,3 +402,35 @@ |/ o 0:ea4e33293d4d274a2ba73150733c2612231f398c a 1 + $ cd .. + +experimental.uncommitondirtywdir should also work for uncommit PATH + + $ hg init issue5977 + $ cd issue5977 + $ echo 'super critical info!' > a + $ hg ci -Am 'add a' + adding a + $ echo 'foo' > a + $ hg unc a + abort: uncommitted changes + (requires experimental.uncommitondirtywdir to uncommit) + [255] + $ cat a + foo + $ hg log + changeset: 0:e37b99831f6e + tag: tip + user: test + date: Thu Jan 01 00:00:00 1970 +0000 + summary: add a + + $ hg unc --config experimental.uncommitondirtywdir=true a + $ hg log + changeset: 1:656ba143d384 + tag: tip + parent: -1:000000000000 + user: test + date: Thu Jan 01 00:00:00 1970 +0000 + summary: add a +