evolve: warn when uncommit leave an empty changeset
authorPierre-Yves David <pierre-yves.david@ens-lyon.org>
Wed, 27 Jun 2012 03:51:54 +0200
changeset 318 da7509e7b50c
parent 317 c099ed0dd472
child 319 e7431cf7fca9
evolve: warn when uncommit leave an empty changeset This is intended to replace the proposed --delete flag.
hgext/evolve.py
tests/test-uncommit.t
--- a/hgext/evolve.py	Wed Jun 27 03:37:49 2012 +0200
+++ b/hgext/evolve.py	Wed Jun 27 03:51:54 2012 +0200
@@ -610,6 +610,9 @@
             repo.dirstate.setparents(newid, node.nullid)
             _uncommitdirstate(repo, old, match)
             updatebookmarks(newid)
+            if not repo[newid].files():
+                ui.warn(_("new changeset is empty\n"))
+                ui.status(_('(use "hg kill ." to remove it)\n'))
         finally:
             wlock.release()
     finally:
--- a/tests/test-uncommit.t	Wed Jun 27 03:37:49 2012 +0200
+++ b/tests/test-uncommit.t	Wed Jun 27 03:51:54 2012 +0200
@@ -311,6 +311,17 @@
   5eb72dbe0cb4 c706fe2c12f8
   5eb72dbe0cb4 e8db4aa611f6
 
+Display a warning if nothing left
+
+  $ hg uncommit e
+  new changeset is empty
+  (use "hg kill ." to remove it)
+  $ hg debugsuccessors
+  5eb72dbe0cb4 c4cbebac3751
+  5eb72dbe0cb4 c706fe2c12f8
+  5eb72dbe0cb4 e8db4aa611f6
+  c4cbebac3751 4f1c269eab68
+
 Test instability warning
 
   $ hg ci -m touncommit
@@ -318,6 +329,6 @@
   $ hg ci -Am addunrelated unrelated
   $ hg gdown
   0 files updated, 0 files merged, 1 files removed, 0 files unresolved
-  [7] touncommit
+  [8] touncommit
   $ hg uncommit aa
   1 new unstables changesets