diff hgext/largefiles/lfcommands.py @ 21689:503bb3af70fe

memfilectx: call super.__init__ instead of duplicating code This patch changes the calling signature of memfilectx's __init__ to fall in line with the other file contexts. Calling code and tests have been updated accordingly.
author Sean Farley <sean.michael.farley@gmail.com>
date Thu, 15 Aug 2013 16:49:27 -0500
parents 4c94229c51fb
children 15d434bee41c
line wrap: on
line diff
--- a/hgext/largefiles/lfcommands.py	Thu Aug 15 15:23:36 2013 -0500
+++ b/hgext/largefiles/lfcommands.py	Thu Aug 15 16:49:27 2013 -0500
@@ -172,10 +172,10 @@
             finally:
                 if fd:
                     fd.close()
-            return context.memfilectx(f, data, 'l' in fctx.flags(),
+            return context.memfilectx(repo, f, data, 'l' in fctx.flags(),
                                       'x' in fctx.flags(), renamed)
         else:
-            return _getnormalcontext(repo.ui, ctx, f, revmap)
+            return _getnormalcontext(repo, ctx, f, revmap)
 
     dstfiles = []
     for file in files:
@@ -255,10 +255,11 @@
                 # doesn't change after rename or copy
                 renamed = lfutil.standin(renamed[0])
 
-            return context.memfilectx(f, lfiletohash[srcfname] + '\n', 'l' in
-                fctx.flags(), 'x' in fctx.flags(), renamed)
+            return context.memfilectx(repo, f, lfiletohash[srcfname] + '\n',
+                                      'l' in fctx.flags(), 'x' in fctx.flags(),
+                                      renamed)
         else:
-            return _getnormalcontext(repo.ui, ctx, f, revmap)
+            return _getnormalcontext(repo, ctx, f, revmap)
 
     # Commit
     _commitcontext(rdst, parents, ctx, dstfiles, getfilectx, revmap)
@@ -293,7 +294,7 @@
     return parents
 
 # Get memfilectx for a normal file
-def _getnormalcontext(ui, ctx, f, revmap):
+def _getnormalcontext(repo, ctx, f, revmap):
     try:
         fctx = ctx.filectx(f)
     except error.LookupError:
@@ -304,8 +305,8 @@
 
     data = fctx.data()
     if f == '.hgtags':
-        data = _converttags (ui, revmap, data)
-    return context.memfilectx(f, data, 'l' in fctx.flags(),
+        data = _converttags (repo.ui, revmap, data)
+    return context.memfilectx(repo, f, data, 'l' in fctx.flags(),
                               'x' in fctx.flags(), renamed)
 
 # Remap tag data using a revision map