changeset 954:ef155e3ead8f

evolve: abstract access to context.memfilectx This class is getting altered in the future Mercurial 3.1.0. This changeset prepare a compatibility layer.
author Pierre-Yves David <pierre-yves.david@fb.com>
date Tue, 03 Jun 2014 01:22:31 -0700
parents a02e5916a7e3
children 72670e282460
files hgext/evolve.py
diffstat 1 files changed, 13 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/evolve.py	Mon Jun 02 14:18:29 2014 -0700
+++ b/hgext/evolve.py	Tue Jun 03 01:22:31 2014 -0700
@@ -73,6 +73,7 @@
 
 _pack = struct.pack
 
+memfilectx = context.memfilectx
 
 # This extension contains the following code
 #
@@ -755,10 +756,10 @@
             if path in headmf:
                 fctx = head[path]
                 flags = fctx.flags()
-                mctx = context.memfilectx(fctx.path(), fctx.data(),
-                                          islink='l' in flags,
-                                          isexec='x' in flags,
-                                          copied=copied.get(path))
+                mctx = memfilectx(fctx.path(), fctx.data(),
+                                  islink='l' in flags,
+                                  isexec='x' in flags,
+                                  copied=copied.get(path))
                 return mctx
             raise IOError()
 
@@ -1405,10 +1406,10 @@
                         if path in bumped:
                             fctx = bumped[path]
                             flags = fctx.flags()
-                            mctx = context.memfilectx(fctx.path(), fctx.data(),
-                                                      islink='l' in flags,
-                                                      isexec='x' in flags,
-                                                      copied=copied.get(path))
+                            mctx = memfilectx(fctx.path(), fctx.data(),
+                                              islink='l' in flags,
+                                              isexec='x' in flags,
+                                              copied=copied.get(path))
                             return mctx
                         raise IOError()
                     text = 'bumped update to %s:\n\n' % prec
@@ -1835,10 +1836,10 @@
             raise IOError()
         fctx = ctx[path]
         flags = fctx.flags()
-        mctx = context.memfilectx(fctx.path(), fctx.data(),
-                                  islink='l' in flags,
-                                  isexec='x' in flags,
-                                  copied=copied.get(path))
+        mctx = memfilectx(fctx.path(), fctx.data(),
+                          islink='l' in flags,
+                          isexec='x' in flags,
+                          copied=copied.get(path))
         return mctx
 
     new = context.memctx(repo,