hgext/largefiles/lfutil.py
changeset 21042 32b3331f18eb
parent 19089 0509ae083ec1
child 21085 66c6da0bc7e2
--- a/hgext/largefiles/lfutil.py	Fri Mar 14 21:32:05 2014 -0400
+++ b/hgext/largefiles/lfutil.py	Wed Apr 16 00:37:24 2014 +0900
@@ -15,6 +15,7 @@
 
 from mercurial import dirstate, httpconnection, match as match_, util, scmutil
 from mercurial.i18n import _
+from mercurial import node
 
 shortname = '.hglf'
 shortnameslash = shortname + '/'
@@ -365,3 +366,25 @@
         if f[0] not in filelist:
             filelist.append(f[0])
     return filelist
+
+def getlfilestoupload(repo, missing, addfunc):
+    for n in missing:
+        parents = [p for p in repo.changelog.parents(n) if p != node.nullid]
+        ctx = repo[n]
+        files = set(ctx.files())
+        if len(parents) == 2:
+            mc = ctx.manifest()
+            mp1 = ctx.parents()[0].manifest()
+            mp2 = ctx.parents()[1].manifest()
+            for f in mp1:
+                if f not in mc:
+                    files.add(f)
+            for f in mp2:
+                if f not in mc:
+                    files.add(f)
+            for f in mc:
+                if mc[f] != mp1.get(f, None) or mc[f] != mp2.get(f, None):
+                    files.add(f)
+        for fn in files:
+            if isstandin(fn) and fn in ctx:
+                addfunc(fn, ctx[fn].data().strip())