##// END OF EJS Templates
largefiles: centralize the logic to get outgoing largefiles...
FUJIWARA Katsunori -
r21042:32b3331f default
parent child Browse files
Show More
@@ -15,6 +15,7 b' 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 + '/'
@@ -365,3 +366,25 b' def getlfilestoupdate(oldstandins, newst'
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())
@@ -12,7 +12,7 b' import os'
12 import copy
12 import copy
13
13
14 from mercurial import hg, commands, util, cmdutil, scmutil, match as match_, \
14 from mercurial import hg, commands, util, cmdutil, scmutil, match as match_, \
15 node, archival, error, merge, discovery, pathutil, revset
15 archival, error, merge, discovery, pathutil, revset
16 from mercurial.i18n import _
16 from mercurial.i18n import _
17 from mercurial.node import hex
17 from mercurial.node import hex
18 from hgext import rebase
18 from hgext import rebase
@@ -1002,25 +1002,7 b' def getoutgoinglfiles(ui, repo, dest=Non'
1002 o.reverse()
1002 o.reverse()
1003
1003
1004 toupload = set()
1004 toupload = set()
1005 for n in o:
1005 lfutil.getlfilestoupload(repo, o, lambda fn, lfhash: toupload.add(fn))
1006 parents = [p for p in repo.changelog.parents(n) if p != node.nullid]
1007 ctx = repo[n]
1008 files = set(ctx.files())
1009 if len(parents) == 2:
1010 mc = ctx.manifest()
1011 mp1 = ctx.parents()[0].manifest()
1012 mp2 = ctx.parents()[1].manifest()
1013 for f in mp1:
1014 if f not in mc:
1015 files.add(f)
1016 for f in mp2:
1017 if f not in mc:
1018 files.add(f)
1019 for f in mc:
1020 if mc[f] != mp1.get(f, None) or mc[f] != mp2.get(f, None):
1021 files.add(f)
1022 toupload = toupload.union(
1023 set([f for f in files if lfutil.isstandin(f) and f in ctx]))
1024 return sorted(toupload)
1006 return sorted(toupload)
1025
1007
1026 def overrideoutgoing(orig, ui, repo, dest=None, **opts):
1008 def overrideoutgoing(orig, ui, repo, dest=None, **opts):
@@ -11,7 +11,6 b' import copy'
11 import os
11 import os
12
12
13 from mercurial import error, manifest, match as match_, util, discovery
13 from mercurial import error, manifest, match as match_, util, discovery
14 from mercurial import node as node_
15 from mercurial.i18n import _
14 from mercurial.i18n import _
16 from mercurial import localrepo
15 from mercurial import localrepo
17
16
@@ -419,30 +418,8 b' def reposetup(ui, repo):'
419 if outgoing.missing:
418 if outgoing.missing:
420 toupload = set()
419 toupload = set()
421 o = self.changelog.nodesbetween(outgoing.missing, revs)[0]
420 o = self.changelog.nodesbetween(outgoing.missing, revs)[0]
422 for n in o:
421 addfunc = lambda fn, lfhash: toupload.add(lfhash)
423 parents = [p for p in self.changelog.parents(n)
422 lfutil.getlfilestoupload(self, o, addfunc)
424 if p != node_.nullid]
425 ctx = self[n]
426 files = set(ctx.files())
427 if len(parents) == 2:
428 mc = ctx.manifest()
429 mp1 = ctx.parents()[0].manifest()
430 mp2 = ctx.parents()[1].manifest()
431 for f in mp1:
432 if f not in mc:
433 files.add(f)
434 for f in mp2:
435 if f not in mc:
436 files.add(f)
437 for f in mc:
438 if mc[f] != mp1.get(f, None) or mc[f] != mp2.get(f,
439 None):
440 files.add(f)
441
442 toupload = toupload.union(
443 set([ctx[f].data().strip()
444 for f in files
445 if lfutil.isstandin(f) and f in ctx]))
446 lfcommands.uploadlfiles(ui, self, remote, toupload)
423 lfcommands.uploadlfiles(ui, self, remote, toupload)
447 return super(lfilesrepo, self).push(remote, force=force, revs=revs,
424 return super(lfilesrepo, self).push(remote, force=force, revs=revs,
448 newbranch=newbranch)
425 newbranch=newbranch)
General Comments 0
You need to be logged in to leave comments. Login now