branch | stable |
changeset 10262 | eb243551cbd8 |
parent 9843 | d1043c2ffe6c |
child 10263 | 25e572394f5c |
--- a/mercurial/context.py Mon Dec 28 12:14:26 2009 +0900 +++ b/mercurial/context.py Tue Jan 19 22:20:05 2010 -0600 @@ -495,6 +495,17 @@ return None + def ancestors(self): + seen = set(str(self)) + visit = [self] + while visit: + for parent in visit.pop(0).parents(): + s = str(parent) + if s not in seen: + visit.append(parent) + seen.add(s) + yield parent + class workingctx(changectx): """A workingctx object makes access to data related to the current working directory convenient.