Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/context.py @ 13877:653121e6941f
filectx: introduce p1/p2 convenience methods
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Mon, 04 Apr 2011 16:21:57 -0500 |
parents | 7ab85fec60c3 |
children | 8b252e826c68 |
comparison
equal
deleted
inserted
replaced
13876:10c7d92ac482 | 13877:653121e6941f |
---|---|
399 if r: | 399 if r: |
400 pl[0] = (r[0], r[1], None) | 400 pl[0] = (r[0], r[1], None) |
401 | 401 |
402 return [filectx(self._repo, p, fileid=n, filelog=l) | 402 return [filectx(self._repo, p, fileid=n, filelog=l) |
403 for p, n, l in pl if n != nullid] | 403 for p, n, l in pl if n != nullid] |
404 | |
405 def p1(self): | |
406 return self.parents()[0] | |
407 | |
408 def p2(self): | |
409 p = self.parents() | |
410 if len(p) == 2: | |
411 return p[1] | |
412 return filectx(self._repo, self._path, fileid=-1, filelog=self._filelog) | |
404 | 413 |
405 def children(self): | 414 def children(self): |
406 # hard for renames | 415 # hard for renames |
407 c = self._filelog.children(self._filenode) | 416 c = self._filelog.children(self._filenode) |
408 return [filectx(self._repo, self._path, fileid=x, | 417 return [filectx(self._repo, self._path, fileid=x, |