Patchwork [1,of,4,V2] commit: move empty commit condition to a new line

login
register
mail settings
Submitter Durham Goode
Date May 12, 2015, 3:29 a.m.
Message ID <bb446b7270951339396e.1431401350@dev2000.prn2.facebook.com>
Download mbox | patch
Permalink /patch/9022/
State Accepted
Headers show

Comments

Durham Goode - May 12, 2015, 3:29 a.m.
# HG changeset patch
# User Durham Goode <durham@fb.com>
# Date 1431386182 25200
#      Mon May 11 16:16:22 2015 -0700
# Node ID bb446b7270951339396e948f4e4474781d830eff
# Parent  015adbcd92f3bc15305a3ed4ee59676ff358eabf
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.

Patch

diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -1462,9 +1462,9 @@  class localrepository(object):
             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():