Unbreak outgoing to non-git repos with hg pre-1.9

The wrapped version of findoutgoing unconditionally mangled the
keyword arguments, but doesn't do version fixups unless the
remote is a git repository. This change only mangles the argument
list when the remote is a git repository.
This commit is contained in:
Brendan Cully 2011-06-23 11:29:30 -07:00
parent 890facca02
commit d499a8fc67

View File

@ -129,13 +129,13 @@ try:
if getattr(discovery, 'findcommonoutgoing', None):
kwname = 'onlyheads'
def findoutgoing(orig, local, remote, *args, **kwargs):
if isinstance(remote, gitrepo.gitrepo):
# clean up this cruft when we're 1.7-only, remoteheads and
# the return value change happened between 1.6 and 1.7.
kw = {}
kw.update(kwargs)
for val, k in zip(args, ('base', kwname, 'force')):
kw[k] = val
if isinstance(remote, gitrepo.gitrepo):
# clean up this cruft when we're 1.7-only, remoteheads and
# the return value change happened between 1.6 and 1.7.
git = GitHandler(local, local.ui)
base, heads = git.get_refs(remote.path)
newkw = {'base': base, kwname: heads}
@ -147,6 +147,7 @@ try:
if kwname == 'onlyheads':
del kw['base']
return orig(local, remote, **kw)
return orig(local, remote, *args, **kwargs)
if getattr(discovery, 'findoutgoing', None):
extensions.wrapfunction(discovery, 'findoutgoing', findoutgoing)
else: