changeset 3163:1605e336d229

Add localrepo.parents to get parent changectxs.
author Matt Mackall <mpm@selenic.com>
date Fri, 29 Sep 2006 15:48:16 -0500
parents a9e75b371315
children ff15ba23c1cf
files mercurial/localrepo.py
diffstat 1 files changed, 11 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/localrepo.py	Tue Sep 26 16:21:52 2006 -0500
+++ b/mercurial/localrepo.py	Fri Sep 29 15:48:16 2006 -0500
@@ -321,6 +321,17 @@
     def changectx(self, changeid=None):
         return context.changectx(self, changeid)
 
+    def parents(self, changeid=None):
+        '''
+        get list of changectxs for parents of changeid or working directory
+        '''
+        if changeid is None:
+            pl = self.dirstate.parents()
+        else:
+            n = self.changelog.lookup(changeid)
+            pl = self.changelog.parents(n)
+        return [self.changectx(n) for n in pl if n != nullid]
+
     def filectx(self, path, changeid=None, fileid=None):
         """changeid can be a changeset revision, node, or tag.
            fileid can be a file revision or node."""