diff hgext/uncommit.py @ 41745:83d294c71f1e

uncommit: inform user if the commit is empty after uncommit Differential Revision: https://phab.mercurial-scm.org/D5969
author Martin von Zweigbergk <martinvonz@google.com>
date Fri, 15 Feb 2019 10:49:12 -0800
parents 0bd56c291359
children 1040d54eb7eb
line wrap: on
line diff
--- a/hgext/uncommit.py	Thu Feb 14 15:35:47 2019 +0100
+++ b/hgext/uncommit.py	Fri Feb 15 10:49:12 2019 -0800
@@ -64,11 +64,11 @@
     if not exclude:
         return None
 
-    files = (initialfiles - exclude)
     # return the p1 so that we don't create an obsmarker later
     if not keepcommit:
         return ctx.p1().node()
 
+    files = (initialfiles - exclude)
     # Filter copies
     copied = copiesmod.pathcopies(base, ctx)
     copied = dict((dst, src) for dst, src in copied.iteritems()
@@ -83,6 +83,9 @@
                                   copied=copied.get(path))
         return mctx
 
+    if not files:
+        repo.ui.status(_("note: keeping empty commit\n"))
+
     new = context.memctx(repo,
                          parents=[base.node(), node.nullid],
                          text=ctx.description(),