# HG changeset patch # User Bryan O'Sullivan # Date 1342738854 25200 # Node ID d6c47c33f6a200d4feedfa31760e629ffc471c8a # Parent a103d52112377b0cb7ba3cac62eec860042fa7f7 fix breakage introduced by peer classes in hg 2.3 diff --git a/hgsubversion/svnrepo.py b/hgsubversion/svnrepo.py --- a/hgsubversion/svnrepo.py +++ b/hgsubversion/svnrepo.py @@ -132,6 +132,9 @@ class svnremoterepo(peerrepository): 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 diff --git a/hgsubversion/wrappers.py b/hgsubversion/wrappers.py --- a/hgsubversion/wrappers.py +++ b/hgsubversion/wrappers.py @@ -65,13 +65,26 @@ def parents(orig, ui, repo, *args, **opt 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 @@ -235,7 +248,8 @@ def push(repo, dest, force, revs): 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() @@ -486,7 +500,7 @@ def clone(orig, ui, source, dest=None, * 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 @@ -518,7 +532,8 @@ def clone(orig, ui, source, dest=None, * 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]: