Mercurial > hg
diff mercurial/context.py @ 13468:d100702326d5 stable
context: generate file ancestors in reverse revision order (issue2642)
The related() function in copies assumes that revisions are generated
in reverse revision order, so it was getting confused in some situations.
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Wed, 23 Feb 2011 17:27:05 -0600 |
parents | 58c497d0e44d |
children | b85a09f368bd |
line wrap: on
line diff
--- a/mercurial/context.py Wed Feb 23 13:21:55 2011 +0500 +++ b/mercurial/context.py Wed Feb 23 17:27:05 2011 -0600 @@ -550,10 +550,14 @@ return None def ancestors(self): - seen = set(str(self)) + seen = set() visit = [self] while visit: - for parent in visit.pop(0).parents(): + parents = visit.pop(0).parents() + if len(parents) > 1 and parents[1].rev() > parents[0].rev(): + # make sure we return ancestors in reverse revision order + parents = reversed(parents) + for parent in parents: s = str(parent) if s not in seen: visit.append(parent)