hgext/narrow/narrowcommands.py
changeset 38835 a232e6744ba3
parent 38528 a1d5951efce7
child 39247 f4d4bd8c8911
--- a/hgext/narrow/narrowcommands.py	Fri Aug 03 12:35:23 2018 -0700
+++ b/hgext/narrow/narrowcommands.py	Fri Aug 03 11:02:34 2018 -0700
@@ -10,7 +10,6 @@
 
 from mercurial.i18n import _
 from mercurial import (
-    changegroup,
     cmdutil,
     commands,
     discovery,
@@ -24,6 +23,7 @@
     pycompat,
     registrar,
     repair,
+    repository,
     repoview,
     util,
 )
@@ -101,7 +101,7 @@
 
     def pullnarrow(orig, repo, *args, **kwargs):
         if opts_narrow:
-            repo.requirements.add(changegroup.NARROW_REQUIREMENT)
+            repo.requirements.add(repository.NARROW_REQUIREMENT)
             repo._writerequirements()
 
         return orig(repo, *args, **kwargs)
@@ -114,7 +114,7 @@
 def pullnarrowcmd(orig, ui, repo, *args, **opts):
     """Wraps pull command to allow modifying narrow spec."""
     wrappedextraprepare = util.nullcontextmanager()
-    if changegroup.NARROW_REQUIREMENT in repo.requirements:
+    if repository.NARROW_REQUIREMENT in repo.requirements:
 
         def pullbundle2extraprepare_widen(orig, pullop, kwargs):
             orig(pullop, kwargs)
@@ -128,7 +128,7 @@
 
 def archivenarrowcmd(orig, ui, repo, *args, **opts):
     """Wraps archive command to narrow the default includes."""
-    if changegroup.NARROW_REQUIREMENT in repo.requirements:
+    if repository.NARROW_REQUIREMENT in repo.requirements:
         repo_includes, repo_excludes = repo.narrowpats
         includes = set(opts.get(r'include', []))
         excludes = set(opts.get(r'exclude', []))
@@ -142,7 +142,7 @@
 
 def pullbundle2extraprepare(orig, pullop, kwargs):
     repo = pullop.repo
-    if changegroup.NARROW_REQUIREMENT not in repo.requirements:
+    if repository.NARROW_REQUIREMENT not in repo.requirements:
         return orig(pullop, kwargs)
 
     if narrowbundle2.NARROWCAP not in pullop.remotebundle2caps:
@@ -331,7 +331,7 @@
     empty and will not match any files.
     """
     opts = pycompat.byteskwargs(opts)
-    if changegroup.NARROW_REQUIREMENT not in repo.requirements:
+    if repository.NARROW_REQUIREMENT not in repo.requirements:
         ui.warn(_('The narrow command is only supported on respositories cloned'
                   ' with --narrow.\n'))
         return 1