changeset 26:3c2eaa8d1d22

commit: some merges are not committed Merges without modified/added/removed files were skipped by condcommit().
author jcoomes
date Sat, 06 Sep 2014 08:16:39 -0700
parents 1c8acfd41d54
children 05c34e801d96
files trees.py
diffstat 1 files changed, 6 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/trees.py	Wed Jun 11 17:20:53 2014 -0700
+++ b/trees.py	Sat Sep 06 08:16:39 2014 -0700
@@ -452,9 +452,12 @@
     hgcommit = _origcmd('commit')
     def condcommit(ui, repo, *pats, **opts):
         '''commit conditionally - only if there is something to commit'''
-        for l in repo.status()[:3]: # modified, added, removed
-            if l:
-                return hgcommit(ui, repo, *pats, **opts)
+        needcommit = len(repo[None].parents()) > 1 # merge
+        if not needcommit:
+            mar = repo.status()[:3] # modified, added, removed
+            needcommit = bool(mar[0] or mar[1] or mar[2])
+        if needcommit:
+            return hgcommit(ui, repo, *pats, **opts)
         ui.status('nothing to commit\n')
         return 0