comparison mercurial/bundlerepo.py @ 17191:5884812686f7

peer: introduce peer methods to prepare for peer classes This introduces a peer method into all repository classes, which currently simply returns self. It also changes hg.repository so it now raises an exception if the supplied paths does not resolve to a localrepo or descendant. Finally, all call sites are changed to use the peer and local methods as appropriate, where peer is used whenever the code is dealing with a remote repository (even if it's on local disk).
author Sune Foldager <cryo@cyanite.org>
date Fri, 13 Jul 2012 21:46:53 +0200
parents 67964cda8701
children 1d710fe5ee0e
comparison
equal deleted inserted replaced
17190:d99d0b559084 17191:5884812686f7
342 pass 342 pass
343 return other, [], other.close 343 return other, [], other.close
344 344
345 bundle = None 345 bundle = None
346 bundlerepo = None 346 bundlerepo = None
347 localrepo = other 347 localrepo = other.local()
348 if bundlename or not other.local(): 348 if bundlename or not localrepo:
349 # create a bundle (uncompressed if other repo is not local) 349 # create a bundle (uncompressed if other repo is not local)
350 350
351 if other.capable('getbundle'): 351 if other.capable('getbundle'):
352 cg = other.getbundle('incoming', common=common, heads=rheads) 352 cg = other.getbundle('incoming', common=common, heads=rheads)
353 elif onlyheads is None and not other.capable('changegroupsubset'): 353 elif onlyheads is None and not other.capable('changegroupsubset'):
354 # compat with older servers when pulling all remote heads 354 # compat with older servers when pulling all remote heads
355 cg = other.changegroup(incoming, "incoming") 355 cg = other.changegroup(incoming, "incoming")
356 rheads = None 356 rheads = None
357 else: 357 else:
358 cg = other.changegroupsubset(incoming, rheads, 'incoming') 358 cg = other.changegroupsubset(incoming, rheads, 'incoming')
359 bundletype = other.local() and "HG10BZ" or "HG10UN" 359 bundletype = localrepo and "HG10BZ" or "HG10UN"
360 fname = bundle = changegroup.writebundle(cg, bundlename, bundletype) 360 fname = bundle = changegroup.writebundle(cg, bundlename, bundletype)
361 # keep written bundle? 361 # keep written bundle?
362 if bundlename: 362 if bundlename:
363 bundle = None 363 bundle = None
364 if not other.local(): 364 if not localrepo:
365 # use the created uncompressed bundlerepo 365 # use the created uncompressed bundlerepo
366 localrepo = bundlerepo = bundlerepository(ui, repo.root, fname) 366 localrepo = bundlerepo = bundlerepository(ui, repo.root, fname)
367 # this repo contains local and other now, so filter out local again 367 # this repo contains local and other now, so filter out local again
368 common = repo.heads() 368 common = repo.heads()
369 369