[Request] [+ ] D11427: dirstate: make a conditionnal easier to read in `setparents`

marmoute (Pierre-Yves David) phabricator at mercurial-scm.org
Thu Sep 16 14:43:10 UTC 2021


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

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:



To: marmoute, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mercurial-scm.org/pipermail/mercurial-patches/attachments/20210916/f20ce96c/attachment.html>


More information about the Mercurial-patches mailing list