Add localrepo.parents to get parent changectxs.
authorMatt Mackall <mpm@selenic.com>
Fri, 29 Sep 2006 15:48:16 -0500
changeset 3163 1605e336d229
parent 3162 a9e75b371315
child 3164 ff15ba23c1cf
Add localrepo.parents to get parent changectxs.
mercurial/localrepo.py
--- 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."""