comparison mercurial/localrepo.py @ 14073:72c84f24b420

discovery: drop findoutgoing and simplify findcommonincoming's api This is a long desired cleanup and paves the way for new discovery. To specify subsets for bundling changes, all code should use the heads of the desired subset ("heads") and the heads of the common subset ("common") to be excluded from the bundled set. These can be used revlog.findmissing instead of revlog.nodesbetween. This fixes an actual bug exposed by the change in test-bundle-r.t where we try to bundle a changeset while specifying that said changeset is to be assumed already present in the target. This used to still bundle the changeset. It no longer does. This is similar to the bugs fixed by the recent switch to heads/common for incoming/pull.
author Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
date Sat, 30 Apr 2011 17:21:37 +0200
parents e4bfb9c337f3
children 924c82157d46
comparison
equal deleted inserted replaced
14072:2e4d79dcc0a0 14073:72c84f24b420
1325 return r 1325 return r
1326 1326
1327 def pull(self, remote, heads=None, force=False): 1327 def pull(self, remote, heads=None, force=False):
1328 lock = self.lock() 1328 lock = self.lock()
1329 try: 1329 try:
1330 usecommon = remote.capable('getbundle')
1331 tmp = discovery.findcommonincoming(self, remote, heads=heads, 1330 tmp = discovery.findcommonincoming(self, remote, heads=heads,
1332 force=force, commononly=usecommon) 1331 force=force)
1333 common, fetch, rheads = tmp 1332 common, fetch, rheads = tmp
1334 if not fetch: 1333 if not fetch:
1335 self.ui.status(_("no changes found\n")) 1334 self.ui.status(_("no changes found\n"))
1336 result = 0 1335 result = 0
1337 else: 1336 else:
1339 self.ui.status(_("requesting all changes\n")) 1338 self.ui.status(_("requesting all changes\n"))
1340 elif heads is None and remote.capable('changegroupsubset'): 1339 elif heads is None and remote.capable('changegroupsubset'):
1341 # issue1320, avoid a race if remote changed after discovery 1340 # issue1320, avoid a race if remote changed after discovery
1342 heads = rheads 1341 heads = rheads
1343 1342
1344 if usecommon: 1343 if remote.capable('getbundle'):
1345 cg = remote.getbundle('pull', common=common, 1344 cg = remote.getbundle('pull', common=common,
1346 heads=heads or rheads) 1345 heads=heads or rheads)
1347 elif heads is None: 1346 elif heads is None:
1348 cg = remote.changegroup(fetch, 'pull') 1347 cg = remote.changegroup(fetch, 'pull')
1349 elif not remote.capable('changegroupsubset'): 1348 elif not remote.capable('changegroupsubset'):
1473 else: 1472 else:
1474 common = [nullid] 1473 common = [nullid]
1475 if not heads: 1474 if not heads:
1476 heads = cl.heads() 1475 heads = cl.heads()
1477 common, missing = cl.findcommonmissing(common, heads) 1476 common, missing = cl.findcommonmissing(common, heads)
1477 if not missing:
1478 return None
1478 return self._changegroupsubset(common, missing, heads, source) 1479 return self._changegroupsubset(common, missing, heads, source)
1479 1480
1480 def _changegroupsubset(self, commonrevs, csets, heads, source): 1481 def _changegroupsubset(self, commonrevs, csets, heads, source):
1481 1482
1482 cl = self.changelog 1483 cl = self.changelog