diff --git a/hgext3rd/uncommit.py b/hgext3rd/uncommit.py --- a/hgext3rd/uncommit.py +++ b/hgext3rd/uncommit.py @@ -57,7 +57,7 @@ return None files = (initialfiles - exclude) - if not files: + if not files and not repo.ui.configbool('ui', 'allowemptycommit'): return ctx.parents()[0].node() # Filter copies diff --git a/tests/test-uncommit.t b/tests/test-uncommit.t --- a/tests/test-uncommit.t +++ b/tests/test-uncommit.t @@ -5,6 +5,7 @@ > evolution=createmarkers > [extensions] > uncommit = $TESTDIR/../hgext3rd/uncommit.py + > drawdag=$RUNTESTDIR/drawdag.py > EOF Build up a repo @@ -200,3 +201,25 @@ 14: draft $ hg phase -r ".^" 10: public + +Uncommit leaving an empty changeset + + $ cd $TESTTMP + $ hg init repo1 + $ cd repo1 + $ hg debugdrawdag <<'EOS' + > Q + > | + > P + > EOS + $ hg up Q -q + $ hg uncommit --config ui.allowemptycommit=1 + $ hg log -G -T '{desc} FILES: {files}' + @ Q FILES: + | + | x Q FILES: Q + |/ + o P FILES: P + + $ hg status + A Q