##// END OF EJS Templates
largefiles: make archive -S store largefiles instead of standins...
Matt Harbison -
r16578:43fb170a default
parent child Browse files
Show More
@@ -781,6 +781,47 b' def overridearchive(orig, repo, dest, no'
781
781
782 archiver.done()
782 archiver.done()
783
783
784 def hgsubrepoarchive(orig, repo, ui, archiver, prefix):
785 rev = repo._state[1]
786 ctx = repo._repo[rev]
787
788 lfcommands.cachelfiles(ui, repo._repo, ctx.node())
789
790 def write(name, mode, islink, getdata):
791 if lfutil.isstandin(name):
792 return
793 data = getdata()
794
795 archiver.addfile(prefix + repo._path + '/' + name, mode, islink, data)
796
797 for f in ctx:
798 ff = ctx.flags(f)
799 getdata = ctx[f].data
800 if lfutil.isstandin(f):
801 path = lfutil.findfile(repo._repo, getdata().strip())
802 if path is None:
803 raise util.Abort(
804 _('largefile %s not found in repo store or system cache')
805 % lfutil.splitstandin(f))
806 f = lfutil.splitstandin(f)
807
808 def getdatafn():
809 fd = None
810 try:
811 fd = open(os.path.join(prefix, path), 'rb')
812 return fd.read()
813 finally:
814 if fd:
815 fd.close()
816
817 getdata = getdatafn
818
819 write(f, 'x' in ff and 0755 or 0644, 'l' in ff, getdata)
820
821 for subpath in ctx.substate:
822 sub = ctx.sub(subpath)
823 sub.archive(repo.ui, archiver, prefix)
824
784 # If a largefile is modified, the change is not reflected in its
825 # If a largefile is modified, the change is not reflected in its
785 # standin until a commit. cmdutil.bailifchanged() raises an exception
826 # standin until a commit. cmdutil.bailifchanged() raises an exception
786 # if the repo has uncommitted changes. Wrap it to also check if
827 # if the repo has uncommitted changes. Wrap it to also check if
@@ -100,6 +100,7 b' def uisetup(ui):'
100 extensions.wrapfunction(hg, 'merge', overrides.hgmerge)
100 extensions.wrapfunction(hg, 'merge', overrides.hgmerge)
101
101
102 extensions.wrapfunction(archival, 'archive', overrides.overridearchive)
102 extensions.wrapfunction(archival, 'archive', overrides.overridearchive)
103 extensions.wrapfunction(hgsubrepo, 'archive', overrides.hgsubrepoarchive)
103 extensions.wrapfunction(cmdutil, 'bailifchanged',
104 extensions.wrapfunction(cmdutil, 'bailifchanged',
104 overrides.overridebailifchanged)
105 overrides.overridebailifchanged)
105
106
@@ -1096,4 +1096,34 b' verify that large files in subrepos hand'
1096 abort: uncommitted changes in subrepo subrepo
1096 abort: uncommitted changes in subrepo subrepo
1097 (use --subrepos for recursive commit)
1097 (use --subrepos for recursive commit)
1098 [255]
1098 [255]
1099
1100 # Add a normal file to the subrepo, then test archiving
1101 $ echo 'normal file' > subrepo/normal.txt
1102 $ hg -R subrepo add subrepo/normal.txt
1103 # Lock in subrepo, otherwise the change isn't archived
1104 $ hg ci -S -m "add normal file to top level"
1105 committing subrepository subrepo
1106 Invoking status precommit hook
1107 M large.txt
1108 A normal.txt
1109 Invoking status precommit hook
1110 M .hgsubstate
1111 $ hg archive -S lf_subrepo_archive
1112 $ find lf_subrepo_archive -print
1113 lf_subrepo_archive
1114 lf_subrepo_archive/.hg_archival.txt
1115 lf_subrepo_archive/.hgsubstate
1116 lf_subrepo_archive/subrepo
1117 lf_subrepo_archive/subrepo/large.txt
1118 lf_subrepo_archive/subrepo/normal.txt
1119 lf_subrepo_archive/a
1120 lf_subrepo_archive/a/b
1121 lf_subrepo_archive/a/b/c
1122 lf_subrepo_archive/a/b/c/d
1123 lf_subrepo_archive/a/b/c/d/e.normal.txt
1124 lf_subrepo_archive/a/b/c/d/e.large.txt
1125 lf_subrepo_archive/a/b/c/x
1126 lf_subrepo_archive/a/b/c/x/y.normal.txt
1127 lf_subrepo_archive/.hgsub
1128
1099 $ cd ..
1129 $ cd ..
General Comments 0
You need to be logged in to leave comments. Login now