[PATCH 1 of 4 V2] commit: move empty commit condition to a new line
Durham Goode
durham at fb.com
Tue May 12 03:29:10 UTC 2015
# HG changeset patch
# User Durham Goode <durham at 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.
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():
More information about the Mercurial-devel
mailing list