comparison mercurial/revlog.py @ 13741:b51bf961b3cb

wireproto: add getbundle() function getbundle(common, heads) -> bundle Returns the changegroup for all ancestors of heads which are not ancestors of common. For both sets, the heads are included in the set. Intended to eventually supercede changegroupsubset and changegroup. Uses heads of common region to exclude unwanted changesets instead of bases of desired region, which is more useful and easier to implement. Designed to be extensible with new optional arguments (which will have to be guarded by corresponding capabilities).
author Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
date Wed, 23 Mar 2011 16:02:11 +0100
parents 14f3795a5ed7
children 10aea25fb519
comparison
equal deleted inserted replaced
13740:dcb51f156fa6 13741:b51bf961b3cb
397 if x != nullrev and x in seen: 397 if x != nullrev and x in seen:
398 seen.add(i) 398 seen.add(i)
399 yield i 399 yield i
400 break 400 break
401 401
402 def findmissing(self, common=None, heads=None): 402 def findcommonmissing(self, common=None, heads=None):
403 """Return the ancestors of heads that are not ancestors of common. 403 """Return a tuple of the ancestors of common and the ancestors of heads
404 404 that are not ancestors of common.
405 More specifically, return a list of nodes N such that every N 405
406 satisfies the following constraints: 406 More specifically, the second element is a list of nodes N such that
407 every N satisfies the following constraints:
407 408
408 1. N is an ancestor of some node in 'heads' 409 1. N is an ancestor of some node in 'heads'
409 2. N is not an ancestor of any node in 'common' 410 2. N is not an ancestor of any node in 'common'
410 411
411 The list is sorted by revision number, meaning it is 412 The list is sorted by revision number, meaning it is
439 for p in self.parentrevs(r): 440 for p in self.parentrevs(r):
440 if p not in has: 441 if p not in has:
441 visit.append(p) 442 visit.append(p)
442 missing = list(missing) 443 missing = list(missing)
443 missing.sort() 444 missing.sort()
444 return [self.node(r) for r in missing] 445 return has, [self.node(r) for r in missing]
446
447 def findmissing(self, common=None, heads=None):
448 """Return the ancestors of heads that are not ancestors of common.
449
450 More specifically, return a list of nodes N such that every N
451 satisfies the following constraints:
452
453 1. N is an ancestor of some node in 'heads'
454 2. N is not an ancestor of any node in 'common'
455
456 The list is sorted by revision number, meaning it is
457 topologically sorted.
458
459 'heads' and 'common' are both lists of node IDs. If heads is
460 not supplied, uses all of the revlog's heads. If common is not
461 supplied, uses nullid."""
462 _common, missing = self.findcommonmissing(common, heads)
463 return missing
445 464
446 def nodesbetween(self, roots=None, heads=None): 465 def nodesbetween(self, roots=None, heads=None):
447 """Return a topological path from 'roots' to 'heads'. 466 """Return a topological path from 'roots' to 'heads'.
448 467
449 Return a tuple (nodes, outroots, outheads) where 'nodes' is a 468 Return a tuple (nodes, outroots, outheads) where 'nodes' is a