Patchwork D11427: dirstate: make a conditionnal easier to read in `setparents`

login
register
mail settings
Submitter phabricator
Date Sept. 16, 2021, 2:43 p.m.
Message ID <differential-rev-PHID-DREV-ki4ia3egcixzeusec3n4-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/49743/
State Superseded
Headers show

Comments

phabricator - Sept. 16, 2021, 2:43 p.m.
marmoute created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  By grabing `nullid` in the local space, we get the conditionnal to fit in one
  line.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D11427

AFFECTED FILES
  mercurial/dirstate.py

CHANGE DETAILS




To: marmoute, #hg-reviewers
Cc: mercurial-patches, mercurial-devel

Patch

diff --git a/mercurial/dirstate.py b/mercurial/dirstate.py
--- a/mercurial/dirstate.py
+++ b/mercurial/dirstate.py
@@ -387,10 +387,8 @@ 
             self._origpl = self._pl
         self._map.setparents(p1, p2)
         copies = {}
-        if (
-            oldp2 != self._nodeconstants.nullid
-            and p2 == self._nodeconstants.nullid
-        ):
+        nullid = self._nodeconstants.nullid
+        if oldp2 != nullid and p2 == nullid:
             candidatefiles = self._map.non_normal_or_other_parent_paths()
 
             for f in candidatefiles: