Bryan O'Sullivan avatar Bryan O'Sullivan committed d6c47c3

fix breakage introduced by peer classes in hg 2.3

Comments (0)

Files changed (2)

hgsubversion/svnrepo.py

         else:
             self.password_stores = None
 
+    def _capabilities(self):
+        return self.capabilities
+
     @propertycache
     def svnauth(self):
         # DO NOT default the user to hg's getuser(). If you provide

hgsubversion/wrappers.py

     return 0
 
 
+def getpeer(ui, opts, source):
+    # Since 2.3 (1ac628cd7113)
+    peer = getattr(hg, 'peer', None)
+    if peer:
+        return peer(ui, opts, source)
+    return hg.repository(ui, source)
+
+
+def getcaps(other):
+    return (getattr(other, 'caps', None) or
+            getattr(other, 'capabilities', None) or set())
+
+
 def incoming(orig, ui, repo, origsource='default', **opts):
     """show incoming revisions from Subversion
     """
 
     source, revs, checkout = util.parseurl(ui.expandpath(origsource))
-    other = hg.repository(ui, source)
-    if 'subversion' not in other.capabilities:
+    other = getpeer(ui, opts, source)
+    if 'subversion' not in getcaps(other):
         return orig(ui, repo, origsource, **opts)
 
     svn = other.svn
                    svnsourcerev=needs_transplant)
             # Reload the repo after the rebase. Do not reuse contexts across this.
             newtip = newtipctx.node()
-            repo = hg.repository(ui, meta.path)
+            repo = getpeer(ui, {}, meta.path)
+            repo = getattr(repo, 'local', lambda: repo)()
             newtipctx = repo[newtip]
             # Rewrite the node ids in outgoing to their rebased versions.
             rebasemap = dict()
         if isinstance(origsource, str):
             source, branch, checkout = util.parseurl(ui.expandpath(origsource),
                                          opts.get('branch'))
-            srcrepo = hg.repository(ui, source)
+            srcrepo = getpeer(ui, opts, source)
         else:
             srcrepo = origsource
 
     srcrepo = data.get('srcrepo')
 
     if dstrepo.local() and srcrepo.capable('subversion'):
-        fd = dstrepo.opener("hgrc", "a", text=True)
+        dst = dstrepo.local()
+        fd = dst.opener("hgrc", "a", text=True)
         for section in set(s for s, v in optionmap.itervalues()):
             config = dict(ui.configitems(section))
             for name in dontretain[section]:
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.