context: simplify changeid logic
authorMatt Mackall <mpm@selenic.com>
Thu, 26 Jun 2008 13:46:31 -0500
changeset 6741 5918e2b79859
parent 6740 b148e9099133
child 6742 2d54e7c1e69d
context: simplify changeid logic
mercurial/context.py
--- 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)