Pierre-Yves David avatar 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
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.