D4829: narrow: avoid looking up dirstate again when editing dirstate
martinvonz (Martin von Zweigbergk)
phabricator at mercurial-scm.org
Mon Oct 1 22:48:01 UTC 2018
martinvonz created this revision.
Herald added a reviewer: durin42.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.
REVISION SUMMARY
The narrow extension overrides the dirstate editing functions to
restrict paths outside the narrowspec. These overrides access the
dirstate from repo.dirstate instead of using the "self" reference
passed to the overridden functions. I don't see a reason for this and
it caused me problems with a later patch (it caused infinite recursion
when I modified localrepo.dirstate()), so let's change it.
REPOSITORY
rHG Mercurial
REVISION DETAIL
https://phab.mercurial-scm.org/D4829
AFFECTED FILES
hgext/narrow/narrowdirstate.py
CHANGE DETAILS
diff --git a/hgext/narrow/narrowdirstate.py b/hgext/narrow/narrowdirstate.py
--- a/hgext/narrow/narrowdirstate.py
+++ b/hgext/narrow/narrowdirstate.py
@@ -18,10 +18,9 @@
def _editfunc(fn):
def _wrapper(self, *args):
- dirstate = repo.dirstate
narrowmatch = repo.narrowmatch()
for f in args:
- if f is not None and not narrowmatch(f) and f not in dirstate:
+ if f is not None and not narrowmatch(f) and f not in self:
raise error.Abort(_("cannot track '%s' - it is outside " +
"the narrow clone") % f)
return fn(self, *args)
To: martinvonz, durin42, #hg-reviewers
Cc: mercurial-devel
More information about the Mercurial-devel
mailing list