Changeset eb3f0219a412…
Parent 4a84d4eacaf7…
by Kevin Gessner <kevin@fogcreek.com>
Changes to 2 files · Browse files at eb3f0219a412 Showing diff from parent 4a84d4eacaf7 Diff from another changeset...
@@ -69,7 +69,11 @@ return push_fn(ui, repo, dest, **opts)
source, revs = parseurl(ui.expandpath(dest or 'default-push', dest or 'default'))
- other = hg.repository(remoteui(repo, opts), source)
+ try:
+ other = hg.repository(remoteui(repo, opts), source)
+ except:
+ # hg 2.3+
+ other = hg.peer(repo, opts, source)
if hasattr(hg, 'addbranchrevs'):
revs = hg.addbranchrevs(repo, other, revs, opts.get('rev'))[0]
if revs:
|
@@ -463,25 +463,25 @@ ntarget = [normalize_name(t) for t in target[1:4]]
aliases = [normalize_name(s) for s in target[4]]
- if ndest.count('/') == 0 and \
- (ntarget[0] == ndest or \
- ntarget[1] == ndest or \
- ntarget[2] == ndest or \
- ndest in aliases):
+ if (ndest.count('/') == 0 and
+ (ntarget[0] == ndest or
+ ntarget[1] == ndest or
+ ntarget[2] == ndest or
+ ndest in aliases)):
matches.append(url)
- elif ndest.count('/') == 1 and \
- '/'.join(ntarget[0:2]) == ndest or \
- '/'.join(ntarget[1:3]) == ndest:
+ elif (ndest.count('/') == 1 and
+ '/'.join(ntarget[0:2]) == ndest or
+ '/'.join(ntarget[1:3]) == ndest):
matches.append(url)
- elif ndest.count('/') == 2 and \
- '/'.join(ntarget[0:3]) == ndest:
+ elif (ndest.count('/') == 2 and
+ '/'.join(ntarget[0:3]) == ndest):
matches.append(url)
- if (ntarget[0].startswith(ndest) or \
- ntarget[1].startswith(ndest) or \
- ntarget[2].startswith(ndest) or \
- '/'.join(ntarget[0:2]).startswith(ndest) or \
- '/'.join(ntarget[1:3]).startswith(ndest) or \
+ if (ntarget[0].startswith(ndest) or
+ ntarget[1].startswith(ndest) or
+ ntarget[2].startswith(ndest) or
+ '/'.join(ntarget[0:2]).startswith(ndest) or
+ '/'.join(ntarget[1:3]).startswith(ndest) or
'/'.join(ntarget[0:3]).startswith(ndest)):
prefixmatches.append(url)
@@ -514,6 +514,12 @@ return tails
def get_targets(repo):
+ def get_kiln_repo_url_prefix(default_prefix):
+ '''Checks repo paths and returns server url for ssh:. For http(s) falls back to default_prefix.'''
+ default_path = repo.ui.config('paths', 'default')
+ if default_path and default_path.startswith('ssh:'):
+ return default_path.rsplit('/', 3)[0]
+ return default_prefix
targets = []
kilnschemes = repo.ui.configitems('kiln_scheme')
for scheme in kilnschemes:
@@ -526,7 +532,7 @@ # We have an token at this point
params = dict(revTails=tails, token=token)
related_repos = call_api(repo.ui, baseurl, 'Api/1.0/Repo/Related', params)
- targets.extend([[url,
+ targets.extend([[get_kiln_repo_url_prefix(url),
related_repo['sProjectSlug'],
related_repo['sGroupSlug'],
related_repo['sSlug'],
@@ -900,7 +906,7 @@ try:
from mercurial.httprepo import httprepository
httprepo = httprepository
- except ImportError:
+ except (ImportError, AttributeError):
from mercurial.httppeer import httppeer
httprepo = httppeer
if issubclass(repo.__class__, httprepo):
|
Loading...