# HG changeset patch # User Gregory Szorc # Date 2017-07-08 22:42:11 # Node ID 4481f1fd27b11c8c95f1845ffe5349fe431eaca0 # Parent c6415195fa780a808ef655729fff008c6165a028 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)