comparison mercurial/localrepo.py @ 6742:2d54e7c1e69d

context: clean up parents()
author Matt Mackall <mpm@selenic.com>
date Thu, 26 Jun 2008 13:46:33 -0500
parents b148e9099133
children 86e8187b721a
comparison
equal deleted inserted replaced
6741:5918e2b79859 6742:2d54e7c1e69d
487 if changeid == None: 487 if changeid == None:
488 return context.workingctx(self) 488 return context.workingctx(self)
489 return context.changectx(self, changeid) 489 return context.changectx(self, changeid)
490 490
491 def parents(self, changeid=None): 491 def parents(self, changeid=None):
492 ''' 492 '''get list of changectxs for parents of changeid'''
493 get list of changectxs for parents of changeid or working directory 493 return self.changectx(changeid).parents()
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])]
503 494
504 def filectx(self, path, changeid=None, fileid=None): 495 def filectx(self, path, changeid=None, fileid=None):
505 """changeid can be a changeset revision, node, or tag. 496 """changeid can be a changeset revision, node, or tag.
506 fileid can be a file revision or node.""" 497 fileid can be a file revision or node."""
507 return context.filectx(self, path, changeid, fileid) 498 return context.filectx(self, path, changeid, fileid)