Mercurial > hg
comparison 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 |
comparison
equal
deleted
inserted
replaced
13467:31aa2e5b0750 | 13468:d100702326d5 |
---|---|
548 return filectx(self._repo, f, fileid=n, filelog=flcache[f]) | 548 return filectx(self._repo, f, fileid=n, filelog=flcache[f]) |
549 | 549 |
550 return None | 550 return None |
551 | 551 |
552 def ancestors(self): | 552 def ancestors(self): |
553 seen = set(str(self)) | 553 seen = set() |
554 visit = [self] | 554 visit = [self] |
555 while visit: | 555 while visit: |
556 for parent in visit.pop(0).parents(): | 556 parents = visit.pop(0).parents() |
557 if len(parents) > 1 and parents[1].rev() > parents[0].rev(): | |
558 # make sure we return ancestors in reverse revision order | |
559 parents = reversed(parents) | |
560 for parent in parents: | |
557 s = str(parent) | 561 s = str(parent) |
558 if s not in seen: | 562 if s not in seen: |
559 visit.append(parent) | 563 visit.append(parent) |
560 seen.add(s) | 564 seen.add(s) |
561 yield parent | 565 yield parent |