evolve: abstract access to context.memfilectx
authorPierre-Yves David <pierre-yves.david@fb.com>
Tue, 03 Jun 2014 01:22:31 -0700
changeset 954 ef155e3ead8f
parent 953 a02e5916a7e3
child 955 72670e282460
evolve: abstract access to context.memfilectx This class is getting altered in the future Mercurial 3.1.0. This changeset prepare a compatibility layer.
hgext/evolve.py
--- 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,