Details
Details
- Reviewers
indygreg - Group Reviewers
hg-reviewers - Commits
- rHG9dc28d8ea61e: narrow: remove support for old match modules
Diff Detail
Diff Detail
- Repository
- rHG Mercurial
- Lint
Lint Skipped - Unit
Unit Tests Skipped
( )
indygreg |
hg-reviewers |
Lint Skipped |
Unit Tests Skipped |
Path | Packages | |||
---|---|---|---|---|
M | hgext/narrow/__init__.py (15 lines) |
Status | Author | Revision | |
---|---|---|---|
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 |
except ImportError: | except ImportError: | ||||
pass | pass | ||||
from mercurial import ( | from mercurial import ( | ||||
extensions, | extensions, | ||||
hg, | hg, | ||||
localrepo, | localrepo, | ||||
registrar, | registrar, | ||||
util, | |||||
verify as verifymod, | verify as verifymod, | ||||
) | ) | ||||
from . import ( | from . import ( | ||||
narrowbundle2, | narrowbundle2, | ||||
narrowchangegroup, | narrowchangegroup, | ||||
narrowcommands, | narrowcommands, | ||||
narrowcopies, | narrowcopies, | ||||
if narrowrepo.requirement in repo.requirements: | if narrowrepo.requirement in repo.requirements: | ||||
narrowrepo.wraprepo(repo, True) | narrowrepo.wraprepo(repo, True) | ||||
narrowcopies.setup(repo) | narrowcopies.setup(repo) | ||||
narrowdirstate.setup(repo) | narrowdirstate.setup(repo) | ||||
narrowpatch.setup(repo) | narrowpatch.setup(repo) | ||||
narrowwirepeer.reposetup(repo) | narrowwirepeer.reposetup(repo) | ||||
def _narrowvalidpath(orig, repo, path): | |||||
matcher = getattr(repo, 'narrowmatch', None) | |||||
if matcher is None: | |||||
return orig(repo, path) | |||||
matcher = matcher() | |||||
if matcher.visitdir(path) or matcher(path): | |||||
return orig(repo, path) | |||||
return False | |||||
def _verifierinit(orig, self, repo, matcher=None): | def _verifierinit(orig, self, repo, matcher=None): | ||||
# The verifier's matcher argument was desgined for narrowhg, so it should | # The verifier's matcher argument was desgined for narrowhg, so it should | ||||
# be None from core. If another extension passes a matcher (unlikely), | # be None from core. If another extension passes a matcher (unlikely), | ||||
# we'll have to fail until matchers can be composed more easily. | # we'll have to fail until matchers can be composed more easily. | ||||
assert matcher is None | assert matcher is None | ||||
matcher = getattr(repo, 'narrowmatch', lambda: None)() | matcher = getattr(repo, 'narrowmatch', lambda: None)() | ||||
orig(self, repo, matcher) | orig(self, repo, matcher) | ||||
def extsetup(ui): | def extsetup(ui): | ||||
if util.safehasattr(verifymod, '_validpath'): | |||||
extensions.wrapfunction(verifymod, '_validpath', _narrowvalidpath) | |||||
else: | |||||
extensions.wrapfunction(verifymod.verifier, '__init__', _verifierinit) | extensions.wrapfunction(verifymod.verifier, '__init__', _verifierinit) | ||||
extensions.wrapfunction(hg, 'postshare', narrowrepo.wrappostshare) | extensions.wrapfunction(hg, 'postshare', narrowrepo.wrappostshare) | ||||
extensions.wrapfunction(hg, 'copystore', narrowrepo.unsharenarrowspec) | extensions.wrapfunction(hg, 'copystore', narrowrepo.unsharenarrowspec) |