Mercurial > hg-stable
changeset 6741:5918e2b79859
context: simplify changeid logic
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Thu, 26 Jun 2008 13:46:31 -0500 |
parents | b148e9099133 |
children | 2d54e7c1e69d |
files | mercurial/context.py |
diffstat | 1 files changed, 3 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/context.py Thu Jun 26 13:46:29 2008 -0500 +++ b/mercurial/context.py Thu Jun 26 13:46:31 2008 -0500 @@ -12,16 +12,11 @@ class changectx(object): """A changecontext object makes access to data related to a particular changeset convenient.""" - def __init__(self, repo, changeid=None): + def __init__(self, repo, changeid=''): """changeid is a revision number, node, or tag""" + if changeid == '': + changeid = '.' self._repo = repo - - if not changeid and changeid != 0: - p1, p2 = self._repo.dirstate.parents() - self._rev = self._repo.changelog.rev(p1) - self._node = p1 - return - self._node = self._repo.lookup(changeid) self._rev = self._repo.changelog.rev(self._node)