[PATCH 1 of 5] largefiles: move calculation of largefiles for updating to utility function
Na'Tosha Bard
natosha at unity3d.com
Fri Mar 9 10:13:08 CST 2012
# HG changeset patch
# User Na'Tosha Bard <natosha at unity3d.com>
# Date 1331307949 -3600
# Node ID a18ad914aa21fefd0182b164f69e726ca7b31d15
# Parent 60cc3a0d224972e0fca00fe93f0488b5e4a60c7c
largefiles: move calculation of largefiles for updating to utility function
diff -r 60cc3a0d2249 -r a18ad914aa21 hgext/largefiles/lfutil.py
--- a/hgext/largefiles/lfutil.py Thu Mar 08 15:59:47 2012 -0600
+++ b/hgext/largefiles/lfutil.py Fri Mar 09 16:45:49 2012 +0100
@@ -457,3 +457,11 @@
lfile = splitstandin(standin)
standins.append((lfile, readstandin(repo, lfile)))
return standins
+
+def getlfilestoupdate(oldstandins, newstandins):
+ changedstandins = set(oldstandins).symmetric_difference(set(newstandins))
+ filelist = []
+ for f in changedstandins:
+ if f[0] not in filelist:
+ filelist.append(f[0])
+ return filelist
diff -r 60cc3a0d2249 -r a18ad914aa21 hgext/largefiles/overrides.py
--- a/hgext/largefiles/overrides.py Thu Mar 08 15:59:47 2012 -0600
+++ b/hgext/largefiles/overrides.py Fri Mar 09 16:45:49 2012 +0100
@@ -602,19 +602,11 @@
wlock.release()
def hg_update(orig, repo, node):
- # In order to not waste a lot of extra time during the update largefiles
- # step, we keep track of the state of the standins before and after we
- # call the original update function, and only update the standins that
- # have changed in the hg.update() call
+ # Only call updatelfiles the standins that have changed to save time
oldstandins = lfutil.getstandinsstate(repo)
result = orig(repo, node)
newstandins = lfutil.getstandinsstate(repo)
- tobeupdated = set(oldstandins).symmetric_difference(set(newstandins))
- filelist = []
- for f in tobeupdated:
- if f[0] not in filelist:
- filelist.append(f[0])
-
+ filelist = lfutil.getlfilestoupdate(oldstandins, newstandins)
lfcommands.updatelfiles(repo.ui, repo, filelist=filelist, printmessage=True)
return result
More information about the Mercurial-devel
mailing list