changeset 45295:6a8eafaeff3b

sparse: add comment for an if condition which I tried to refactor 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. Differential Revision: https://phab.mercurial-scm.org/D8833
author Pulkit Goyal <7895pulkit@gmail.com>
date Fri, 24 Jul 2020 23:49:08 +0530
parents 30f3e278c5d7
children cb0cd87e16b4
files mercurial/sparse.py
diffstat 1 files changed, 6 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/sparse.py	Fri Jul 24 23:40:07 2020 +0530
+++ b/mercurial/sparse.py	Fri Jul 24 23:49:08 2020 +0530
@@ -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):