[PATCH 3 of 8] filectx: refactor filectx.rev() to use filectx._changeid

Durham Goode durham at fb.com
Fri May 31 12:19:45 CDT 2013


# HG changeset patch
# User Durham Goode <durham at fb.com>
# Date 1369961377 25200
#      Thu May 30 17:49:37 2013 -0700
# Node ID 66c552d6910908070552d1a1c41d729932b8b111
# Parent  3f547fa7afcace32827789deb6865b789970f158
filectx: refactor filectx.rev() to use filectx._changeid

The code in filectx.rev() was identical to filectx._changeid. Fixing this
allows alternative filectx implementations to only override _changeid.

diff --git a/mercurial/context.py b/mercurial/context.py
--- a/mercurial/context.py
+++ b/mercurial/context.py
@@ -503,14 +503,8 @@
         return self._changectx.flags(self._path)
     def filelog(self):
         return self._filelog
-
     def rev(self):
-        if '_changectx' in self.__dict__:
-            return self._changectx.rev()
-        if '_changeid' in self.__dict__:
-            return self._changectx.rev()
-        return self._filelog.linkrev(self._filerev)
-
+        return self._changeid
     def linkrev(self):
         return self._filelog.linkrev(self._filerev)
     def node(self):


More information about the Mercurial-devel mailing list