Patchwork [23,of,36] context: move _fileinfo from changectx

login
register
mail settings
Submitter Sean Farley
Date Aug. 7, 2013, 6:13 p.m.
Message ID <c95070e5440cc77e7c9f.1375899203@laptop.local>
Download mbox | patch
Permalink /patch/2041/
State Superseded
Commit bece08dcd1648997fd2e50cd2880b6c0df2ca8b7
Delegated to: Augie Fackler
Headers show

Comments

Sean Farley - Aug. 7, 2013, 6:13 p.m.
# HG changeset patch
# User Sean Farley <sean.michael.farley@gmail.com>
# Date 1375745303 18000
#      Mon Aug 05 18:28:23 2013 -0500
# Node ID c95070e5440cc77e7c9faf021127bca29fe91125
# Parent  feabce8ec27a139cabc122ec27141b3170067759
context: move _fileinfo from changectx

Patch

diff --git a/mercurial/context.py b/mercurial/context.py
--- a/mercurial/context.py
+++ b/mercurial/context.py
@@ -90,10 +90,28 @@ 
     def p2(self):
         if len(self._parents) == 2:
             return self._parents[1]
         return changectx(self._repo, -1)
 
+    def _fileinfo(self, path):
+        if '_manifest' in self.__dict__:
+            try:
+                return self._manifest[path], self._manifest.flags(path)
+            except KeyError:
+                raise error.ManifestLookupError(self._node, path,
+                                                _('not found in manifest'))
+        if '_manifestdelta' in self.__dict__ or path in self.files():
+            if path in self._manifestdelta:
+                return (self._manifestdelta[path],
+                        self._manifestdelta.flags(path))
+        node, flag = self._repo.manifest.find(self._changeset[0], path)
+        if not node:
+            raise error.ManifestLookupError(self._node, path,
+                                            _('not found in manifest'))
+
+        return node, flag
+
 class changectx(context):
     """A changecontext object makes access to data related to a particular
     changeset convenient. It represents a read-only context already presnt in
     the repo."""
     def __init__(self, repo, changeid=''):
@@ -305,28 +323,10 @@ 
             troubles.append('bumped')
         if self.divergent():
             troubles.append('divergent')
         return troubles
 
-    def _fileinfo(self, path):
-        if '_manifest' in self.__dict__:
-            try:
-                return self._manifest[path], self._manifest.flags(path)
-            except KeyError:
-                raise error.ManifestLookupError(self._node, path,
-                                                _('not found in manifest'))
-        if '_manifestdelta' in self.__dict__ or path in self.files():
-            if path in self._manifestdelta:
-                return (self._manifestdelta[path],
-                        self._manifestdelta.flags(path))
-        node, flag = self._repo.manifest.find(self._changeset[0], path)
-        if not node:
-            raise error.ManifestLookupError(self._node, path,
-                                            _('not found in manifest'))
-
-        return node, flag
-
     def filenode(self, path):
         return self._fileinfo(path)[0]
 
     def flags(self, path):
         try: