hgext/largefiles/lfutil.py
changeset 21042 32b3331f18eb
parent 19089 0509ae083ec1
child 21085 66c6da0bc7e2
equal deleted inserted replaced
21041:a2cc3c08c3ac 21042:32b3331f18eb
    13 import shutil
    13 import shutil
    14 import stat
    14 import stat
    15 
    15 
    16 from mercurial import dirstate, httpconnection, match as match_, util, scmutil
    16 from mercurial import dirstate, httpconnection, match as match_, util, scmutil
    17 from mercurial.i18n import _
    17 from mercurial.i18n import _
       
    18 from mercurial import node
    18 
    19 
    19 shortname = '.hglf'
    20 shortname = '.hglf'
    20 shortnameslash = shortname + '/'
    21 shortnameslash = shortname + '/'
    21 longname = 'largefiles'
    22 longname = 'largefiles'
    22 
    23 
   363     filelist = []
   364     filelist = []
   364     for f in changedstandins:
   365     for f in changedstandins:
   365         if f[0] not in filelist:
   366         if f[0] not in filelist:
   366             filelist.append(f[0])
   367             filelist.append(f[0])
   367     return filelist
   368     return filelist
       
   369 
       
   370 def getlfilestoupload(repo, missing, addfunc):
       
   371     for n in missing:
       
   372         parents = [p for p in repo.changelog.parents(n) if p != node.nullid]
       
   373         ctx = repo[n]
       
   374         files = set(ctx.files())
       
   375         if len(parents) == 2:
       
   376             mc = ctx.manifest()
       
   377             mp1 = ctx.parents()[0].manifest()
       
   378             mp2 = ctx.parents()[1].manifest()
       
   379             for f in mp1:
       
   380                 if f not in mc:
       
   381                     files.add(f)
       
   382             for f in mp2:
       
   383                 if f not in mc:
       
   384                     files.add(f)
       
   385             for f in mc:
       
   386                 if mc[f] != mp1.get(f, None) or mc[f] != mp2.get(f, None):
       
   387                     files.add(f)
       
   388         for fn in files:
       
   389             if isstandin(fn) and fn in ctx:
       
   390                 addfunc(fn, ctx[fn].data().strip())