commit: move empty commit condition to a new line
authorDurham Goode <durham@fb.com>
Mon, 11 May 2015 16:16:22 -0700
changeset 25017 4e857213d2d1
parent 25016 42e89b87ca79
child 25018 93e015a3d1ea
commit: move empty commit condition to a new line The empty commit condition was a messy if condition. Let's move it to a new line and change it to 'or' statements so it's cleaner and more readable. A future commit will add additional logic to this line.
mercurial/localrepo.py
--- a/mercurial/localrepo.py	Fri May 08 15:04:14 2015 -0700
+++ b/mercurial/localrepo.py	Mon May 11 16:16:22 2015 -0700
@@ -1462,9 +1462,9 @@
             cctx = context.workingcommitctx(self, status,
                                             text, user, date, extra)
 
-            if (not force and not extra.get("close") and not merge
-                and not cctx.files()
-                and wctx.branch() == wctx.p1().branch()):
+            allowemptycommit = (wctx.branch() != wctx.p1().branch() or force
+                                or extra.get('close') or merge or cctx.files())
+            if not allowemptycommit:
                 return None
 
             if merge and cctx.deleted():