[PATCH 4 of 5] largefiles: wrap usercommitctx() instead of commitctx()

Dan Villiom Podlaski Christiansen danchr at gmail.com
Fri Jan 6 08:16:07 CST 2012


# HG changeset patch
# User Dan Villiom Podlaski Christiansen  <danchr at gmail.com>
# Date 1325857617 -3600
# Node ID 31ace7a24b0384dc88a67763a73ccebe018f8077
# Parent  6bf0076c8bac8d2e5ee91adfd25c65f2c32f5115
largefiles: wrap usercommitctx() instead of commitctx()

diff --git a/hgext/largefiles/lfcommands.py b/hgext/largefiles/lfcommands.py
--- a/hgext/largefiles/lfcommands.py
+++ b/hgext/largefiles/lfcommands.py
@@ -188,6 +188,7 @@ def _addchangeset(ui, rsrc, rdst, ctx, r
     mctx = context.memctx(rdst, parents, ctx.description(), dstfiles,
                           getfilectx, ctx.user(), ctx.date(), ctx.extra())
     ret = rdst.commitctx(mctx)
+    lfutil.copyalltostore(rdst, ret)
     rdst.dirstate.setparents(ret)
     revmap[ctx.node()] = rdst.changelog.tip()
 
@@ -304,6 +305,7 @@ def _lfconvert_addchangeset(rsrc, rdst, 
     mctx = context.memctx(rdst, parents, ctx.description(), dstfiles,
                           getfilectx, ctx.user(), ctx.date(), ctx.extra())
     ret = rdst.commitctx(mctx)
+    lfutil.copyalltostore(rdst, ret)
     rdst.dirstate.setparents(ret)
     revmap[ctx.node()] = rdst.changelog.tip()
 
diff --git a/hgext/largefiles/lfutil.py b/hgext/largefiles/lfutil.py
--- a/hgext/largefiles/lfutil.py
+++ b/hgext/largefiles/lfutil.py
@@ -232,6 +232,14 @@ def copytostore(repo, rev, file, uploade
         return
     copytostoreabsolute(repo, repo.wjoin(file), hash)
 
+def copyalltostore(repo, node):
+    ctx = repo[node]
+    for filename in ctx.files():
+        if isstandin(filename) and filename in ctx.manifest():
+            realfile = splitstandin(filename)
+            copytostore(repo, ctx.node(), realfile)
+
+
 def copytostoreabsolute(repo, file, hash):
     util.makedirs(os.path.dirname(storepath(repo, hash)))
     if inusercache(repo.ui, hash):
diff --git a/hgext/largefiles/reposetup.py b/hgext/largefiles/reposetup.py
--- a/hgext/largefiles/reposetup.py
+++ b/hgext/largefiles/reposetup.py
@@ -24,10 +24,10 @@ def reposetup(ui, repo):
     if not repo.local():
         return proto.wirereposetup(ui, repo)
 
-    for name in ('status', 'commitctx', 'commit', 'push'):
+    for name in ('status', 'usercommitctx', 'commit', 'push'):
         method = getattr(repo, name)
         #if not (isinstance(method, types.MethodType) and
-        #        method.im_func is repo.__class__.commitctx.im_func):
+        #        method.im_func is repo.__class__.usercommitctx.im_func):
         if (isinstance(method, types.FunctionType) and
             method.func_name == 'wrap'):
             ui.warn(_('largefiles: repo method %r appears to have already been'
@@ -260,14 +260,9 @@ def reposetup(ui, repo):
 
         # As part of committing, copy all of the largefiles into the
         # cache.
-        def commitctx(self, *args, **kwargs):
-            node = super(lfiles_repo, self).commitctx(*args, **kwargs)
-            ctx = self[node]
-            for filename in ctx.files():
-                if lfutil.isstandin(filename) and filename in ctx.manifest():
-                    realfile = lfutil.splitstandin(filename)
-                    lfutil.copytostore(self, ctx.node(), realfile)
-
+        def usercommitctx(self, *args, **kwargs):
+            node = super(lfiles_repo, self).usercommitctx(*args, **kwargs)
+            lfutil.copyalltostore(self, node)
             return node
 
         # Before commit, largefile standins have not had their


More information about the Mercurial-devel mailing list