[PATCH 1 of 6 v2] largefiles: factor out a copyalltostore() function
Dan Villiom Podlaski Christiansen
danchr at gmail.com
Sun Jan 8 07:37:51 CST 2012
# HG changeset patch
# User Dan Villiom Podlaski Christiansen <danchr at gmail.com>
# Date 1326029590 -3600
# Node ID 3caeb4a722562b26a5e50f9a9e5e1d3783e2f051
# Parent 3fe39d6d2bd8331932df063d272fff8af327881c
largefiles: factor out a copyalltostore() function
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,16 @@ def copytostore(repo, rev, file, uploade
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):
diff --git a/hgext/largefiles/reposetup.py b/hgext/largefiles/reposetup.py
--- a/hgext/largefiles/reposetup.py
+++ b/hgext/largefiles/reposetup.py
@@ -260,12 +260,7 @@ def reposetup(ui, repo):
# 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
More information about the Mercurial-devel
mailing list