mercurial/revset.py
changeset 38624 5460926352ee
parent 38588 1c93e0237a24
child 38625 52f19a840543
equal deleted inserted replaced
38623:92c845c097aa 38624:5460926352ee
   606     # i18n: "closed" is a keyword
   606     # i18n: "closed" is a keyword
   607     getargs(x, 0, 0, _("closed takes no arguments"))
   607     getargs(x, 0, 0, _("closed takes no arguments"))
   608     return subset.filter(lambda r: repo[r].closesbranch(),
   608     return subset.filter(lambda r: repo[r].closesbranch(),
   609                          condrepr='<branch closed>')
   609                          condrepr='<branch closed>')
   610 
   610 
       
   611 @predicate('commonancestors(set)', safe=True)
       
   612 def commonancestors(repo, subset, x):
       
   613     """Returns all common ancestors of the set.
       
   614 
       
   615     This method is for calculating "::x and ::y" (i.e. all the ancestors that
       
   616     are common to both x and y) in an easy and optimized way. We can't quite
       
   617     use "::head()" because that revset returns "::x + ::y + ..." for each head
       
   618     in the repo (whereas we want "::x *and* ::y").
       
   619 
       
   620     """
       
   621     # only wants the heads of the set passed in
       
   622     for r in heads(repo, fullreposet(repo), x, defineorder):
       
   623         subset &= dagop.revancestors(repo, baseset([r]))
       
   624 
       
   625     return subset
       
   626 
   611 @predicate('contains(pattern)', weight=100)
   627 @predicate('contains(pattern)', weight=100)
   612 def contains(repo, subset, x):
   628 def contains(repo, subset, x):
   613     """The revision's manifest contains a file matching pattern (but might not
   629     """The revision's manifest contains a file matching pattern (but might not
   614     modify it). See :hg:`help patterns` for information about file patterns.
   630     modify it). See :hg:`help patterns` for information about file patterns.
   615 
   631