largefiles: factor out a copyalltostore() function
authorDan Villiom Podlaski Christiansen <danchr@gmail.com>
Sun, 08 Jan 2012 14:33:10 +0100
changeset 15796 3e5b6045ccfc
parent 15795 8bed8551d535
child 15797 c7a8164c61ab
largefiles: factor out a copyalltostore() function
hgext/largefiles/lfutil.py
hgext/largefiles/reposetup.py
--- a/hgext/largefiles/lfutil.py	Sat Jan 07 19:11:31 2012 +0100
+++ b/hgext/largefiles/lfutil.py	Sun Jan 08 14:33:10 2012 +0100
@@ -222,6 +222,16 @@
         return
     copytostoreabsolute(repo, repo.wjoin(file), hash)
 
+def copyalltostore(repo, node):
+    '''Copy all largefiles in a given revision to the store'''
+
+    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):
--- a/hgext/largefiles/reposetup.py	Sat Jan 07 19:11:31 2012 +0100
+++ b/hgext/largefiles/reposetup.py	Sun Jan 08 14:33:10 2012 +0100
@@ -256,12 +256,7 @@
         # 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)
-
+            lfutil.copyalltostore(self, node)
             return node
 
         # Before commit, largefile standins have not had their