Commits

Pierre-Yves David committed da7509e

evolve: warn when uncommit leave an empty changeset

This is intended to replace the proposed --delete flag.

Comments (0)

Files changed (2)

             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:

tests/test-uncommit.t

   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
   $ 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