Mercurial > hg
diff hgext/narrow/narrowrepo.py @ 38835:a232e6744ba3
narrow: move requirement constant from changegroup to repository
As suggested by Gregory Szorc.
Differential Revision: https://phab.mercurial-scm.org/D4094
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Fri, 03 Aug 2018 11:02:34 -0700 |
parents | e411774a2e0f |
children | 576eef1ab43d |
line wrap: on
line diff
--- a/hgext/narrow/narrowrepo.py Fri Aug 03 12:35:23 2018 -0700 +++ b/hgext/narrow/narrowrepo.py Fri Aug 03 11:02:34 2018 -0700 @@ -8,9 +8,9 @@ from __future__ import absolute_import from mercurial import ( - changegroup, hg, narrowspec, + repository, ) from . import ( @@ -20,13 +20,13 @@ def wrappostshare(orig, sourcerepo, destrepo, **kwargs): orig(sourcerepo, destrepo, **kwargs) - if changegroup.NARROW_REQUIREMENT in sourcerepo.requirements: + if repository.NARROW_REQUIREMENT in sourcerepo.requirements: with destrepo.wlock(): with destrepo.vfs('shared', 'a') as fp: fp.write(narrowspec.FILENAME + '\n') def unsharenarrowspec(orig, ui, repo, repopath): - if (changegroup.NARROW_REQUIREMENT in repo.requirements + if (repository.NARROW_REQUIREMENT in repo.requirements and repo.path == repopath and repo.shared()): srcrepo = hg.sharedreposource(repo) with srcrepo.vfs(narrowspec.FILENAME) as f: