[PATCH 07 of 11 sparse] sparse: use self instead of repo.dirstate

Gregory Szorc gregory.szorc at gmail.com
Sat Jul 8 19:29:02 EDT 2017


# HG changeset patch
# User Gregory Szorc <gregory.szorc at gmail.com>
# Date 1499553731 25200
#      Sat Jul 08 15:42:11 2017 -0700
# Node ID 878672bc894f3752a435d4c2107ea17ef50323b4
# Parent  bafbabb23d7c584a0744e0bf6426d72649f14453
sparse: use self instead of repo.dirstate

"self" here is the dirstate instance. I'm pretty confident that self
and repo.dirstate will be the exact same object. So remove a dependency
on repo by just looking at self.

diff --git a/hgext/sparse.py b/hgext/sparse.py
--- a/hgext/sparse.py
+++ b/hgext/sparse.py
@@ -265,10 +265,9 @@ def _setupdirstate(ui):
             repo = self.repo
             sparsematch = sparse.matcher(repo)
             if not sparsematch.always():
-                dirstate = repo.dirstate
                 for f in args:
                     if (f is not None and not sparsematch(f) and
-                        f not in dirstate):
+                        f not in self):
                         raise error.Abort(_("cannot add '%s' - it is outside "
                                             "the sparse checkout") % f,
                                           hint=hint)


More information about the Mercurial-devel mailing list