Kiln » Kiln Extensions
Clone URL:  
Pushed to 2 repositories · View In Graph Contained in tip

Better Mercurial 2.3 support for the big-push and kiln extensions.

Changeset eb3f0219a412

Parent 4a84d4eacaf7

by Profile picture of User 276Kevin Gessner <kevin@fogcreek.com>

Changes to 2 files · Browse files at eb3f0219a412 Showing diff from parent 4a84d4eacaf7 Diff from another changeset...

Change 1 of 1 Show Entire File big-push.py Stacked
 
69
70
71
72
 
 
 
 
 
73
74
75
 
69
70
71
 
72
73
74
75
76
77
78
79
@@ -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:
Change 1 of 4 Show Entire File kiln.py Stacked
 
463
464
465
466
467
468
469
470
 
 
 
 
 
471
472
473
474
 
 
 
475
476
477
 
 
478
479
480
481
482
483
484
 
 
 
 
 
485
486
487
 
514
515
516
 
 
 
 
 
 
517
518
519
 
526
527
528
529
 
530
531
532
 
900
901
902
903
 
904
905
906
 
463
464
465
 
 
 
 
 
466
467
468
469
470
471
 
 
 
472
473
474
475
 
 
476
477
478
479
 
 
 
 
 
480
481
482
483
484
485
486
487
 
514
515
516
517
518
519
520
521
522
523
524
525
 
532
533
534
 
535
536
537
538
 
906
907
908
 
909
910
911
912
@@ -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):