Patchwork D8833: sparse: add comment for an if condition which I tried to refactor

login
register
mail settings
Submitter phabricator
Date July 25, 2020, 10:03 a.m.
Message ID <differential-rev-PHID-DREV-4aa2helvpyizmucrnm6t-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/46904/
State Superseded
Headers show

Comments

phabricator - July 25, 2020, 10:03 a.m.
pulkit created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  I tried to refactor this if condition and make it part of the if-else above but
  tests failed. I decided to add a comment about the check we are doing and why
  it's a separate if.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/sparse.py

CHANGE DETAILS




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

Patch

diff --git a/mercurial/sparse.py b/mercurial/sparse.py
--- a/mercurial/sparse.py
+++ b/mercurial/sparse.py
@@ -407,6 +407,12 @@ 
         elif file in wctx:
             prunedactions[file] = (mergestatemod.ACTION_REMOVE, args, msg)
 
+        # in case or rename on one side, it is possible that f1 might not
+        # be present in sparse checkout we should include it
+        # TODO: should we do the same for f2?
+        # exists as a separate check because file can be in sparse and hence
+        # if we try to club this condition in above `elif type == ACTION_MERGE`
+        # it won't be triggered
         if branchmerge and type == mergestatemod.ACTION_MERGE:
             f1, f2, fa, move, anc = args
             if not sparsematch(f1):