Show More
@@ -55,6 +55,12 b' class changectx(object):' | |||
|
55 | 55 | md = self._repo.manifest.readdelta(self._changeset[0]) |
|
56 | 56 | self._manifestdelta = md |
|
57 | 57 | return self._manifestdelta |
|
58 | elif name == '_parents': | |
|
59 | p = self._repo.changelog.parents(self._node) | |
|
60 | if p[1] == nullid: | |
|
61 | p = p[:-1] | |
|
62 | self._parents = [changectx(self._repo, x) for x in p] | |
|
63 | return self._parents | |
|
58 | 64 | else: |
|
59 | 65 | raise AttributeError, name |
|
60 | 66 | |
@@ -85,8 +91,7 b' class changectx(object):' | |||
|
85 | 91 | |
|
86 | 92 | def parents(self): |
|
87 | 93 | """return contexts for each parent changeset""" |
|
88 | p = self._repo.changelog.parents(self._node) | |
|
89 | return [changectx(self._repo, x) for x in p] | |
|
94 | return self._parents | |
|
90 | 95 | |
|
91 | 96 | def children(self): |
|
92 | 97 | """return contexts for each child changeset""" |
@@ -484,15 +489,18 b' class workingctx(changectx):' | |||
|
484 | 489 | return True |
|
485 | 490 | |
|
486 | 491 | def __getattr__(self, name): |
|
487 | if name == '_parents': | |
|
488 | self._parents = self._repo.parents() | |
|
489 | return self._parents | |
|
490 | 492 | if name == '_status': |
|
491 | 493 | self._status = self._repo.status() |
|
492 | 494 | return self._status |
|
493 | 495 | if name == '_manifest': |
|
494 | 496 | self._buildmanifest() |
|
495 | 497 | return self._manifest |
|
498 | elif name == '_parents': | |
|
499 | p = self._repo.dirstate.parents() | |
|
500 | if p[1] == nullid: | |
|
501 | p = p[:-1] | |
|
502 | self._parents = [changectx(self._repo, x) for x in p] | |
|
503 | return self._parents | |
|
496 | 504 | else: |
|
497 | 505 | raise AttributeError, name |
|
498 | 506 | |
@@ -544,10 +552,6 b' class workingctx(changectx):' | |||
|
544 | 552 | [t.extend(p.tags()) for p in self.parents()] |
|
545 | 553 | return t |
|
546 | 554 | |
|
547 | def parents(self): | |
|
548 | """return contexts for each parent changeset""" | |
|
549 | return self._parents | |
|
550 | ||
|
551 | 555 | def children(self): |
|
552 | 556 | return [] |
|
553 | 557 |
@@ -489,17 +489,8 b' class localrepository(repo.repository):' | |||
|
489 | 489 | return context.changectx(self, changeid) |
|
490 | 490 | |
|
491 | 491 | def parents(self, changeid=None): |
|
492 | ''' | |
|
493 | get list of changectxs for parents of changeid or working directory | |
|
494 | ''' | |
|
495 | if changeid is None: | |
|
496 | pl = self.dirstate.parents() | |
|
497 | else: | |
|
498 | n = self.changelog.lookup(changeid) | |
|
499 | pl = self.changelog.parents(n) | |
|
500 | if pl[1] == nullid: | |
|
501 | return [self.changectx(pl[0])] | |
|
502 | return [self.changectx(pl[0]), self.changectx(pl[1])] | |
|
492 | '''get list of changectxs for parents of changeid''' | |
|
493 | return self.changectx(changeid).parents() | |
|
503 | 494 | |
|
504 | 495 | def filectx(self, path, changeid=None, fileid=None): |
|
505 | 496 | """changeid can be a changeset revision, node, or tag. |
General Comments 0
You need to be logged in to leave comments.
Login now