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 @@ -174,4 +175,24 @@ |/ o 0:3004d2d9b50883c1538fc754a3aeb55f1b4084f6 added file-a +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