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

login
register
mail settings
Submitter Durham Goode
Date May 31, 2013, 5:19 p.m.
Message ID <66c552d6910908070552.1370020785@dev350.prn1.facebook.com>
Download mbox | patch
Permalink /patch/1686/
State Accepted
Commit ec367f203cb5a0427b89f76c8da37e4d2062b614
Headers show

Comments

Durham Goode - May 31, 2013, 5:19 p.m.
# HG changeset patch
# User Durham Goode <durham@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.
Matt Mackall - June 3, 2013, 8:21 p.m.
On Fri, 2013-05-31 at 10:19 -0700, Durham Goode wrote:
> # HG changeset patch
> # User Durham Goode <durham@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

Queued for default, thanks.

Patch

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):