Add localrepo.parents to get parent changectxs.
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -321,6 +321,17 @@ class localrepository(repo.repository):
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."""