Patchwork D7900: merge: avoid a negation in the definition of updatedirstate

login
register
mail settings
Submitter phabricator
Date Jan. 16, 2020, 1:22 a.m.
Message ID <differential-rev-PHID-DREV-ly3dg2fkldimc6xjiqfu-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/44408/
State Superseded
Headers show

Comments

phabricator - Jan. 16, 2020, 1:22 a.m.
martinvonz created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  We only use `partial` in one place: the definition of
  `updatedirstate`. Let's simplify that a little.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/merge.py

CHANGE DETAILS




To: martinvonz, #hg-reviewers
Cc: mercurial-devel
phabricator - Jan. 24, 2020, 12:57 p.m.
pulkit added inline comments.

INLINE COMMENTS

> merge.py:2291
>              )
>      # If we're doing a partial update, we need to skip updating
>      # the dirstate, so make a note of any partial-ness to the

This comment now looks misplaced.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7900/new/

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

To: martinvonz, #hg-reviewers
Cc: pulkit, mercurial-devel
phabricator - Jan. 24, 2020, 4:42 p.m.
martinvonz added inline comments.
martinvonz marked an inline comment as done.

INLINE COMMENTS

> pulkit wrote in merge.py:2291
> This comment now looks misplaced.

I'll insert another patch before this one to help with that.

Unrelated to your comment, I'll also reorder D7901 <https://phab.mercurial-scm.org/D7901> and D7902 <https://phab.mercurial-scm.org/D7902> because I think D7902 <https://phab.mercurial-scm.org/D7902> is less controversial.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7900/new/

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

To: martinvonz, #hg-reviewers
Cc: pulkit, mercurial-devel

Patch

diff --git a/mercurial/merge.py b/mercurial/merge.py
--- a/mercurial/merge.py
+++ b/mercurial/merge.py
@@ -2291,10 +2291,7 @@ 
     # If we're doing a partial update, we need to skip updating
     # the dirstate, so make a note of any partial-ness to the
     # update here.
-    if matcher is None or matcher.always():
-        partial = False
-    else:
-        partial = True
+    always = matcher is None or matcher.always()
     with repo.wlock():
         if wc is None:
             wc = repo[None]
@@ -2507,7 +2504,7 @@ 
         ### apply phase
         if not branchmerge:  # just jump to the new rev
             fp1, fp2, xp1, xp2 = fp2, nullid, xp2, b''
-        updatedirstate = not partial and not wc.isinmemory()
+        updatedirstate = always and not wc.isinmemory()
         if updatedirstate:
             repo.hook(b'preupdate', throw=True, parent1=xp1, parent2=xp2)
             # note that we're in the middle of an update