context: handle fileid or changeid == 0
authorBrendan Cully <brendan@kublai.com>
Fri, 22 Sep 2006 08:19:25 -0700
changeset 3143 db25f7b80fdb
parent 3142 aabc5ef7d159
child 3144 8342ad5abe0b
context: handle fileid or changeid == 0
mercurial/context.py
--- a/mercurial/context.py	Fri Sep 22 08:48:56 2006 +0200
+++ b/mercurial/context.py	Fri Sep 22 08:19:25 2006 -0700
@@ -16,7 +16,7 @@
         """changeid is a revision number, node, or tag"""
         self._repo = repo
 
-        if not changeid:
+        if not changeid and changeid != 0:
             p1, p2 = self._repo.dirstate.parents()
             self._rev = self._repo.changelog.rev(p1)
             if self._rev == -1:
@@ -94,14 +94,14 @@
         self._repo = repo
         self._path = path
 
-        assert changeid or fileid
+        assert changeid is not None or fileid is not None
 
         if filelog:
             self._filelog = filelog
         else:
             self._filelog = self._repo.file(self._path)
 
-        if not fileid:
+        if fileid is None:
             # if given a changeset id, go ahead and look up the file
             self._changeid = changeid
             self._changectx = self.changectx()