[PATCH 0 of 2] symlink merge fixes

Patrick Mézard pmezard at gmail.com
Wed Oct 3 15:16:01 CDT 2007


Alexis S. L. Carvalho a écrit :
> 
> Your first patch looks fine, but we'll probably want to add some kind of
> fileflags method (analogous to filenode) to changectx to avoid
> rebuilding all the manifests.

What do you think of:

# HG changeset patch
# User Patrick Mezard <pmezard at gmail.com>
# Date 1191441240 -7200
# Node ID e0683562efdad174ee9a305aa3af25673e4f8236
# Parent  ac2ccdcf4539bc7274f456a83f75e58c77251df5
context: add fileflags() to avoid rebuilding manifests

diff --git a/mercurial/context.py b/mercurial/context.py
--- a/mercurial/context.py
+++ b/mercurial/context.py
@@ -94,20 +94,29 @@ class changectx(object):
          c = self._repo.changelog.children(self._node)
          return [changectx(self._repo, x) for x in c]

-    def filenode(self, path):
+    def _fileinfo(self, path):
          if '_manifest' in self.__dict__:
              try:
-                return self._manifest[path]
+                return self._manifest[path], self._manifest.flags(path)
              except KeyError:
                  raise revlog.LookupError(_("'%s' not found in 
manifest") % path)
          if '_manifestdelta' in self.__dict__ or path in self.files():
              if path in self._manifestdelta:
-                return self._manifestdelta[path]
+                return self._manifestdelta[path], 
self._manifestdelta.flags(path)
          node, flag = self._repo.manifest.find(self._changeset[0], path)
          if not node:
              raise revlog.LookupError(_("'%s' not found in manifest") % 
path)

-        return node
+        return node, flag
+
+    def filenode(self, path):
+        return self._fileinfo(path)[0]
+
+    def fileflags(self, path):
+        try:
+            return self._fileinfo(path)[1]
+        except revlog.LookupError:
+            return ''

      def filectx(self, path, fileid=None, filelog=None):
          """get a file context from this changeset"""
@@ -211,6 +220,7 @@ class filectx(object):

      def filerev(self): return self._filerev
      def filenode(self): return self._filenode
+    def fileflags(self): return self._changectx.fileflags(self._path)
      def filelog(self): return self._filelog

      def rev(self):


More information about the Mercurial-devel mailing list