Show More
@@ -1,1111 +1,1115 | |||||
1 | # Copyright 2009-2010 Gregory P. Ward |
|
1 | # Copyright 2009-2010 Gregory P. Ward | |
2 | # Copyright 2009-2010 Intelerad Medical Systems Incorporated |
|
2 | # Copyright 2009-2010 Intelerad Medical Systems Incorporated | |
3 | # Copyright 2010-2011 Fog Creek Software |
|
3 | # Copyright 2010-2011 Fog Creek Software | |
4 | # Copyright 2010-2011 Unity Technologies |
|
4 | # Copyright 2010-2011 Unity Technologies | |
5 | # |
|
5 | # | |
6 | # This software may be used and distributed according to the terms of the |
|
6 | # This software may be used and distributed according to the terms of the | |
7 | # GNU General Public License version 2 or any later version. |
|
7 | # GNU General Public License version 2 or any later version. | |
8 |
|
8 | |||
9 | '''Overridden Mercurial commands and functions for the largefiles extension''' |
|
9 | '''Overridden Mercurial commands and functions for the largefiles extension''' | |
10 |
|
10 | |||
11 | import os |
|
11 | 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 |
|
15 | node, archival, error, merge | |
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 | |
19 |
|
19 | |||
20 | import lfutil |
|
20 | import lfutil | |
21 | import lfcommands |
|
21 | import lfcommands | |
22 |
|
22 | |||
23 | # -- Utility functions: commonly/repeatedly needed functionality --------------- |
|
23 | # -- Utility functions: commonly/repeatedly needed functionality --------------- | |
24 |
|
24 | |||
25 | def installnormalfilesmatchfn(manifest): |
|
25 | def installnormalfilesmatchfn(manifest): | |
26 | '''overrides scmutil.match so that the matcher it returns will ignore all |
|
26 | '''overrides scmutil.match so that the matcher it returns will ignore all | |
27 | largefiles''' |
|
27 | largefiles''' | |
28 | oldmatch = None # for the closure |
|
28 | oldmatch = None # for the closure | |
29 | def overridematch(ctx, pats=[], opts={}, globbed=False, |
|
29 | def overridematch(ctx, pats=[], opts={}, globbed=False, | |
30 | default='relpath'): |
|
30 | default='relpath'): | |
31 | match = oldmatch(ctx, pats, opts, globbed, default) |
|
31 | match = oldmatch(ctx, pats, opts, globbed, default) | |
32 | m = copy.copy(match) |
|
32 | m = copy.copy(match) | |
33 | notlfile = lambda f: not (lfutil.isstandin(f) or lfutil.standin(f) in |
|
33 | notlfile = lambda f: not (lfutil.isstandin(f) or lfutil.standin(f) in | |
34 | manifest) |
|
34 | manifest) | |
35 | m._files = filter(notlfile, m._files) |
|
35 | m._files = filter(notlfile, m._files) | |
36 | m._fmap = set(m._files) |
|
36 | m._fmap = set(m._files) | |
37 | origmatchfn = m.matchfn |
|
37 | origmatchfn = m.matchfn | |
38 | m.matchfn = lambda f: notlfile(f) and origmatchfn(f) or None |
|
38 | m.matchfn = lambda f: notlfile(f) and origmatchfn(f) or None | |
39 | return m |
|
39 | return m | |
40 | oldmatch = installmatchfn(overridematch) |
|
40 | oldmatch = installmatchfn(overridematch) | |
41 |
|
41 | |||
42 | def installmatchfn(f): |
|
42 | def installmatchfn(f): | |
43 | oldmatch = scmutil.match |
|
43 | oldmatch = scmutil.match | |
44 | setattr(f, 'oldmatch', oldmatch) |
|
44 | setattr(f, 'oldmatch', oldmatch) | |
45 | scmutil.match = f |
|
45 | scmutil.match = f | |
46 | return oldmatch |
|
46 | return oldmatch | |
47 |
|
47 | |||
48 | def restorematchfn(): |
|
48 | def restorematchfn(): | |
49 | '''restores scmutil.match to what it was before installnormalfilesmatchfn |
|
49 | '''restores scmutil.match to what it was before installnormalfilesmatchfn | |
50 | was called. no-op if scmutil.match is its original function. |
|
50 | was called. no-op if scmutil.match is its original function. | |
51 |
|
51 | |||
52 | Note that n calls to installnormalfilesmatchfn will require n calls to |
|
52 | Note that n calls to installnormalfilesmatchfn will require n calls to | |
53 | restore matchfn to reverse''' |
|
53 | restore matchfn to reverse''' | |
54 | scmutil.match = getattr(scmutil.match, 'oldmatch', scmutil.match) |
|
54 | scmutil.match = getattr(scmutil.match, 'oldmatch', scmutil.match) | |
55 |
|
55 | |||
56 | def addlargefiles(ui, repo, *pats, **opts): |
|
56 | def addlargefiles(ui, repo, *pats, **opts): | |
57 | large = opts.pop('large', None) |
|
57 | large = opts.pop('large', None) | |
58 | lfsize = lfutil.getminsize( |
|
58 | lfsize = lfutil.getminsize( | |
59 | ui, lfutil.islfilesrepo(repo), opts.pop('lfsize', None)) |
|
59 | ui, lfutil.islfilesrepo(repo), opts.pop('lfsize', None)) | |
60 |
|
60 | |||
61 | lfmatcher = None |
|
61 | lfmatcher = None | |
62 | if lfutil.islfilesrepo(repo): |
|
62 | if lfutil.islfilesrepo(repo): | |
63 | lfpats = ui.configlist(lfutil.longname, 'patterns', default=[]) |
|
63 | lfpats = ui.configlist(lfutil.longname, 'patterns', default=[]) | |
64 | if lfpats: |
|
64 | if lfpats: | |
65 | lfmatcher = match_.match(repo.root, '', list(lfpats)) |
|
65 | lfmatcher = match_.match(repo.root, '', list(lfpats)) | |
66 |
|
66 | |||
67 | lfnames = [] |
|
67 | lfnames = [] | |
68 | m = scmutil.match(repo[None], pats, opts) |
|
68 | m = scmutil.match(repo[None], pats, opts) | |
69 | m.bad = lambda x, y: None |
|
69 | m.bad = lambda x, y: None | |
70 | wctx = repo[None] |
|
70 | wctx = repo[None] | |
71 | for f in repo.walk(m): |
|
71 | for f in repo.walk(m): | |
72 | exact = m.exact(f) |
|
72 | exact = m.exact(f) | |
73 | lfile = lfutil.standin(f) in wctx |
|
73 | lfile = lfutil.standin(f) in wctx | |
74 | nfile = f in wctx |
|
74 | nfile = f in wctx | |
75 | exists = lfile or nfile |
|
75 | exists = lfile or nfile | |
76 |
|
76 | |||
77 | # Don't warn the user when they attempt to add a normal tracked file. |
|
77 | # Don't warn the user when they attempt to add a normal tracked file. | |
78 | # The normal add code will do that for us. |
|
78 | # The normal add code will do that for us. | |
79 | if exact and exists: |
|
79 | if exact and exists: | |
80 | if lfile: |
|
80 | if lfile: | |
81 | ui.warn(_('%s already a largefile\n') % f) |
|
81 | ui.warn(_('%s already a largefile\n') % f) | |
82 | continue |
|
82 | continue | |
83 |
|
83 | |||
84 | if (exact or not exists) and not lfutil.isstandin(f): |
|
84 | if (exact or not exists) and not lfutil.isstandin(f): | |
85 | wfile = repo.wjoin(f) |
|
85 | wfile = repo.wjoin(f) | |
86 |
|
86 | |||
87 | # In case the file was removed previously, but not committed |
|
87 | # In case the file was removed previously, but not committed | |
88 | # (issue3507) |
|
88 | # (issue3507) | |
89 | if not os.path.exists(wfile): |
|
89 | if not os.path.exists(wfile): | |
90 | continue |
|
90 | continue | |
91 |
|
91 | |||
92 | abovemin = (lfsize and |
|
92 | abovemin = (lfsize and | |
93 | os.lstat(wfile).st_size >= lfsize * 1024 * 1024) |
|
93 | os.lstat(wfile).st_size >= lfsize * 1024 * 1024) | |
94 | if large or abovemin or (lfmatcher and lfmatcher(f)): |
|
94 | if large or abovemin or (lfmatcher and lfmatcher(f)): | |
95 | lfnames.append(f) |
|
95 | lfnames.append(f) | |
96 | if ui.verbose or not exact: |
|
96 | if ui.verbose or not exact: | |
97 | ui.status(_('adding %s as a largefile\n') % m.rel(f)) |
|
97 | ui.status(_('adding %s as a largefile\n') % m.rel(f)) | |
98 |
|
98 | |||
99 | bad = [] |
|
99 | bad = [] | |
100 | standins = [] |
|
100 | standins = [] | |
101 |
|
101 | |||
102 | # Need to lock, otherwise there could be a race condition between |
|
102 | # Need to lock, otherwise there could be a race condition between | |
103 | # when standins are created and added to the repo. |
|
103 | # when standins are created and added to the repo. | |
104 | wlock = repo.wlock() |
|
104 | wlock = repo.wlock() | |
105 | try: |
|
105 | try: | |
106 | if not opts.get('dry_run'): |
|
106 | if not opts.get('dry_run'): | |
107 | lfdirstate = lfutil.openlfdirstate(ui, repo) |
|
107 | lfdirstate = lfutil.openlfdirstate(ui, repo) | |
108 | for f in lfnames: |
|
108 | for f in lfnames: | |
109 | standinname = lfutil.standin(f) |
|
109 | standinname = lfutil.standin(f) | |
110 | lfutil.writestandin(repo, standinname, hash='', |
|
110 | lfutil.writestandin(repo, standinname, hash='', | |
111 | executable=lfutil.getexecutable(repo.wjoin(f))) |
|
111 | executable=lfutil.getexecutable(repo.wjoin(f))) | |
112 | standins.append(standinname) |
|
112 | standins.append(standinname) | |
113 | if lfdirstate[f] == 'r': |
|
113 | if lfdirstate[f] == 'r': | |
114 | lfdirstate.normallookup(f) |
|
114 | lfdirstate.normallookup(f) | |
115 | else: |
|
115 | else: | |
116 | lfdirstate.add(f) |
|
116 | lfdirstate.add(f) | |
117 | lfdirstate.write() |
|
117 | lfdirstate.write() | |
118 | bad += [lfutil.splitstandin(f) |
|
118 | bad += [lfutil.splitstandin(f) | |
119 | for f in lfutil.repoadd(repo, standins) |
|
119 | for f in lfutil.repoadd(repo, standins) | |
120 | if f in m.files()] |
|
120 | if f in m.files()] | |
121 | finally: |
|
121 | finally: | |
122 | wlock.release() |
|
122 | wlock.release() | |
123 | return bad |
|
123 | return bad | |
124 |
|
124 | |||
125 | def removelargefiles(ui, repo, *pats, **opts): |
|
125 | def removelargefiles(ui, repo, *pats, **opts): | |
126 | after = opts.get('after') |
|
126 | after = opts.get('after') | |
127 | if not pats and not after: |
|
127 | if not pats and not after: | |
128 | raise util.Abort(_('no files specified')) |
|
128 | raise util.Abort(_('no files specified')) | |
129 | m = scmutil.match(repo[None], pats, opts) |
|
129 | m = scmutil.match(repo[None], pats, opts) | |
130 | try: |
|
130 | try: | |
131 | repo.lfstatus = True |
|
131 | repo.lfstatus = True | |
132 | s = repo.status(match=m, clean=True) |
|
132 | s = repo.status(match=m, clean=True) | |
133 | finally: |
|
133 | finally: | |
134 | repo.lfstatus = False |
|
134 | repo.lfstatus = False | |
135 | manifest = repo[None].manifest() |
|
135 | manifest = repo[None].manifest() | |
136 | modified, added, deleted, clean = [[f for f in list |
|
136 | modified, added, deleted, clean = [[f for f in list | |
137 | if lfutil.standin(f) in manifest] |
|
137 | if lfutil.standin(f) in manifest] | |
138 | for list in [s[0], s[1], s[3], s[6]]] |
|
138 | for list in [s[0], s[1], s[3], s[6]]] | |
139 |
|
139 | |||
140 | def warn(files, reason): |
|
140 | def warn(files, reason): | |
141 | for f in files: |
|
141 | for f in files: | |
142 | ui.warn(_('not removing %s: %s (use forget to undo)\n') |
|
142 | ui.warn(_('not removing %s: %s (use forget to undo)\n') | |
143 | % (m.rel(f), reason)) |
|
143 | % (m.rel(f), reason)) | |
144 | return int(len(files) > 0) |
|
144 | return int(len(files) > 0) | |
145 |
|
145 | |||
146 | result = 0 |
|
146 | result = 0 | |
147 |
|
147 | |||
148 | if after: |
|
148 | if after: | |
149 | remove, forget = deleted, [] |
|
149 | remove, forget = deleted, [] | |
150 | result = warn(modified + added + clean, _('file still exists')) |
|
150 | result = warn(modified + added + clean, _('file still exists')) | |
151 | else: |
|
151 | else: | |
152 | remove, forget = deleted + clean, [] |
|
152 | remove, forget = deleted + clean, [] | |
153 | result = warn(modified, _('file is modified')) |
|
153 | result = warn(modified, _('file is modified')) | |
154 | result = warn(added, _('file has been marked for add')) or result |
|
154 | result = warn(added, _('file has been marked for add')) or result | |
155 |
|
155 | |||
156 | for f in sorted(remove + forget): |
|
156 | for f in sorted(remove + forget): | |
157 | if ui.verbose or not m.exact(f): |
|
157 | if ui.verbose or not m.exact(f): | |
158 | ui.status(_('removing %s\n') % m.rel(f)) |
|
158 | ui.status(_('removing %s\n') % m.rel(f)) | |
159 |
|
159 | |||
160 | # Need to lock because standin files are deleted then removed from the |
|
160 | # Need to lock because standin files are deleted then removed from the | |
161 | # repository and we could race in-between. |
|
161 | # repository and we could race in-between. | |
162 | wlock = repo.wlock() |
|
162 | wlock = repo.wlock() | |
163 | try: |
|
163 | try: | |
164 | lfdirstate = lfutil.openlfdirstate(ui, repo) |
|
164 | lfdirstate = lfutil.openlfdirstate(ui, repo) | |
165 | for f in remove: |
|
165 | for f in remove: | |
166 | if not after: |
|
166 | if not after: | |
167 | # If this is being called by addremove, notify the user that we |
|
167 | # If this is being called by addremove, notify the user that we | |
168 | # are removing the file. |
|
168 | # are removing the file. | |
169 | if getattr(repo, "_isaddremove", False): |
|
169 | if getattr(repo, "_isaddremove", False): | |
170 | ui.status(_('removing %s\n') % f) |
|
170 | ui.status(_('removing %s\n') % f) | |
171 | if os.path.exists(repo.wjoin(f)): |
|
171 | if os.path.exists(repo.wjoin(f)): | |
172 | util.unlinkpath(repo.wjoin(f)) |
|
172 | util.unlinkpath(repo.wjoin(f)) | |
173 | lfdirstate.remove(f) |
|
173 | lfdirstate.remove(f) | |
174 | lfdirstate.write() |
|
174 | lfdirstate.write() | |
175 | forget = [lfutil.standin(f) for f in forget] |
|
175 | forget = [lfutil.standin(f) for f in forget] | |
176 | remove = [lfutil.standin(f) for f in remove] |
|
176 | remove = [lfutil.standin(f) for f in remove] | |
177 | lfutil.repoforget(repo, forget) |
|
177 | lfutil.repoforget(repo, forget) | |
178 | # If this is being called by addremove, let the original addremove |
|
178 | # If this is being called by addremove, let the original addremove | |
179 | # function handle this. |
|
179 | # function handle this. | |
180 | if not getattr(repo, "_isaddremove", False): |
|
180 | if not getattr(repo, "_isaddremove", False): | |
181 | lfutil.reporemove(repo, remove, unlink=True) |
|
181 | lfutil.reporemove(repo, remove, unlink=True) | |
182 | else: |
|
182 | else: | |
183 | lfutil.reporemove(repo, remove, unlink=False) |
|
183 | lfutil.reporemove(repo, remove, unlink=False) | |
184 | finally: |
|
184 | finally: | |
185 | wlock.release() |
|
185 | wlock.release() | |
186 |
|
186 | |||
187 | return result |
|
187 | return result | |
188 |
|
188 | |||
189 | # For overriding mercurial.hgweb.webcommands so that largefiles will |
|
189 | # For overriding mercurial.hgweb.webcommands so that largefiles will | |
190 | # appear at their right place in the manifests. |
|
190 | # appear at their right place in the manifests. | |
191 | def decodepath(orig, path): |
|
191 | def decodepath(orig, path): | |
192 | return lfutil.splitstandin(path) or path |
|
192 | return lfutil.splitstandin(path) or path | |
193 |
|
193 | |||
194 | # -- Wrappers: modify existing commands -------------------------------- |
|
194 | # -- Wrappers: modify existing commands -------------------------------- | |
195 |
|
195 | |||
196 | # Add works by going through the files that the user wanted to add and |
|
196 | # Add works by going through the files that the user wanted to add and | |
197 | # checking if they should be added as largefiles. Then it makes a new |
|
197 | # checking if they should be added as largefiles. Then it makes a new | |
198 | # matcher which matches only the normal files and runs the original |
|
198 | # matcher which matches only the normal files and runs the original | |
199 | # version of add. |
|
199 | # version of add. | |
200 | def overrideadd(orig, ui, repo, *pats, **opts): |
|
200 | def overrideadd(orig, ui, repo, *pats, **opts): | |
201 | normal = opts.pop('normal') |
|
201 | normal = opts.pop('normal') | |
202 | if normal: |
|
202 | if normal: | |
203 | if opts.get('large'): |
|
203 | if opts.get('large'): | |
204 | raise util.Abort(_('--normal cannot be used with --large')) |
|
204 | raise util.Abort(_('--normal cannot be used with --large')) | |
205 | return orig(ui, repo, *pats, **opts) |
|
205 | return orig(ui, repo, *pats, **opts) | |
206 | bad = addlargefiles(ui, repo, *pats, **opts) |
|
206 | bad = addlargefiles(ui, repo, *pats, **opts) | |
207 | installnormalfilesmatchfn(repo[None].manifest()) |
|
207 | installnormalfilesmatchfn(repo[None].manifest()) | |
208 | result = orig(ui, repo, *pats, **opts) |
|
208 | result = orig(ui, repo, *pats, **opts) | |
209 | restorematchfn() |
|
209 | restorematchfn() | |
210 |
|
210 | |||
211 | return (result == 1 or bad) and 1 or 0 |
|
211 | return (result == 1 or bad) and 1 or 0 | |
212 |
|
212 | |||
213 | def overrideremove(orig, ui, repo, *pats, **opts): |
|
213 | def overrideremove(orig, ui, repo, *pats, **opts): | |
214 | installnormalfilesmatchfn(repo[None].manifest()) |
|
214 | installnormalfilesmatchfn(repo[None].manifest()) | |
215 | result = orig(ui, repo, *pats, **opts) |
|
215 | result = orig(ui, repo, *pats, **opts) | |
216 | restorematchfn() |
|
216 | restorematchfn() | |
217 | return removelargefiles(ui, repo, *pats, **opts) or result |
|
217 | return removelargefiles(ui, repo, *pats, **opts) or result | |
218 |
|
218 | |||
219 | def overridestatusfn(orig, repo, rev2, **opts): |
|
219 | def overridestatusfn(orig, repo, rev2, **opts): | |
220 | try: |
|
220 | try: | |
221 | repo._repo.lfstatus = True |
|
221 | repo._repo.lfstatus = True | |
222 | return orig(repo, rev2, **opts) |
|
222 | return orig(repo, rev2, **opts) | |
223 | finally: |
|
223 | finally: | |
224 | repo._repo.lfstatus = False |
|
224 | repo._repo.lfstatus = False | |
225 |
|
225 | |||
226 | def overridestatus(orig, ui, repo, *pats, **opts): |
|
226 | def overridestatus(orig, ui, repo, *pats, **opts): | |
227 | try: |
|
227 | try: | |
228 | repo.lfstatus = True |
|
228 | repo.lfstatus = True | |
229 | return orig(ui, repo, *pats, **opts) |
|
229 | return orig(ui, repo, *pats, **opts) | |
230 | finally: |
|
230 | finally: | |
231 | repo.lfstatus = False |
|
231 | repo.lfstatus = False | |
232 |
|
232 | |||
233 | def overridedirty(orig, repo, ignoreupdate=False): |
|
233 | def overridedirty(orig, repo, ignoreupdate=False): | |
234 | try: |
|
234 | try: | |
235 | repo._repo.lfstatus = True |
|
235 | repo._repo.lfstatus = True | |
236 | return orig(repo, ignoreupdate) |
|
236 | return orig(repo, ignoreupdate) | |
237 | finally: |
|
237 | finally: | |
238 | repo._repo.lfstatus = False |
|
238 | repo._repo.lfstatus = False | |
239 |
|
239 | |||
240 | def overridelog(orig, ui, repo, *pats, **opts): |
|
240 | def overridelog(orig, ui, repo, *pats, **opts): | |
241 | try: |
|
241 | try: | |
242 | repo.lfstatus = True |
|
242 | repo.lfstatus = True | |
243 | return orig(ui, repo, *pats, **opts) |
|
243 | return orig(ui, repo, *pats, **opts) | |
244 | finally: |
|
244 | finally: | |
245 | repo.lfstatus = False |
|
245 | repo.lfstatus = False | |
246 |
|
246 | |||
247 | def overrideverify(orig, ui, repo, *pats, **opts): |
|
247 | def overrideverify(orig, ui, repo, *pats, **opts): | |
248 | large = opts.pop('large', False) |
|
248 | large = opts.pop('large', False) | |
249 | all = opts.pop('lfa', False) |
|
249 | all = opts.pop('lfa', False) | |
250 | contents = opts.pop('lfc', False) |
|
250 | contents = opts.pop('lfc', False) | |
251 |
|
251 | |||
252 | result = orig(ui, repo, *pats, **opts) |
|
252 | result = orig(ui, repo, *pats, **opts) | |
253 | if large: |
|
253 | if large: | |
254 | result = result or lfcommands.verifylfiles(ui, repo, all, contents) |
|
254 | result = result or lfcommands.verifylfiles(ui, repo, all, contents) | |
255 | return result |
|
255 | return result | |
256 |
|
256 | |||
257 | # Override needs to refresh standins so that update's normal merge |
|
257 | # Override needs to refresh standins so that update's normal merge | |
258 | # will go through properly. Then the other update hook (overriding repo.update) |
|
258 | # will go through properly. Then the other update hook (overriding repo.update) | |
259 | # will get the new files. Filemerge is also overridden so that the merge |
|
259 | # will get the new files. Filemerge is also overridden so that the merge | |
260 | # will merge standins correctly. |
|
260 | # will merge standins correctly. | |
261 | def overrideupdate(orig, ui, repo, *pats, **opts): |
|
261 | def overrideupdate(orig, ui, repo, *pats, **opts): | |
262 | lfdirstate = lfutil.openlfdirstate(ui, repo) |
|
262 | lfdirstate = lfutil.openlfdirstate(ui, repo) | |
263 | s = lfdirstate.status(match_.always(repo.root, repo.getcwd()), [], False, |
|
263 | s = lfdirstate.status(match_.always(repo.root, repo.getcwd()), [], False, | |
264 | False, False) |
|
264 | False, False) | |
265 | (unsure, modified, added, removed, missing, unknown, ignored, clean) = s |
|
265 | (unsure, modified, added, removed, missing, unknown, ignored, clean) = s | |
266 |
|
266 | |||
267 | # Need to lock between the standins getting updated and their |
|
267 | # Need to lock between the standins getting updated and their | |
268 | # largefiles getting updated |
|
268 | # largefiles getting updated | |
269 | wlock = repo.wlock() |
|
269 | wlock = repo.wlock() | |
270 | try: |
|
270 | try: | |
271 | if opts['check']: |
|
271 | if opts['check']: | |
272 | mod = len(modified) > 0 |
|
272 | mod = len(modified) > 0 | |
273 | for lfile in unsure: |
|
273 | for lfile in unsure: | |
274 | standin = lfutil.standin(lfile) |
|
274 | standin = lfutil.standin(lfile) | |
275 | if repo['.'][standin].data().strip() != \ |
|
275 | if repo['.'][standin].data().strip() != \ | |
276 | lfutil.hashfile(repo.wjoin(lfile)): |
|
276 | lfutil.hashfile(repo.wjoin(lfile)): | |
277 | mod = True |
|
277 | mod = True | |
278 | else: |
|
278 | else: | |
279 | lfdirstate.normal(lfile) |
|
279 | lfdirstate.normal(lfile) | |
280 | lfdirstate.write() |
|
280 | lfdirstate.write() | |
281 | if mod: |
|
281 | if mod: | |
282 | raise util.Abort(_('uncommitted local changes')) |
|
282 | raise util.Abort(_('uncommitted local changes')) | |
283 | # XXX handle removed differently |
|
283 | # XXX handle removed differently | |
284 | if not opts['clean']: |
|
284 | if not opts['clean']: | |
285 | for lfile in unsure + modified + added: |
|
285 | for lfile in unsure + modified + added: | |
286 | lfutil.updatestandin(repo, lfutil.standin(lfile)) |
|
286 | lfutil.updatestandin(repo, lfutil.standin(lfile)) | |
287 | finally: |
|
287 | finally: | |
288 | wlock.release() |
|
288 | wlock.release() | |
289 | return orig(ui, repo, *pats, **opts) |
|
289 | return orig(ui, repo, *pats, **opts) | |
290 |
|
290 | |||
291 | # Before starting the manifest merge, merge.updates will call |
|
291 | # Before starting the manifest merge, merge.updates will call | |
292 | # _checkunknown to check if there are any files in the merged-in |
|
292 | # _checkunknown to check if there are any files in the merged-in | |
293 | # changeset that collide with unknown files in the working copy. |
|
293 | # changeset that collide with unknown files in the working copy. | |
294 | # |
|
294 | # | |
295 | # The largefiles are seen as unknown, so this prevents us from merging |
|
295 | # The largefiles are seen as unknown, so this prevents us from merging | |
296 | # in a file 'foo' if we already have a largefile with the same name. |
|
296 | # in a file 'foo' if we already have a largefile with the same name. | |
297 | # |
|
297 | # | |
298 | # The overridden function filters the unknown files by removing any |
|
298 | # The overridden function filters the unknown files by removing any | |
299 | # largefiles. This makes the merge proceed and we can then handle this |
|
299 | # largefiles. This makes the merge proceed and we can then handle this | |
300 | # case further in the overridden manifestmerge function below. |
|
300 | # case further in the overridden manifestmerge function below. | |
301 | def overridecheckunknownfile(origfn, repo, wctx, mctx, f): |
|
301 | def overridecheckunknownfile(origfn, repo, wctx, mctx, f): | |
302 | if lfutil.standin(f) in wctx: |
|
302 | if lfutil.standin(f) in wctx: | |
303 | return False |
|
303 | return False | |
304 | return origfn(repo, wctx, mctx, f) |
|
304 | return origfn(repo, wctx, mctx, f) | |
305 |
|
305 | |||
306 | # The manifest merge handles conflicts on the manifest level. We want |
|
306 | # The manifest merge handles conflicts on the manifest level. We want | |
307 | # to handle changes in largefile-ness of files at this level too. |
|
307 | # to handle changes in largefile-ness of files at this level too. | |
308 | # |
|
308 | # | |
309 | # The strategy is to run the original manifestmerge and then process |
|
309 | # The strategy is to run the original manifestmerge and then process | |
310 | # the action list it outputs. There are two cases we need to deal with: |
|
310 | # the action list it outputs. There are two cases we need to deal with: | |
311 | # |
|
311 | # | |
312 | # 1. Normal file in p1, largefile in p2. Here the largefile is |
|
312 | # 1. Normal file in p1, largefile in p2. Here the largefile is | |
313 | # detected via its standin file, which will enter the working copy |
|
313 | # detected via its standin file, which will enter the working copy | |
314 | # with a "get" action. It is not "merge" since the standin is all |
|
314 | # with a "get" action. It is not "merge" since the standin is all | |
315 | # Mercurial is concerned with at this level -- the link to the |
|
315 | # Mercurial is concerned with at this level -- the link to the | |
316 | # existing normal file is not relevant here. |
|
316 | # existing normal file is not relevant here. | |
317 | # |
|
317 | # | |
318 | # 2. Largefile in p1, normal file in p2. Here we get a "merge" action |
|
318 | # 2. Largefile in p1, normal file in p2. Here we get a "merge" action | |
319 | # since the largefile will be present in the working copy and |
|
319 | # since the largefile will be present in the working copy and | |
320 | # different from the normal file in p2. Mercurial therefore |
|
320 | # different from the normal file in p2. Mercurial therefore | |
321 | # triggers a merge action. |
|
321 | # triggers a merge action. | |
322 | # |
|
322 | # | |
323 | # In both cases, we prompt the user and emit new actions to either |
|
323 | # In both cases, we prompt the user and emit new actions to either | |
324 | # remove the standin (if the normal file was kept) or to remove the |
|
324 | # remove the standin (if the normal file was kept) or to remove the | |
325 | # normal file and get the standin (if the largefile was kept). The |
|
325 | # normal file and get the standin (if the largefile was kept). The | |
326 | # default prompt answer is to use the largefile version since it was |
|
326 | # default prompt answer is to use the largefile version since it was | |
327 | # presumably changed on purpose. |
|
327 | # presumably changed on purpose. | |
328 | # |
|
328 | # | |
329 | # Finally, the merge.applyupdates function will then take care of |
|
329 | # Finally, the merge.applyupdates function will then take care of | |
330 | # writing the files into the working copy and lfcommands.updatelfiles |
|
330 | # writing the files into the working copy and lfcommands.updatelfiles | |
331 | # will update the largefiles. |
|
331 | # will update the largefiles. | |
332 | def overridemanifestmerge(origfn, repo, p1, p2, pa, overwrite, partial): |
|
332 | def overridemanifestmerge(origfn, repo, p1, p2, pa, overwrite, partial): | |
333 | actions = origfn(repo, p1, p2, pa, overwrite, partial) |
|
333 | actions = origfn(repo, p1, p2, pa, overwrite, partial) | |
334 | processed = [] |
|
334 | processed = [] | |
335 |
|
335 | |||
336 | for action in actions: |
|
336 | for action in actions: | |
337 | if overwrite: |
|
337 | if overwrite: | |
338 | processed.append(action) |
|
338 | processed.append(action) | |
339 | continue |
|
339 | continue | |
340 | f, m = action[:2] |
|
340 | f, m = action[:2] | |
341 |
|
341 | |||
342 | choices = (_('&Largefile'), _('&Normal file')) |
|
342 | choices = (_('&Largefile'), _('&Normal file')) | |
343 | if m == "g" and lfutil.splitstandin(f) in p1 and f in p2: |
|
343 | if m == "g" and lfutil.splitstandin(f) in p1 and f in p2: | |
344 | # Case 1: normal file in the working copy, largefile in |
|
344 | # Case 1: normal file in the working copy, largefile in | |
345 | # the second parent |
|
345 | # the second parent | |
346 | lfile = lfutil.splitstandin(f) |
|
346 | lfile = lfutil.splitstandin(f) | |
347 | standin = f |
|
347 | standin = f | |
348 | msg = _('%s has been turned into a largefile\n' |
|
348 | msg = _('%s has been turned into a largefile\n' | |
349 | 'use (l)argefile or keep as (n)ormal file?') % lfile |
|
349 | 'use (l)argefile or keep as (n)ormal file?') % lfile | |
350 | if repo.ui.promptchoice(msg, choices, 0) == 0: |
|
350 | if repo.ui.promptchoice(msg, choices, 0) == 0: | |
351 | processed.append((lfile, "r")) |
|
351 | processed.append((lfile, "r")) | |
352 | processed.append((standin, "g", p2.flags(standin))) |
|
352 | processed.append((standin, "g", p2.flags(standin))) | |
353 | else: |
|
353 | else: | |
354 | processed.append((standin, "r")) |
|
354 | processed.append((standin, "r")) | |
355 | elif m == "g" and lfutil.standin(f) in p1 and f in p2: |
|
355 | elif m == "g" and lfutil.standin(f) in p1 and f in p2: | |
356 | # Case 2: largefile in the working copy, normal file in |
|
356 | # Case 2: largefile in the working copy, normal file in | |
357 | # the second parent |
|
357 | # the second parent | |
358 | standin = lfutil.standin(f) |
|
358 | standin = lfutil.standin(f) | |
359 | lfile = f |
|
359 | lfile = f | |
360 | msg = _('%s has been turned into a normal file\n' |
|
360 | msg = _('%s has been turned into a normal file\n' | |
361 | 'keep as (l)argefile or use (n)ormal file?') % lfile |
|
361 | 'keep as (l)argefile or use (n)ormal file?') % lfile | |
362 | if repo.ui.promptchoice(msg, choices, 0) == 0: |
|
362 | if repo.ui.promptchoice(msg, choices, 0) == 0: | |
363 | processed.append((lfile, "r")) |
|
363 | processed.append((lfile, "r")) | |
364 | else: |
|
364 | else: | |
365 | processed.append((standin, "r")) |
|
365 | processed.append((standin, "r")) | |
366 | processed.append((lfile, "g", p2.flags(lfile))) |
|
366 | processed.append((lfile, "g", p2.flags(lfile))) | |
367 | else: |
|
367 | else: | |
368 | processed.append(action) |
|
368 | processed.append(action) | |
369 |
|
369 | |||
370 | return processed |
|
370 | return processed | |
371 |
|
371 | |||
372 | # Override filemerge to prompt the user about how they wish to merge |
|
372 | # Override filemerge to prompt the user about how they wish to merge | |
373 | # largefiles. This will handle identical edits, and copy/rename + |
|
373 | # largefiles. This will handle identical edits, and copy/rename + | |
374 | # edit without prompting the user. |
|
374 | # edit without prompting the user. | |
375 | def overridefilemerge(origfn, repo, mynode, orig, fcd, fco, fca): |
|
375 | def overridefilemerge(origfn, repo, mynode, orig, fcd, fco, fca): | |
376 | # Use better variable names here. Because this is a wrapper we cannot |
|
376 | # Use better variable names here. Because this is a wrapper we cannot | |
377 | # change the variable names in the function declaration. |
|
377 | # change the variable names in the function declaration. | |
378 | fcdest, fcother, fcancestor = fcd, fco, fca |
|
378 | fcdest, fcother, fcancestor = fcd, fco, fca | |
379 | if not lfutil.isstandin(orig): |
|
379 | if not lfutil.isstandin(orig): | |
380 | return origfn(repo, mynode, orig, fcdest, fcother, fcancestor) |
|
380 | return origfn(repo, mynode, orig, fcdest, fcother, fcancestor) | |
381 | else: |
|
381 | else: | |
382 | if not fcother.cmp(fcdest): # files identical? |
|
382 | if not fcother.cmp(fcdest): # files identical? | |
383 | return None |
|
383 | return None | |
384 |
|
384 | |||
385 | # backwards, use working dir parent as ancestor |
|
385 | # backwards, use working dir parent as ancestor | |
386 | if fcancestor == fcother: |
|
386 | if fcancestor == fcother: | |
387 | fcancestor = fcdest.parents()[0] |
|
387 | fcancestor = fcdest.parents()[0] | |
388 |
|
388 | |||
389 | if orig != fcother.path(): |
|
389 | if orig != fcother.path(): | |
390 | repo.ui.status(_('merging %s and %s to %s\n') |
|
390 | repo.ui.status(_('merging %s and %s to %s\n') | |
391 | % (lfutil.splitstandin(orig), |
|
391 | % (lfutil.splitstandin(orig), | |
392 | lfutil.splitstandin(fcother.path()), |
|
392 | lfutil.splitstandin(fcother.path()), | |
393 | lfutil.splitstandin(fcdest.path()))) |
|
393 | lfutil.splitstandin(fcdest.path()))) | |
394 | else: |
|
394 | else: | |
395 | repo.ui.status(_('merging %s\n') |
|
395 | repo.ui.status(_('merging %s\n') | |
396 | % lfutil.splitstandin(fcdest.path())) |
|
396 | % lfutil.splitstandin(fcdest.path())) | |
397 |
|
397 | |||
398 | if fcancestor.path() != fcother.path() and fcother.data() == \ |
|
398 | if fcancestor.path() != fcother.path() and fcother.data() == \ | |
399 | fcancestor.data(): |
|
399 | fcancestor.data(): | |
400 | return 0 |
|
400 | return 0 | |
401 | if fcancestor.path() != fcdest.path() and fcdest.data() == \ |
|
401 | if fcancestor.path() != fcdest.path() and fcdest.data() == \ | |
402 | fcancestor.data(): |
|
402 | fcancestor.data(): | |
403 | repo.wwrite(fcdest.path(), fcother.data(), fcother.flags()) |
|
403 | repo.wwrite(fcdest.path(), fcother.data(), fcother.flags()) | |
404 | return 0 |
|
404 | return 0 | |
405 |
|
405 | |||
406 | if repo.ui.promptchoice(_('largefile %s has a merge conflict\n' |
|
406 | if repo.ui.promptchoice(_('largefile %s has a merge conflict\n' | |
407 | 'keep (l)ocal or take (o)ther?') % |
|
407 | 'keep (l)ocal or take (o)ther?') % | |
408 | lfutil.splitstandin(orig), |
|
408 | lfutil.splitstandin(orig), | |
409 | (_('&Local'), _('&Other')), 0) == 0: |
|
409 | (_('&Local'), _('&Other')), 0) == 0: | |
410 | return 0 |
|
410 | return 0 | |
411 | else: |
|
411 | else: | |
412 | repo.wwrite(fcdest.path(), fcother.data(), fcother.flags()) |
|
412 | repo.wwrite(fcdest.path(), fcother.data(), fcother.flags()) | |
413 | return 0 |
|
413 | return 0 | |
414 |
|
414 | |||
415 | # Copy first changes the matchers to match standins instead of |
|
415 | # Copy first changes the matchers to match standins instead of | |
416 | # largefiles. Then it overrides util.copyfile in that function it |
|
416 | # largefiles. Then it overrides util.copyfile in that function it | |
417 | # checks if the destination largefile already exists. It also keeps a |
|
417 | # checks if the destination largefile already exists. It also keeps a | |
418 | # list of copied files so that the largefiles can be copied and the |
|
418 | # list of copied files so that the largefiles can be copied and the | |
419 | # dirstate updated. |
|
419 | # dirstate updated. | |
420 | def overridecopy(orig, ui, repo, pats, opts, rename=False): |
|
420 | def overridecopy(orig, ui, repo, pats, opts, rename=False): | |
421 | # doesn't remove largefile on rename |
|
421 | # doesn't remove largefile on rename | |
422 | if len(pats) < 2: |
|
422 | if len(pats) < 2: | |
423 | # this isn't legal, let the original function deal with it |
|
423 | # this isn't legal, let the original function deal with it | |
424 | return orig(ui, repo, pats, opts, rename) |
|
424 | return orig(ui, repo, pats, opts, rename) | |
425 |
|
425 | |||
426 | def makestandin(relpath): |
|
426 | def makestandin(relpath): | |
427 | path = scmutil.canonpath(repo.root, repo.getcwd(), relpath) |
|
427 | path = scmutil.canonpath(repo.root, repo.getcwd(), relpath) | |
428 | return os.path.join(repo.wjoin(lfutil.standin(path))) |
|
428 | return os.path.join(repo.wjoin(lfutil.standin(path))) | |
429 |
|
429 | |||
430 | fullpats = scmutil.expandpats(pats) |
|
430 | fullpats = scmutil.expandpats(pats) | |
431 | dest = fullpats[-1] |
|
431 | dest = fullpats[-1] | |
432 |
|
432 | |||
433 | if os.path.isdir(dest): |
|
433 | if os.path.isdir(dest): | |
434 | if not os.path.isdir(makestandin(dest)): |
|
434 | if not os.path.isdir(makestandin(dest)): | |
435 | os.makedirs(makestandin(dest)) |
|
435 | os.makedirs(makestandin(dest)) | |
436 | # This could copy both lfiles and normal files in one command, |
|
436 | # This could copy both lfiles and normal files in one command, | |
437 | # but we don't want to do that. First replace their matcher to |
|
437 | # but we don't want to do that. First replace their matcher to | |
438 | # only match normal files and run it, then replace it to just |
|
438 | # only match normal files and run it, then replace it to just | |
439 | # match largefiles and run it again. |
|
439 | # match largefiles and run it again. | |
440 | nonormalfiles = False |
|
440 | nonormalfiles = False | |
441 | nolfiles = False |
|
441 | nolfiles = False | |
442 | try: |
|
442 | try: | |
443 | try: |
|
443 | try: | |
444 | installnormalfilesmatchfn(repo[None].manifest()) |
|
444 | installnormalfilesmatchfn(repo[None].manifest()) | |
445 | result = orig(ui, repo, pats, opts, rename) |
|
445 | result = orig(ui, repo, pats, opts, rename) | |
446 | except util.Abort, e: |
|
446 | except util.Abort, e: | |
447 | if str(e) != _('no files to copy'): |
|
447 | if str(e) != _('no files to copy'): | |
448 | raise e |
|
448 | raise e | |
449 | else: |
|
449 | else: | |
450 | nonormalfiles = True |
|
450 | nonormalfiles = True | |
451 | result = 0 |
|
451 | result = 0 | |
452 | finally: |
|
452 | finally: | |
453 | restorematchfn() |
|
453 | restorematchfn() | |
454 |
|
454 | |||
455 | # The first rename can cause our current working directory to be removed. |
|
455 | # The first rename can cause our current working directory to be removed. | |
456 | # In that case there is nothing left to copy/rename so just quit. |
|
456 | # In that case there is nothing left to copy/rename so just quit. | |
457 | try: |
|
457 | try: | |
458 | repo.getcwd() |
|
458 | repo.getcwd() | |
459 | except OSError: |
|
459 | except OSError: | |
460 | return result |
|
460 | return result | |
461 |
|
461 | |||
462 | try: |
|
462 | try: | |
463 | try: |
|
463 | try: | |
464 | # When we call orig below it creates the standins but we don't add |
|
464 | # When we call orig below it creates the standins but we don't add | |
465 | # them to the dir state until later so lock during that time. |
|
465 | # them to the dir state until later so lock during that time. | |
466 | wlock = repo.wlock() |
|
466 | wlock = repo.wlock() | |
467 |
|
467 | |||
468 | manifest = repo[None].manifest() |
|
468 | manifest = repo[None].manifest() | |
469 | oldmatch = None # for the closure |
|
469 | oldmatch = None # for the closure | |
470 | def overridematch(ctx, pats=[], opts={}, globbed=False, |
|
470 | def overridematch(ctx, pats=[], opts={}, globbed=False, | |
471 | default='relpath'): |
|
471 | default='relpath'): | |
472 | newpats = [] |
|
472 | newpats = [] | |
473 | # The patterns were previously mangled to add the standin |
|
473 | # The patterns were previously mangled to add the standin | |
474 | # directory; we need to remove that now |
|
474 | # directory; we need to remove that now | |
475 | for pat in pats: |
|
475 | for pat in pats: | |
476 | if match_.patkind(pat) is None and lfutil.shortname in pat: |
|
476 | if match_.patkind(pat) is None and lfutil.shortname in pat: | |
477 | newpats.append(pat.replace(lfutil.shortname, '')) |
|
477 | newpats.append(pat.replace(lfutil.shortname, '')) | |
478 | else: |
|
478 | else: | |
479 | newpats.append(pat) |
|
479 | newpats.append(pat) | |
480 | match = oldmatch(ctx, newpats, opts, globbed, default) |
|
480 | match = oldmatch(ctx, newpats, opts, globbed, default) | |
481 | m = copy.copy(match) |
|
481 | m = copy.copy(match) | |
482 | lfile = lambda f: lfutil.standin(f) in manifest |
|
482 | lfile = lambda f: lfutil.standin(f) in manifest | |
483 | m._files = [lfutil.standin(f) for f in m._files if lfile(f)] |
|
483 | m._files = [lfutil.standin(f) for f in m._files if lfile(f)] | |
484 | m._fmap = set(m._files) |
|
484 | m._fmap = set(m._files) | |
485 | origmatchfn = m.matchfn |
|
485 | origmatchfn = m.matchfn | |
486 | m.matchfn = lambda f: (lfutil.isstandin(f) and |
|
486 | m.matchfn = lambda f: (lfutil.isstandin(f) and | |
487 | (f in manifest) and |
|
487 | (f in manifest) and | |
488 | origmatchfn(lfutil.splitstandin(f)) or |
|
488 | origmatchfn(lfutil.splitstandin(f)) or | |
489 | None) |
|
489 | None) | |
490 | return m |
|
490 | return m | |
491 | oldmatch = installmatchfn(overridematch) |
|
491 | oldmatch = installmatchfn(overridematch) | |
492 | listpats = [] |
|
492 | listpats = [] | |
493 | for pat in pats: |
|
493 | for pat in pats: | |
494 | if match_.patkind(pat) is not None: |
|
494 | if match_.patkind(pat) is not None: | |
495 | listpats.append(pat) |
|
495 | listpats.append(pat) | |
496 | else: |
|
496 | else: | |
497 | listpats.append(makestandin(pat)) |
|
497 | listpats.append(makestandin(pat)) | |
498 |
|
498 | |||
499 | try: |
|
499 | try: | |
500 | origcopyfile = util.copyfile |
|
500 | origcopyfile = util.copyfile | |
501 | copiedfiles = [] |
|
501 | copiedfiles = [] | |
502 | def overridecopyfile(src, dest): |
|
502 | def overridecopyfile(src, dest): | |
503 | if (lfutil.shortname in src and |
|
503 | if (lfutil.shortname in src and | |
504 | dest.startswith(repo.wjoin(lfutil.shortname))): |
|
504 | dest.startswith(repo.wjoin(lfutil.shortname))): | |
505 | destlfile = dest.replace(lfutil.shortname, '') |
|
505 | destlfile = dest.replace(lfutil.shortname, '') | |
506 | if not opts['force'] and os.path.exists(destlfile): |
|
506 | if not opts['force'] and os.path.exists(destlfile): | |
507 | raise IOError('', |
|
507 | raise IOError('', | |
508 | _('destination largefile already exists')) |
|
508 | _('destination largefile already exists')) | |
509 | copiedfiles.append((src, dest)) |
|
509 | copiedfiles.append((src, dest)) | |
510 | origcopyfile(src, dest) |
|
510 | origcopyfile(src, dest) | |
511 |
|
511 | |||
512 | util.copyfile = overridecopyfile |
|
512 | util.copyfile = overridecopyfile | |
513 | result += orig(ui, repo, listpats, opts, rename) |
|
513 | result += orig(ui, repo, listpats, opts, rename) | |
514 | finally: |
|
514 | finally: | |
515 | util.copyfile = origcopyfile |
|
515 | util.copyfile = origcopyfile | |
516 |
|
516 | |||
517 | lfdirstate = lfutil.openlfdirstate(ui, repo) |
|
517 | lfdirstate = lfutil.openlfdirstate(ui, repo) | |
518 | for (src, dest) in copiedfiles: |
|
518 | for (src, dest) in copiedfiles: | |
519 | if (lfutil.shortname in src and |
|
519 | if (lfutil.shortname in src and | |
520 | dest.startswith(repo.wjoin(lfutil.shortname))): |
|
520 | dest.startswith(repo.wjoin(lfutil.shortname))): | |
521 | srclfile = src.replace(repo.wjoin(lfutil.standin('')), '') |
|
521 | srclfile = src.replace(repo.wjoin(lfutil.standin('')), '') | |
522 | destlfile = dest.replace(repo.wjoin(lfutil.standin('')), '') |
|
522 | destlfile = dest.replace(repo.wjoin(lfutil.standin('')), '') | |
523 | destlfiledir = os.path.dirname(repo.wjoin(destlfile)) or '.' |
|
523 | destlfiledir = os.path.dirname(repo.wjoin(destlfile)) or '.' | |
524 | if not os.path.isdir(destlfiledir): |
|
524 | if not os.path.isdir(destlfiledir): | |
525 | os.makedirs(destlfiledir) |
|
525 | os.makedirs(destlfiledir) | |
526 | if rename: |
|
526 | if rename: | |
527 | os.rename(repo.wjoin(srclfile), repo.wjoin(destlfile)) |
|
527 | os.rename(repo.wjoin(srclfile), repo.wjoin(destlfile)) | |
528 | lfdirstate.remove(srclfile) |
|
528 | lfdirstate.remove(srclfile) | |
529 | else: |
|
529 | else: | |
530 | util.copyfile(repo.wjoin(srclfile), |
|
530 | util.copyfile(repo.wjoin(srclfile), | |
531 | repo.wjoin(destlfile)) |
|
531 | repo.wjoin(destlfile)) | |
532 |
|
532 | |||
533 | lfdirstate.add(destlfile) |
|
533 | lfdirstate.add(destlfile) | |
534 | lfdirstate.write() |
|
534 | lfdirstate.write() | |
535 | except util.Abort, e: |
|
535 | except util.Abort, e: | |
536 | if str(e) != _('no files to copy'): |
|
536 | if str(e) != _('no files to copy'): | |
537 | raise e |
|
537 | raise e | |
538 | else: |
|
538 | else: | |
539 | nolfiles = True |
|
539 | nolfiles = True | |
540 | finally: |
|
540 | finally: | |
541 | restorematchfn() |
|
541 | restorematchfn() | |
542 | wlock.release() |
|
542 | wlock.release() | |
543 |
|
543 | |||
544 | if nolfiles and nonormalfiles: |
|
544 | if nolfiles and nonormalfiles: | |
545 | raise util.Abort(_('no files to copy')) |
|
545 | raise util.Abort(_('no files to copy')) | |
546 |
|
546 | |||
547 | return result |
|
547 | return result | |
548 |
|
548 | |||
549 | # When the user calls revert, we have to be careful to not revert any |
|
549 | # When the user calls revert, we have to be careful to not revert any | |
550 | # changes to other largefiles accidentally. This means we have to keep |
|
550 | # changes to other largefiles accidentally. This means we have to keep | |
551 | # track of the largefiles that are being reverted so we only pull down |
|
551 | # track of the largefiles that are being reverted so we only pull down | |
552 | # the necessary largefiles. |
|
552 | # the necessary largefiles. | |
553 | # |
|
553 | # | |
554 | # Standins are only updated (to match the hash of largefiles) before |
|
554 | # Standins are only updated (to match the hash of largefiles) before | |
555 | # commits. Update the standins then run the original revert, changing |
|
555 | # commits. Update the standins then run the original revert, changing | |
556 | # the matcher to hit standins instead of largefiles. Based on the |
|
556 | # the matcher to hit standins instead of largefiles. Based on the | |
557 | # resulting standins update the largefiles. Then return the standins |
|
557 | # resulting standins update the largefiles. Then return the standins | |
558 | # to their proper state |
|
558 | # to their proper state | |
559 | def overriderevert(orig, ui, repo, *pats, **opts): |
|
559 | def overriderevert(orig, ui, repo, *pats, **opts): | |
560 | # Because we put the standins in a bad state (by updating them) |
|
560 | # Because we put the standins in a bad state (by updating them) | |
561 | # and then return them to a correct state we need to lock to |
|
561 | # and then return them to a correct state we need to lock to | |
562 | # prevent others from changing them in their incorrect state. |
|
562 | # prevent others from changing them in their incorrect state. | |
563 | wlock = repo.wlock() |
|
563 | wlock = repo.wlock() | |
564 | try: |
|
564 | try: | |
565 | lfdirstate = lfutil.openlfdirstate(ui, repo) |
|
565 | lfdirstate = lfutil.openlfdirstate(ui, repo) | |
566 | (modified, added, removed, missing, unknown, ignored, clean) = \ |
|
566 | (modified, added, removed, missing, unknown, ignored, clean) = \ | |
567 | lfutil.lfdirstatestatus(lfdirstate, repo, repo['.'].rev()) |
|
567 | lfutil.lfdirstatestatus(lfdirstate, repo, repo['.'].rev()) | |
568 | for lfile in modified: |
|
568 | for lfile in modified: | |
569 | lfutil.updatestandin(repo, lfutil.standin(lfile)) |
|
569 | lfutil.updatestandin(repo, lfutil.standin(lfile)) | |
570 | for lfile in missing: |
|
570 | for lfile in missing: | |
571 | if (os.path.exists(repo.wjoin(lfutil.standin(lfile)))): |
|
571 | if (os.path.exists(repo.wjoin(lfutil.standin(lfile)))): | |
572 | os.unlink(repo.wjoin(lfutil.standin(lfile))) |
|
572 | os.unlink(repo.wjoin(lfutil.standin(lfile))) | |
573 |
|
573 | |||
574 | try: |
|
574 | try: | |
575 | ctx = scmutil.revsingle(repo, opts.get('rev')) |
|
575 | ctx = scmutil.revsingle(repo, opts.get('rev')) | |
576 | oldmatch = None # for the closure |
|
576 | oldmatch = None # for the closure | |
577 | def overridematch(ctx, pats=[], opts={}, globbed=False, |
|
577 | def overridematch(ctx, pats=[], opts={}, globbed=False, | |
578 | default='relpath'): |
|
578 | default='relpath'): | |
579 | match = oldmatch(ctx, pats, opts, globbed, default) |
|
579 | match = oldmatch(ctx, pats, opts, globbed, default) | |
580 | m = copy.copy(match) |
|
580 | m = copy.copy(match) | |
581 | def tostandin(f): |
|
581 | def tostandin(f): | |
582 | if lfutil.standin(f) in ctx: |
|
582 | if lfutil.standin(f) in ctx: | |
583 | return lfutil.standin(f) |
|
583 | return lfutil.standin(f) | |
584 | elif lfutil.standin(f) in repo[None]: |
|
584 | elif lfutil.standin(f) in repo[None]: | |
585 | return None |
|
585 | return None | |
586 | return f |
|
586 | return f | |
587 | m._files = [tostandin(f) for f in m._files] |
|
587 | m._files = [tostandin(f) for f in m._files] | |
588 | m._files = [f for f in m._files if f is not None] |
|
588 | m._files = [f for f in m._files if f is not None] | |
589 | m._fmap = set(m._files) |
|
589 | m._fmap = set(m._files) | |
590 | origmatchfn = m.matchfn |
|
590 | origmatchfn = m.matchfn | |
591 | def matchfn(f): |
|
591 | def matchfn(f): | |
592 | if lfutil.isstandin(f): |
|
592 | if lfutil.isstandin(f): | |
593 | # We need to keep track of what largefiles are being |
|
593 | # We need to keep track of what largefiles are being | |
594 | # matched so we know which ones to update later -- |
|
594 | # matched so we know which ones to update later -- | |
595 | # otherwise we accidentally revert changes to other |
|
595 | # otherwise we accidentally revert changes to other | |
596 | # largefiles. This is repo-specific, so duckpunch the |
|
596 | # largefiles. This is repo-specific, so duckpunch the | |
597 | # repo object to keep the list of largefiles for us |
|
597 | # repo object to keep the list of largefiles for us | |
598 | # later. |
|
598 | # later. | |
599 | if origmatchfn(lfutil.splitstandin(f)) and \ |
|
599 | if origmatchfn(lfutil.splitstandin(f)) and \ | |
600 | (f in repo[None] or f in ctx): |
|
600 | (f in repo[None] or f in ctx): | |
601 | lfileslist = getattr(repo, '_lfilestoupdate', []) |
|
601 | lfileslist = getattr(repo, '_lfilestoupdate', []) | |
602 | lfileslist.append(lfutil.splitstandin(f)) |
|
602 | lfileslist.append(lfutil.splitstandin(f)) | |
603 | repo._lfilestoupdate = lfileslist |
|
603 | repo._lfilestoupdate = lfileslist | |
604 | return True |
|
604 | return True | |
605 | else: |
|
605 | else: | |
606 | return False |
|
606 | return False | |
607 | return origmatchfn(f) |
|
607 | return origmatchfn(f) | |
608 | m.matchfn = matchfn |
|
608 | m.matchfn = matchfn | |
609 | return m |
|
609 | return m | |
610 | oldmatch = installmatchfn(overridematch) |
|
610 | oldmatch = installmatchfn(overridematch) | |
611 | scmutil.match |
|
611 | scmutil.match | |
612 | matches = overridematch(repo[None], pats, opts) |
|
612 | matches = overridematch(repo[None], pats, opts) | |
613 | orig(ui, repo, *pats, **opts) |
|
613 | orig(ui, repo, *pats, **opts) | |
614 | finally: |
|
614 | finally: | |
615 | restorematchfn() |
|
615 | restorematchfn() | |
616 | lfileslist = getattr(repo, '_lfilestoupdate', []) |
|
616 | lfileslist = getattr(repo, '_lfilestoupdate', []) | |
617 | lfcommands.updatelfiles(ui, repo, filelist=lfileslist, |
|
617 | lfcommands.updatelfiles(ui, repo, filelist=lfileslist, | |
618 | printmessage=False) |
|
618 | printmessage=False) | |
619 |
|
619 | |||
620 | # empty out the largefiles list so we start fresh next time |
|
620 | # empty out the largefiles list so we start fresh next time | |
621 | repo._lfilestoupdate = [] |
|
621 | repo._lfilestoupdate = [] | |
622 | for lfile in modified: |
|
622 | for lfile in modified: | |
623 | if lfile in lfileslist: |
|
623 | if lfile in lfileslist: | |
624 | if os.path.exists(repo.wjoin(lfutil.standin(lfile))) and lfile\ |
|
624 | if os.path.exists(repo.wjoin(lfutil.standin(lfile))) and lfile\ | |
625 | in repo['.']: |
|
625 | in repo['.']: | |
626 | lfutil.writestandin(repo, lfutil.standin(lfile), |
|
626 | lfutil.writestandin(repo, lfutil.standin(lfile), | |
627 | repo['.'][lfile].data().strip(), |
|
627 | repo['.'][lfile].data().strip(), | |
628 | 'x' in repo['.'][lfile].flags()) |
|
628 | 'x' in repo['.'][lfile].flags()) | |
629 | lfdirstate = lfutil.openlfdirstate(ui, repo) |
|
629 | lfdirstate = lfutil.openlfdirstate(ui, repo) | |
630 | for lfile in added: |
|
630 | for lfile in added: | |
631 | standin = lfutil.standin(lfile) |
|
631 | standin = lfutil.standin(lfile) | |
632 | if standin not in ctx and (standin in matches or opts.get('all')): |
|
632 | if standin not in ctx and (standin in matches or opts.get('all')): | |
633 | if lfile in lfdirstate: |
|
633 | if lfile in lfdirstate: | |
634 | lfdirstate.drop(lfile) |
|
634 | lfdirstate.drop(lfile) | |
635 | util.unlinkpath(repo.wjoin(standin)) |
|
635 | util.unlinkpath(repo.wjoin(standin)) | |
636 | lfdirstate.write() |
|
636 | lfdirstate.write() | |
637 | finally: |
|
637 | finally: | |
638 | wlock.release() |
|
638 | wlock.release() | |
639 |
|
639 | |||
640 | def hgupdate(orig, repo, node): |
|
640 | def hgupdate(orig, repo, node): | |
641 | # Only call updatelfiles the standins that have changed to save time |
|
641 | # Only call updatelfiles the standins that have changed to save time | |
642 | oldstandins = lfutil.getstandinsstate(repo) |
|
642 | oldstandins = lfutil.getstandinsstate(repo) | |
643 | result = orig(repo, node) |
|
643 | result = orig(repo, node) | |
644 | newstandins = lfutil.getstandinsstate(repo) |
|
644 | newstandins = lfutil.getstandinsstate(repo) | |
645 | filelist = lfutil.getlfilestoupdate(oldstandins, newstandins) |
|
645 | filelist = lfutil.getlfilestoupdate(oldstandins, newstandins) | |
646 | lfcommands.updatelfiles(repo.ui, repo, filelist=filelist, printmessage=True) |
|
646 | lfcommands.updatelfiles(repo.ui, repo, filelist=filelist, printmessage=True) | |
647 | return result |
|
647 | return result | |
648 |
|
648 | |||
649 | def hgclean(orig, repo, node, show_stats=True): |
|
649 | def hgclean(orig, repo, node, show_stats=True): | |
650 | result = orig(repo, node, show_stats) |
|
650 | result = orig(repo, node, show_stats) | |
651 | lfcommands.updatelfiles(repo.ui, repo) |
|
651 | lfcommands.updatelfiles(repo.ui, repo) | |
652 | return result |
|
652 | return result | |
653 |
|
653 | |||
654 | def hgmerge(orig, repo, node, force=None, remind=True): |
|
654 | def hgmerge(orig, repo, node, force=None, remind=True): | |
655 | # Mark the repo as being in the middle of a merge, so that |
|
655 | # Mark the repo as being in the middle of a merge, so that | |
656 | # updatelfiles() will know that it needs to trust the standins in |
|
656 | # updatelfiles() will know that it needs to trust the standins in | |
657 | # the working copy, not in the standins in the current node |
|
657 | # the working copy, not in the standins in the current node | |
658 | repo._ismerging = True |
|
658 | repo._ismerging = True | |
659 | try: |
|
659 | try: | |
660 | result = orig(repo, node, force, remind) |
|
660 | result = orig(repo, node, force, remind) | |
661 | lfcommands.updatelfiles(repo.ui, repo) |
|
661 | lfcommands.updatelfiles(repo.ui, repo) | |
662 | finally: |
|
662 | finally: | |
663 | repo._ismerging = False |
|
663 | repo._ismerging = False | |
664 | return result |
|
664 | return result | |
665 |
|
665 | |||
666 | # When we rebase a repository with remotely changed largefiles, we need to |
|
666 | # When we rebase a repository with remotely changed largefiles, we need to | |
667 | # take some extra care so that the largefiles are correctly updated in the |
|
667 | # take some extra care so that the largefiles are correctly updated in the | |
668 | # working copy |
|
668 | # working copy | |
669 | def overridepull(orig, ui, repo, source=None, **opts): |
|
669 | def overridepull(orig, ui, repo, source=None, **opts): | |
670 | revsprepull = len(repo) |
|
670 | revsprepull = len(repo) | |
671 | if opts.get('rebase', False): |
|
671 | if opts.get('rebase', False): | |
672 | repo._isrebasing = True |
|
672 | repo._isrebasing = True | |
673 | try: |
|
673 | try: | |
674 | if opts.get('update'): |
|
674 | if opts.get('update'): | |
675 | del opts['update'] |
|
675 | del opts['update'] | |
676 | ui.debug('--update and --rebase are not compatible, ignoring ' |
|
676 | ui.debug('--update and --rebase are not compatible, ignoring ' | |
677 | 'the update flag\n') |
|
677 | 'the update flag\n') | |
678 | del opts['rebase'] |
|
678 | del opts['rebase'] | |
679 | cmdutil.bailifchanged(repo) |
|
679 | cmdutil.bailifchanged(repo) | |
680 | origpostincoming = commands.postincoming |
|
680 | origpostincoming = commands.postincoming | |
681 | def _dummy(*args, **kwargs): |
|
681 | def _dummy(*args, **kwargs): | |
682 | pass |
|
682 | pass | |
683 | commands.postincoming = _dummy |
|
683 | commands.postincoming = _dummy | |
684 | repo.lfpullsource = source |
|
684 | repo.lfpullsource = source | |
685 | if not source: |
|
685 | if not source: | |
686 | source = 'default' |
|
686 | source = 'default' | |
687 | try: |
|
687 | try: | |
688 | result = commands.pull(ui, repo, source, **opts) |
|
688 | result = commands.pull(ui, repo, source, **opts) | |
689 | finally: |
|
689 | finally: | |
690 | commands.postincoming = origpostincoming |
|
690 | commands.postincoming = origpostincoming | |
691 | revspostpull = len(repo) |
|
691 | revspostpull = len(repo) | |
692 | if revspostpull > revsprepull: |
|
692 | if revspostpull > revsprepull: | |
693 | result = result or rebase.rebase(ui, repo) |
|
693 | result = result or rebase.rebase(ui, repo) | |
694 | finally: |
|
694 | finally: | |
695 | repo._isrebasing = False |
|
695 | repo._isrebasing = False | |
696 | else: |
|
696 | else: | |
697 | repo.lfpullsource = source |
|
697 | repo.lfpullsource = source | |
698 | if not source: |
|
698 | if not source: | |
699 | source = 'default' |
|
699 | source = 'default' | |
700 | oldheads = lfutil.getcurrentheads(repo) |
|
700 | oldheads = lfutil.getcurrentheads(repo) | |
701 | result = orig(ui, repo, source, **opts) |
|
701 | result = orig(ui, repo, source, **opts) | |
702 | # If we do not have the new largefiles for any new heads we pulled, we |
|
702 | # If we do not have the new largefiles for any new heads we pulled, we | |
703 | # will run into a problem later if we try to merge or rebase with one of |
|
703 | # will run into a problem later if we try to merge or rebase with one of | |
704 | # these heads, so cache the largefiles now directly into the system |
|
704 | # these heads, so cache the largefiles now directly into the system | |
705 | # cache. |
|
705 | # cache. | |
706 | ui.status(_("caching new largefiles\n")) |
|
706 | ui.status(_("caching new largefiles\n")) | |
707 | numcached = 0 |
|
707 | numcached = 0 | |
708 | heads = lfutil.getcurrentheads(repo) |
|
708 | heads = lfutil.getcurrentheads(repo) | |
709 | newheads = set(heads).difference(set(oldheads)) |
|
709 | newheads = set(heads).difference(set(oldheads)) | |
710 | for head in newheads: |
|
710 | for head in newheads: | |
711 | (cached, missing) = lfcommands.cachelfiles(ui, repo, head) |
|
711 | (cached, missing) = lfcommands.cachelfiles(ui, repo, head) | |
712 | numcached += len(cached) |
|
712 | numcached += len(cached) | |
713 | ui.status(_("%d largefiles cached\n") % numcached) |
|
713 | ui.status(_("%d largefiles cached\n") % numcached) | |
714 | if opts.get('all_largefiles'): |
|
714 | if opts.get('all_largefiles'): | |
715 | revspostpull = len(repo) |
|
715 | revspostpull = len(repo) | |
716 | revs = [] |
|
716 | revs = [] | |
717 | for rev in xrange(revsprepull + 1, revspostpull): |
|
717 | for rev in xrange(revsprepull + 1, revspostpull): | |
718 | revs.append(repo[rev].rev()) |
|
718 | revs.append(repo[rev].rev()) | |
719 | lfcommands.downloadlfiles(ui, repo, revs) |
|
719 | lfcommands.downloadlfiles(ui, repo, revs) | |
720 | return result |
|
720 | return result | |
721 |
|
721 | |||
722 | def overrideclone(orig, ui, source, dest=None, **opts): |
|
722 | def overrideclone(orig, ui, source, dest=None, **opts): | |
723 | d = dest |
|
723 | d = dest | |
724 | if d is None: |
|
724 | if d is None: | |
725 | d = hg.defaultdest(source) |
|
725 | d = hg.defaultdest(source) | |
726 | if opts.get('all_largefiles') and not hg.islocal(d): |
|
726 | if opts.get('all_largefiles') and not hg.islocal(d): | |
727 | raise util.Abort(_( |
|
727 | raise util.Abort(_( | |
728 | '--all-largefiles is incompatible with non-local destination %s' % |
|
728 | '--all-largefiles is incompatible with non-local destination %s' % | |
729 | d)) |
|
729 | d)) | |
730 |
|
730 | |||
731 | return orig(ui, source, dest, **opts) |
|
731 | return orig(ui, source, dest, **opts) | |
732 |
|
732 | |||
733 | def hgclone(orig, ui, opts, *args, **kwargs): |
|
733 | def hgclone(orig, ui, opts, *args, **kwargs): | |
734 | result = orig(ui, opts, *args, **kwargs) |
|
734 | result = orig(ui, opts, *args, **kwargs) | |
735 |
|
735 | |||
736 | if result is not None: |
|
736 | if result is not None: | |
737 | sourcerepo, destrepo = result |
|
737 | sourcerepo, destrepo = result | |
738 | repo = destrepo.local() |
|
738 | repo = destrepo.local() | |
739 |
|
739 | |||
740 | # The .hglf directory must exist for the standin matcher to match |
|
740 | # The .hglf directory must exist for the standin matcher to match | |
741 | # anything (which listlfiles uses for each rev), and .hg/largefiles is |
|
741 | # anything (which listlfiles uses for each rev), and .hg/largefiles is | |
742 | # assumed to exist by the code that caches the downloaded file. These |
|
742 | # assumed to exist by the code that caches the downloaded file. These | |
743 | # directories exist if clone updated to any rev. (If the repo does not |
|
743 | # directories exist if clone updated to any rev. (If the repo does not | |
744 | # have largefiles, download never gets to the point of needing |
|
744 | # have largefiles, download never gets to the point of needing | |
745 | # .hg/largefiles, and the standin matcher won't match anything anyway.) |
|
745 | # .hg/largefiles, and the standin matcher won't match anything anyway.) | |
746 | if 'largefiles' in repo.requirements: |
|
746 | if 'largefiles' in repo.requirements: | |
747 | if opts.get('noupdate'): |
|
747 | if opts.get('noupdate'): | |
748 | util.makedirs(repo.pathto(lfutil.shortname)) |
|
748 | util.makedirs(repo.pathto(lfutil.shortname)) | |
749 | util.makedirs(repo.join(lfutil.longname)) |
|
749 | util.makedirs(repo.join(lfutil.longname)) | |
750 |
|
750 | |||
751 | # Caching is implicitly limited to 'rev' option, since the dest repo was |
|
751 | # Caching is implicitly limited to 'rev' option, since the dest repo was | |
752 | # truncated at that point. The user may expect a download count with |
|
752 | # truncated at that point. The user may expect a download count with | |
753 | # this option, so attempt whether or not this is a largefile repo. |
|
753 | # this option, so attempt whether or not this is a largefile repo. | |
754 | if opts.get('all_largefiles'): |
|
754 | if opts.get('all_largefiles'): | |
755 | success, missing = lfcommands.downloadlfiles(ui, repo, None) |
|
755 | success, missing = lfcommands.downloadlfiles(ui, repo, None) | |
756 |
|
756 | |||
757 | if missing != 0: |
|
757 | if missing != 0: | |
758 | return None |
|
758 | return None | |
759 |
|
759 | |||
760 | return result |
|
760 | return result | |
761 |
|
761 | |||
762 | def overriderebase(orig, ui, repo, **opts): |
|
762 | def overriderebase(orig, ui, repo, **opts): | |
763 | repo._isrebasing = True |
|
763 | repo._isrebasing = True | |
764 | try: |
|
764 | try: | |
765 | return orig(ui, repo, **opts) |
|
765 | return orig(ui, repo, **opts) | |
766 | finally: |
|
766 | finally: | |
767 | repo._isrebasing = False |
|
767 | repo._isrebasing = False | |
768 |
|
768 | |||
769 | def overridearchive(orig, repo, dest, node, kind, decode=True, matchfn=None, |
|
769 | def overridearchive(orig, repo, dest, node, kind, decode=True, matchfn=None, | |
770 | prefix=None, mtime=None, subrepos=None): |
|
770 | prefix=None, mtime=None, subrepos=None): | |
771 | # No need to lock because we are only reading history and |
|
771 | # No need to lock because we are only reading history and | |
772 | # largefile caches, neither of which are modified. |
|
772 | # largefile caches, neither of which are modified. | |
773 | lfcommands.cachelfiles(repo.ui, repo, node) |
|
773 | lfcommands.cachelfiles(repo.ui, repo, node) | |
774 |
|
774 | |||
775 | if kind not in archival.archivers: |
|
775 | if kind not in archival.archivers: | |
776 | raise util.Abort(_("unknown archive type '%s'") % kind) |
|
776 | raise util.Abort(_("unknown archive type '%s'") % kind) | |
777 |
|
777 | |||
778 | ctx = repo[node] |
|
778 | ctx = repo[node] | |
779 |
|
779 | |||
780 | if kind == 'files': |
|
780 | if kind == 'files': | |
781 | if prefix: |
|
781 | if prefix: | |
782 | raise util.Abort( |
|
782 | raise util.Abort( | |
783 | _('cannot give prefix when archiving to files')) |
|
783 | _('cannot give prefix when archiving to files')) | |
784 | else: |
|
784 | else: | |
785 | prefix = archival.tidyprefix(dest, kind, prefix) |
|
785 | prefix = archival.tidyprefix(dest, kind, prefix) | |
786 |
|
786 | |||
787 | def write(name, mode, islink, getdata): |
|
787 | def write(name, mode, islink, getdata): | |
788 | if matchfn and not matchfn(name): |
|
788 | if matchfn and not matchfn(name): | |
789 | return |
|
789 | return | |
790 | data = getdata() |
|
790 | data = getdata() | |
791 | if decode: |
|
791 | if decode: | |
792 | data = repo.wwritedata(name, data) |
|
792 | data = repo.wwritedata(name, data) | |
793 | archiver.addfile(prefix + name, mode, islink, data) |
|
793 | archiver.addfile(prefix + name, mode, islink, data) | |
794 |
|
794 | |||
795 | archiver = archival.archivers[kind](dest, mtime or ctx.date()[0]) |
|
795 | archiver = archival.archivers[kind](dest, mtime or ctx.date()[0]) | |
796 |
|
796 | |||
797 | if repo.ui.configbool("ui", "archivemeta", True): |
|
797 | if repo.ui.configbool("ui", "archivemeta", True): | |
798 | def metadata(): |
|
798 | def metadata(): | |
799 | base = 'repo: %s\nnode: %s\nbranch: %s\n' % ( |
|
799 | base = 'repo: %s\nnode: %s\nbranch: %s\n' % ( | |
800 | hex(repo.changelog.node(0)), hex(node), ctx.branch()) |
|
800 | hex(repo.changelog.node(0)), hex(node), ctx.branch()) | |
801 |
|
801 | |||
802 | tags = ''.join('tag: %s\n' % t for t in ctx.tags() |
|
802 | tags = ''.join('tag: %s\n' % t for t in ctx.tags() | |
803 | if repo.tagtype(t) == 'global') |
|
803 | if repo.tagtype(t) == 'global') | |
804 | if not tags: |
|
804 | if not tags: | |
805 | repo.ui.pushbuffer() |
|
805 | repo.ui.pushbuffer() | |
806 | opts = {'template': '{latesttag}\n{latesttagdistance}', |
|
806 | opts = {'template': '{latesttag}\n{latesttagdistance}', | |
807 | 'style': '', 'patch': None, 'git': None} |
|
807 | 'style': '', 'patch': None, 'git': None} | |
808 | cmdutil.show_changeset(repo.ui, repo, opts).show(ctx) |
|
808 | cmdutil.show_changeset(repo.ui, repo, opts).show(ctx) | |
809 | ltags, dist = repo.ui.popbuffer().split('\n') |
|
809 | ltags, dist = repo.ui.popbuffer().split('\n') | |
810 | tags = ''.join('latesttag: %s\n' % t for t in ltags.split(':')) |
|
810 | tags = ''.join('latesttag: %s\n' % t for t in ltags.split(':')) | |
811 | tags += 'latesttagdistance: %s\n' % dist |
|
811 | tags += 'latesttagdistance: %s\n' % dist | |
812 |
|
812 | |||
813 | return base + tags |
|
813 | return base + tags | |
814 |
|
814 | |||
815 | write('.hg_archival.txt', 0644, False, metadata) |
|
815 | write('.hg_archival.txt', 0644, False, metadata) | |
816 |
|
816 | |||
817 | for f in ctx: |
|
817 | for f in ctx: | |
818 | ff = ctx.flags(f) |
|
818 | ff = ctx.flags(f) | |
819 | getdata = ctx[f].data |
|
819 | getdata = ctx[f].data | |
820 | if lfutil.isstandin(f): |
|
820 | if lfutil.isstandin(f): | |
821 | path = lfutil.findfile(repo, getdata().strip()) |
|
821 | path = lfutil.findfile(repo, getdata().strip()) | |
822 | if path is None: |
|
822 | if path is None: | |
823 | raise util.Abort( |
|
823 | raise util.Abort( | |
824 | _('largefile %s not found in repo store or system cache') |
|
824 | _('largefile %s not found in repo store or system cache') | |
825 | % lfutil.splitstandin(f)) |
|
825 | % lfutil.splitstandin(f)) | |
826 | f = lfutil.splitstandin(f) |
|
826 | f = lfutil.splitstandin(f) | |
827 |
|
827 | |||
828 | def getdatafn(): |
|
828 | def getdatafn(): | |
829 | fd = None |
|
829 | fd = None | |
830 | try: |
|
830 | try: | |
831 | fd = open(path, 'rb') |
|
831 | fd = open(path, 'rb') | |
832 | return fd.read() |
|
832 | return fd.read() | |
833 | finally: |
|
833 | finally: | |
834 | if fd: |
|
834 | if fd: | |
835 | fd.close() |
|
835 | fd.close() | |
836 |
|
836 | |||
837 | getdata = getdatafn |
|
837 | getdata = getdatafn | |
838 | write(f, 'x' in ff and 0755 or 0644, 'l' in ff, getdata) |
|
838 | write(f, 'x' in ff and 0755 or 0644, 'l' in ff, getdata) | |
839 |
|
839 | |||
840 | if subrepos: |
|
840 | if subrepos: | |
841 | for subpath in ctx.substate: |
|
841 | for subpath in ctx.substate: | |
842 | sub = ctx.sub(subpath) |
|
842 | sub = ctx.sub(subpath) | |
843 | submatch = match_.narrowmatcher(subpath, matchfn) |
|
843 | submatch = match_.narrowmatcher(subpath, matchfn) | |
844 | sub.archive(repo.ui, archiver, prefix, submatch) |
|
844 | sub.archive(repo.ui, archiver, prefix, submatch) | |
845 |
|
845 | |||
846 | archiver.done() |
|
846 | archiver.done() | |
847 |
|
847 | |||
848 | def hgsubrepoarchive(orig, repo, ui, archiver, prefix, match=None): |
|
848 | def hgsubrepoarchive(orig, repo, ui, archiver, prefix, match=None): | |
849 | repo._get(repo._state + ('hg',)) |
|
849 | repo._get(repo._state + ('hg',)) | |
850 | rev = repo._state[1] |
|
850 | rev = repo._state[1] | |
851 | ctx = repo._repo[rev] |
|
851 | ctx = repo._repo[rev] | |
852 |
|
852 | |||
853 | lfcommands.cachelfiles(ui, repo._repo, ctx.node()) |
|
853 | lfcommands.cachelfiles(ui, repo._repo, ctx.node()) | |
854 |
|
854 | |||
855 | def write(name, mode, islink, getdata): |
|
855 | def write(name, mode, islink, getdata): | |
856 | # At this point, the standin has been replaced with the largefile name, |
|
856 | # At this point, the standin has been replaced with the largefile name, | |
857 | # so the normal matcher works here without the lfutil variants. |
|
857 | # so the normal matcher works here without the lfutil variants. | |
858 | if match and not match(f): |
|
858 | if match and not match(f): | |
859 | return |
|
859 | return | |
860 | data = getdata() |
|
860 | data = getdata() | |
861 |
|
861 | |||
862 | archiver.addfile(prefix + repo._path + '/' + name, mode, islink, data) |
|
862 | archiver.addfile(prefix + repo._path + '/' + name, mode, islink, data) | |
863 |
|
863 | |||
864 | for f in ctx: |
|
864 | for f in ctx: | |
865 | ff = ctx.flags(f) |
|
865 | ff = ctx.flags(f) | |
866 | getdata = ctx[f].data |
|
866 | getdata = ctx[f].data | |
867 | if lfutil.isstandin(f): |
|
867 | if lfutil.isstandin(f): | |
868 | path = lfutil.findfile(repo._repo, getdata().strip()) |
|
868 | path = lfutil.findfile(repo._repo, getdata().strip()) | |
869 | if path is None: |
|
869 | if path is None: | |
870 | raise util.Abort( |
|
870 | raise util.Abort( | |
871 | _('largefile %s not found in repo store or system cache') |
|
871 | _('largefile %s not found in repo store or system cache') | |
872 | % lfutil.splitstandin(f)) |
|
872 | % lfutil.splitstandin(f)) | |
873 | f = lfutil.splitstandin(f) |
|
873 | f = lfutil.splitstandin(f) | |
874 |
|
874 | |||
875 | def getdatafn(): |
|
875 | def getdatafn(): | |
876 | fd = None |
|
876 | fd = None | |
877 | try: |
|
877 | try: | |
878 | fd = open(os.path.join(prefix, path), 'rb') |
|
878 | fd = open(os.path.join(prefix, path), 'rb') | |
879 | return fd.read() |
|
879 | return fd.read() | |
880 | finally: |
|
880 | finally: | |
881 | if fd: |
|
881 | if fd: | |
882 | fd.close() |
|
882 | fd.close() | |
883 |
|
883 | |||
884 | getdata = getdatafn |
|
884 | getdata = getdatafn | |
885 |
|
885 | |||
886 | write(f, 'x' in ff and 0755 or 0644, 'l' in ff, getdata) |
|
886 | write(f, 'x' in ff and 0755 or 0644, 'l' in ff, getdata) | |
887 |
|
887 | |||
888 | for subpath in ctx.substate: |
|
888 | for subpath in ctx.substate: | |
889 | sub = ctx.sub(subpath) |
|
889 | sub = ctx.sub(subpath) | |
890 | submatch = match_.narrowmatcher(subpath, match) |
|
890 | submatch = match_.narrowmatcher(subpath, match) | |
891 | sub.archive(ui, archiver, os.path.join(prefix, repo._path) + '/', |
|
891 | sub.archive(ui, archiver, os.path.join(prefix, repo._path) + '/', | |
892 | submatch) |
|
892 | submatch) | |
893 |
|
893 | |||
894 | # If a largefile is modified, the change is not reflected in its |
|
894 | # If a largefile is modified, the change is not reflected in its | |
895 | # standin until a commit. cmdutil.bailifchanged() raises an exception |
|
895 | # standin until a commit. cmdutil.bailifchanged() raises an exception | |
896 | # if the repo has uncommitted changes. Wrap it to also check if |
|
896 | # if the repo has uncommitted changes. Wrap it to also check if | |
897 | # largefiles were changed. This is used by bisect and backout. |
|
897 | # largefiles were changed. This is used by bisect and backout. | |
898 | def overridebailifchanged(orig, repo): |
|
898 | def overridebailifchanged(orig, repo): | |
899 | orig(repo) |
|
899 | orig(repo) | |
900 | repo.lfstatus = True |
|
900 | repo.lfstatus = True | |
901 | modified, added, removed, deleted = repo.status()[:4] |
|
901 | modified, added, removed, deleted = repo.status()[:4] | |
902 | repo.lfstatus = False |
|
902 | repo.lfstatus = False | |
903 | if modified or added or removed or deleted: |
|
903 | if modified or added or removed or deleted: | |
904 | raise util.Abort(_('outstanding uncommitted changes')) |
|
904 | raise util.Abort(_('outstanding uncommitted changes')) | |
905 |
|
905 | |||
906 | # Fetch doesn't use cmdutil.bailifchanged so override it to add the check |
|
906 | # Fetch doesn't use cmdutil.bailifchanged so override it to add the check | |
907 | def overridefetch(orig, ui, repo, *pats, **opts): |
|
907 | def overridefetch(orig, ui, repo, *pats, **opts): | |
908 | repo.lfstatus = True |
|
908 | repo.lfstatus = True | |
909 | modified, added, removed, deleted = repo.status()[:4] |
|
909 | modified, added, removed, deleted = repo.status()[:4] | |
910 | repo.lfstatus = False |
|
910 | repo.lfstatus = False | |
911 | if modified or added or removed or deleted: |
|
911 | if modified or added or removed or deleted: | |
912 | raise util.Abort(_('outstanding uncommitted changes')) |
|
912 | raise util.Abort(_('outstanding uncommitted changes')) | |
913 | return orig(ui, repo, *pats, **opts) |
|
913 | return orig(ui, repo, *pats, **opts) | |
914 |
|
914 | |||
915 | def overrideforget(orig, ui, repo, *pats, **opts): |
|
915 | def overrideforget(orig, ui, repo, *pats, **opts): | |
916 | installnormalfilesmatchfn(repo[None].manifest()) |
|
916 | installnormalfilesmatchfn(repo[None].manifest()) | |
917 | result = orig(ui, repo, *pats, **opts) |
|
917 | result = orig(ui, repo, *pats, **opts) | |
918 | restorematchfn() |
|
918 | restorematchfn() | |
919 | m = scmutil.match(repo[None], pats, opts) |
|
919 | m = scmutil.match(repo[None], pats, opts) | |
920 |
|
920 | |||
921 | try: |
|
921 | try: | |
922 | repo.lfstatus = True |
|
922 | repo.lfstatus = True | |
923 | s = repo.status(match=m, clean=True) |
|
923 | s = repo.status(match=m, clean=True) | |
924 | finally: |
|
924 | finally: | |
925 | repo.lfstatus = False |
|
925 | repo.lfstatus = False | |
926 | forget = sorted(s[0] + s[1] + s[3] + s[6]) |
|
926 | forget = sorted(s[0] + s[1] + s[3] + s[6]) | |
927 | forget = [f for f in forget if lfutil.standin(f) in repo[None].manifest()] |
|
927 | forget = [f for f in forget if lfutil.standin(f) in repo[None].manifest()] | |
928 |
|
928 | |||
929 | for f in forget: |
|
929 | for f in forget: | |
930 | if lfutil.standin(f) not in repo.dirstate and not \ |
|
930 | if lfutil.standin(f) not in repo.dirstate and not \ | |
931 | os.path.isdir(m.rel(lfutil.standin(f))): |
|
931 | os.path.isdir(m.rel(lfutil.standin(f))): | |
932 | ui.warn(_('not removing %s: file is already untracked\n') |
|
932 | ui.warn(_('not removing %s: file is already untracked\n') | |
933 | % m.rel(f)) |
|
933 | % m.rel(f)) | |
934 | result = 1 |
|
934 | result = 1 | |
935 |
|
935 | |||
936 | for f in forget: |
|
936 | for f in forget: | |
937 | if ui.verbose or not m.exact(f): |
|
937 | if ui.verbose or not m.exact(f): | |
938 | ui.status(_('removing %s\n') % m.rel(f)) |
|
938 | ui.status(_('removing %s\n') % m.rel(f)) | |
939 |
|
939 | |||
940 | # Need to lock because standin files are deleted then removed from the |
|
940 | # Need to lock because standin files are deleted then removed from the | |
941 | # repository and we could race in-between. |
|
941 | # repository and we could race in-between. | |
942 | wlock = repo.wlock() |
|
942 | wlock = repo.wlock() | |
943 | try: |
|
943 | try: | |
944 | lfdirstate = lfutil.openlfdirstate(ui, repo) |
|
944 | lfdirstate = lfutil.openlfdirstate(ui, repo) | |
945 | for f in forget: |
|
945 | for f in forget: | |
946 | if lfdirstate[f] == 'a': |
|
946 | if lfdirstate[f] == 'a': | |
947 | lfdirstate.drop(f) |
|
947 | lfdirstate.drop(f) | |
948 | else: |
|
948 | else: | |
949 | lfdirstate.remove(f) |
|
949 | lfdirstate.remove(f) | |
950 | lfdirstate.write() |
|
950 | lfdirstate.write() | |
951 | lfutil.reporemove(repo, [lfutil.standin(f) for f in forget], |
|
951 | lfutil.reporemove(repo, [lfutil.standin(f) for f in forget], | |
952 | unlink=True) |
|
952 | unlink=True) | |
953 | finally: |
|
953 | finally: | |
954 | wlock.release() |
|
954 | wlock.release() | |
955 |
|
955 | |||
956 | return result |
|
956 | return result | |
957 |
|
957 | |||
958 | def getoutgoinglfiles(ui, repo, dest=None, **opts): |
|
958 | def getoutgoinglfiles(ui, repo, dest=None, **opts): | |
959 | dest = ui.expandpath(dest or 'default-push', dest or 'default') |
|
959 | dest = ui.expandpath(dest or 'default-push', dest or 'default') | |
960 | dest, branches = hg.parseurl(dest, opts.get('branch')) |
|
960 | dest, branches = hg.parseurl(dest, opts.get('branch')) | |
961 | revs, checkout = hg.addbranchrevs(repo, repo, branches, opts.get('rev')) |
|
961 | revs, checkout = hg.addbranchrevs(repo, repo, branches, opts.get('rev')) | |
962 | if revs: |
|
962 | if revs: | |
963 | revs = [repo.lookup(rev) for rev in scmutil.revrange(repo, revs)] |
|
963 | revs = [repo.lookup(rev) for rev in scmutil.revrange(repo, revs)] | |
964 |
|
964 | |||
965 | try: |
|
965 | try: | |
966 | remote = hg.peer(repo, opts, dest) |
|
966 | remote = hg.peer(repo, opts, dest) | |
967 | except error.RepoError: |
|
967 | except error.RepoError: | |
968 | return None |
|
968 | return None | |
969 | o = lfutil.findoutgoing(repo, remote, False) |
|
969 | o = lfutil.findoutgoing(repo, remote, False) | |
970 | if not o: |
|
970 | if not o: | |
971 |
return |
|
971 | return o | |
972 | o = repo.changelog.nodesbetween(o, revs)[0] |
|
972 | o = repo.changelog.nodesbetween(o, revs)[0] | |
973 | if opts.get('newest_first'): |
|
973 | if opts.get('newest_first'): | |
974 | o.reverse() |
|
974 | o.reverse() | |
975 |
|
975 | |||
976 | toupload = set() |
|
976 | toupload = set() | |
977 | for n in o: |
|
977 | for n in o: | |
978 | parents = [p for p in repo.changelog.parents(n) if p != node.nullid] |
|
978 | parents = [p for p in repo.changelog.parents(n) if p != node.nullid] | |
979 | ctx = repo[n] |
|
979 | ctx = repo[n] | |
980 | files = set(ctx.files()) |
|
980 | files = set(ctx.files()) | |
981 | if len(parents) == 2: |
|
981 | if len(parents) == 2: | |
982 | mc = ctx.manifest() |
|
982 | mc = ctx.manifest() | |
983 | mp1 = ctx.parents()[0].manifest() |
|
983 | mp1 = ctx.parents()[0].manifest() | |
984 | mp2 = ctx.parents()[1].manifest() |
|
984 | mp2 = ctx.parents()[1].manifest() | |
985 | for f in mp1: |
|
985 | for f in mp1: | |
986 | if f not in mc: |
|
986 | if f not in mc: | |
987 | files.add(f) |
|
987 | files.add(f) | |
988 | for f in mp2: |
|
988 | for f in mp2: | |
989 | if f not in mc: |
|
989 | if f not in mc: | |
990 | files.add(f) |
|
990 | files.add(f) | |
991 | for f in mc: |
|
991 | for f in mc: | |
992 | if mc[f] != mp1.get(f, None) or mc[f] != mp2.get(f, None): |
|
992 | if mc[f] != mp1.get(f, None) or mc[f] != mp2.get(f, None): | |
993 | files.add(f) |
|
993 | files.add(f) | |
994 | toupload = toupload.union( |
|
994 | toupload = toupload.union( | |
995 | set([f for f in files if lfutil.isstandin(f) and f in ctx])) |
|
995 | set([f for f in files if lfutil.isstandin(f) and f in ctx])) | |
996 | return toupload |
|
996 | return toupload | |
997 |
|
997 | |||
998 | def overrideoutgoing(orig, ui, repo, dest=None, **opts): |
|
998 | def overrideoutgoing(orig, ui, repo, dest=None, **opts): | |
999 | result = orig(ui, repo, dest, **opts) |
|
999 | result = orig(ui, repo, dest, **opts) | |
1000 |
|
1000 | |||
1001 | if opts.pop('large', None): |
|
1001 | if opts.pop('large', None): | |
1002 | toupload = getoutgoinglfiles(ui, repo, dest, **opts) |
|
1002 | toupload = getoutgoinglfiles(ui, repo, dest, **opts) | |
1003 | if toupload is None: |
|
1003 | if toupload is None: | |
1004 | ui.status(_('largefiles: No remote repo\n')) |
|
1004 | ui.status(_('largefiles: No remote repo\n')) | |
|
1005 | elif not toupload: | |||
|
1006 | ui.status(_('largefiles: no files to upload\n')) | |||
1005 | else: |
|
1007 | else: | |
1006 | ui.status(_('largefiles to upload:\n')) |
|
1008 | ui.status(_('largefiles to upload:\n')) | |
1007 | for file in toupload: |
|
1009 | for file in toupload: | |
1008 | ui.status(lfutil.splitstandin(file) + '\n') |
|
1010 | ui.status(lfutil.splitstandin(file) + '\n') | |
1009 | ui.status('\n') |
|
1011 | ui.status('\n') | |
1010 |
|
1012 | |||
1011 | return result |
|
1013 | return result | |
1012 |
|
1014 | |||
1013 | def overridesummary(orig, ui, repo, *pats, **opts): |
|
1015 | def overridesummary(orig, ui, repo, *pats, **opts): | |
1014 | try: |
|
1016 | try: | |
1015 | repo.lfstatus = True |
|
1017 | repo.lfstatus = True | |
1016 | orig(ui, repo, *pats, **opts) |
|
1018 | orig(ui, repo, *pats, **opts) | |
1017 | finally: |
|
1019 | finally: | |
1018 | repo.lfstatus = False |
|
1020 | repo.lfstatus = False | |
1019 |
|
1021 | |||
1020 | if opts.pop('large', None): |
|
1022 | if opts.pop('large', None): | |
1021 | toupload = getoutgoinglfiles(ui, repo, None, **opts) |
|
1023 | toupload = getoutgoinglfiles(ui, repo, None, **opts) | |
1022 | if toupload is None: |
|
1024 | if toupload is None: | |
1023 | ui.status(_('largefiles: No remote repo\n')) |
|
1025 | ui.status(_('largefiles: No remote repo\n')) | |
|
1026 | elif not toupload: | |||
|
1027 | ui.status(_('largefiles: (no files to upload)\n')) | |||
1024 | else: |
|
1028 | else: | |
1025 | ui.status(_('largefiles: %d to upload\n') % len(toupload)) |
|
1029 | ui.status(_('largefiles: %d to upload\n') % len(toupload)) | |
1026 |
|
1030 | |||
1027 | def scmutiladdremove(orig, repo, pats=[], opts={}, dry_run=None, |
|
1031 | def scmutiladdremove(orig, repo, pats=[], opts={}, dry_run=None, | |
1028 | similarity=None): |
|
1032 | similarity=None): | |
1029 | if not lfutil.islfilesrepo(repo): |
|
1033 | if not lfutil.islfilesrepo(repo): | |
1030 | return orig(repo, pats, opts, dry_run, similarity) |
|
1034 | return orig(repo, pats, opts, dry_run, similarity) | |
1031 | # Get the list of missing largefiles so we can remove them |
|
1035 | # Get the list of missing largefiles so we can remove them | |
1032 | lfdirstate = lfutil.openlfdirstate(repo.ui, repo) |
|
1036 | lfdirstate = lfutil.openlfdirstate(repo.ui, repo) | |
1033 | s = lfdirstate.status(match_.always(repo.root, repo.getcwd()), [], False, |
|
1037 | s = lfdirstate.status(match_.always(repo.root, repo.getcwd()), [], False, | |
1034 | False, False) |
|
1038 | False, False) | |
1035 | (unsure, modified, added, removed, missing, unknown, ignored, clean) = s |
|
1039 | (unsure, modified, added, removed, missing, unknown, ignored, clean) = s | |
1036 |
|
1040 | |||
1037 | # Call into the normal remove code, but the removing of the standin, we want |
|
1041 | # Call into the normal remove code, but the removing of the standin, we want | |
1038 | # to have handled by original addremove. Monkey patching here makes sure |
|
1042 | # to have handled by original addremove. Monkey patching here makes sure | |
1039 | # we don't remove the standin in the largefiles code, preventing a very |
|
1043 | # we don't remove the standin in the largefiles code, preventing a very | |
1040 | # confused state later. |
|
1044 | # confused state later. | |
1041 | if missing: |
|
1045 | if missing: | |
1042 | m = [repo.wjoin(f) for f in missing] |
|
1046 | m = [repo.wjoin(f) for f in missing] | |
1043 | repo._isaddremove = True |
|
1047 | repo._isaddremove = True | |
1044 | removelargefiles(repo.ui, repo, *m, **opts) |
|
1048 | removelargefiles(repo.ui, repo, *m, **opts) | |
1045 | repo._isaddremove = False |
|
1049 | repo._isaddremove = False | |
1046 | # Call into the normal add code, and any files that *should* be added as |
|
1050 | # Call into the normal add code, and any files that *should* be added as | |
1047 | # largefiles will be |
|
1051 | # largefiles will be | |
1048 | addlargefiles(repo.ui, repo, *pats, **opts) |
|
1052 | addlargefiles(repo.ui, repo, *pats, **opts) | |
1049 | # Now that we've handled largefiles, hand off to the original addremove |
|
1053 | # Now that we've handled largefiles, hand off to the original addremove | |
1050 | # function to take care of the rest. Make sure it doesn't do anything with |
|
1054 | # function to take care of the rest. Make sure it doesn't do anything with | |
1051 | # largefiles by installing a matcher that will ignore them. |
|
1055 | # largefiles by installing a matcher that will ignore them. | |
1052 | installnormalfilesmatchfn(repo[None].manifest()) |
|
1056 | installnormalfilesmatchfn(repo[None].manifest()) | |
1053 | result = orig(repo, pats, opts, dry_run, similarity) |
|
1057 | result = orig(repo, pats, opts, dry_run, similarity) | |
1054 | restorematchfn() |
|
1058 | restorematchfn() | |
1055 | return result |
|
1059 | return result | |
1056 |
|
1060 | |||
1057 | # Calling purge with --all will cause the largefiles to be deleted. |
|
1061 | # Calling purge with --all will cause the largefiles to be deleted. | |
1058 | # Override repo.status to prevent this from happening. |
|
1062 | # Override repo.status to prevent this from happening. | |
1059 | def overridepurge(orig, ui, repo, *dirs, **opts): |
|
1063 | def overridepurge(orig, ui, repo, *dirs, **opts): | |
1060 | oldstatus = repo.status |
|
1064 | oldstatus = repo.status | |
1061 | def overridestatus(node1='.', node2=None, match=None, ignored=False, |
|
1065 | def overridestatus(node1='.', node2=None, match=None, ignored=False, | |
1062 | clean=False, unknown=False, listsubrepos=False): |
|
1066 | clean=False, unknown=False, listsubrepos=False): | |
1063 | r = oldstatus(node1, node2, match, ignored, clean, unknown, |
|
1067 | r = oldstatus(node1, node2, match, ignored, clean, unknown, | |
1064 | listsubrepos) |
|
1068 | listsubrepos) | |
1065 | lfdirstate = lfutil.openlfdirstate(ui, repo) |
|
1069 | lfdirstate = lfutil.openlfdirstate(ui, repo) | |
1066 | modified, added, removed, deleted, unknown, ignored, clean = r |
|
1070 | modified, added, removed, deleted, unknown, ignored, clean = r | |
1067 | unknown = [f for f in unknown if lfdirstate[f] == '?'] |
|
1071 | unknown = [f for f in unknown if lfdirstate[f] == '?'] | |
1068 | ignored = [f for f in ignored if lfdirstate[f] == '?'] |
|
1072 | ignored = [f for f in ignored if lfdirstate[f] == '?'] | |
1069 | return modified, added, removed, deleted, unknown, ignored, clean |
|
1073 | return modified, added, removed, deleted, unknown, ignored, clean | |
1070 | repo.status = overridestatus |
|
1074 | repo.status = overridestatus | |
1071 | orig(ui, repo, *dirs, **opts) |
|
1075 | orig(ui, repo, *dirs, **opts) | |
1072 | repo.status = oldstatus |
|
1076 | repo.status = oldstatus | |
1073 |
|
1077 | |||
1074 | def overriderollback(orig, ui, repo, **opts): |
|
1078 | def overriderollback(orig, ui, repo, **opts): | |
1075 | result = orig(ui, repo, **opts) |
|
1079 | result = orig(ui, repo, **opts) | |
1076 | merge.update(repo, node=None, branchmerge=False, force=True, |
|
1080 | merge.update(repo, node=None, branchmerge=False, force=True, | |
1077 | partial=lfutil.isstandin) |
|
1081 | partial=lfutil.isstandin) | |
1078 | wlock = repo.wlock() |
|
1082 | wlock = repo.wlock() | |
1079 | try: |
|
1083 | try: | |
1080 | lfdirstate = lfutil.openlfdirstate(ui, repo) |
|
1084 | lfdirstate = lfutil.openlfdirstate(ui, repo) | |
1081 | lfiles = lfutil.listlfiles(repo) |
|
1085 | lfiles = lfutil.listlfiles(repo) | |
1082 | oldlfiles = lfutil.listlfiles(repo, repo[None].parents()[0].rev()) |
|
1086 | oldlfiles = lfutil.listlfiles(repo, repo[None].parents()[0].rev()) | |
1083 | for file in lfiles: |
|
1087 | for file in lfiles: | |
1084 | if file in oldlfiles: |
|
1088 | if file in oldlfiles: | |
1085 | lfdirstate.normallookup(file) |
|
1089 | lfdirstate.normallookup(file) | |
1086 | else: |
|
1090 | else: | |
1087 | lfdirstate.add(file) |
|
1091 | lfdirstate.add(file) | |
1088 | lfdirstate.write() |
|
1092 | lfdirstate.write() | |
1089 | finally: |
|
1093 | finally: | |
1090 | wlock.release() |
|
1094 | wlock.release() | |
1091 | return result |
|
1095 | return result | |
1092 |
|
1096 | |||
1093 | def overridetransplant(orig, ui, repo, *revs, **opts): |
|
1097 | def overridetransplant(orig, ui, repo, *revs, **opts): | |
1094 | try: |
|
1098 | try: | |
1095 | oldstandins = lfutil.getstandinsstate(repo) |
|
1099 | oldstandins = lfutil.getstandinsstate(repo) | |
1096 | repo._istransplanting = True |
|
1100 | repo._istransplanting = True | |
1097 | result = orig(ui, repo, *revs, **opts) |
|
1101 | result = orig(ui, repo, *revs, **opts) | |
1098 | newstandins = lfutil.getstandinsstate(repo) |
|
1102 | newstandins = lfutil.getstandinsstate(repo) | |
1099 | filelist = lfutil.getlfilestoupdate(oldstandins, newstandins) |
|
1103 | filelist = lfutil.getlfilestoupdate(oldstandins, newstandins) | |
1100 | lfcommands.updatelfiles(repo.ui, repo, filelist=filelist, |
|
1104 | lfcommands.updatelfiles(repo.ui, repo, filelist=filelist, | |
1101 | printmessage=True) |
|
1105 | printmessage=True) | |
1102 | finally: |
|
1106 | finally: | |
1103 | repo._istransplanting = False |
|
1107 | repo._istransplanting = False | |
1104 | return result |
|
1108 | return result | |
1105 |
|
1109 | |||
1106 | def overridecat(orig, ui, repo, file1, *pats, **opts): |
|
1110 | def overridecat(orig, ui, repo, file1, *pats, **opts): | |
1107 | ctx = scmutil.revsingle(repo, opts.get('rev')) |
|
1111 | ctx = scmutil.revsingle(repo, opts.get('rev')) | |
1108 | if not lfutil.standin(file1) in ctx: |
|
1112 | if not lfutil.standin(file1) in ctx: | |
1109 | result = orig(ui, repo, file1, *pats, **opts) |
|
1113 | result = orig(ui, repo, file1, *pats, **opts) | |
1110 | return result |
|
1114 | return result | |
1111 | return lfcommands.catlfile(repo, file1, ctx.rev(), opts.get('output')) |
|
1115 | return lfcommands.catlfile(repo, file1, ctx.rev(), opts.get('output')) |
@@ -1,1629 +1,1713 | |||||
1 | $ USERCACHE="$TESTTMP/cache"; export USERCACHE |
|
1 | $ USERCACHE="$TESTTMP/cache"; export USERCACHE | |
2 | $ mkdir "${USERCACHE}" |
|
2 | $ mkdir "${USERCACHE}" | |
3 | $ cat >> $HGRCPATH <<EOF |
|
3 | $ cat >> $HGRCPATH <<EOF | |
4 | > [extensions] |
|
4 | > [extensions] | |
5 | > largefiles= |
|
5 | > largefiles= | |
6 | > purge= |
|
6 | > purge= | |
7 | > rebase= |
|
7 | > rebase= | |
8 | > transplant= |
|
8 | > transplant= | |
9 | > [phases] |
|
9 | > [phases] | |
10 | > publish=False |
|
10 | > publish=False | |
11 | > [largefiles] |
|
11 | > [largefiles] | |
12 | > minsize=2 |
|
12 | > minsize=2 | |
13 | > patterns=glob:**.dat |
|
13 | > patterns=glob:**.dat | |
14 | > usercache=${USERCACHE} |
|
14 | > usercache=${USERCACHE} | |
15 | > [hooks] |
|
15 | > [hooks] | |
16 | > precommit=sh -c "echo \\"Invoking status precommit hook\\"; hg status" |
|
16 | > precommit=sh -c "echo \\"Invoking status precommit hook\\"; hg status" | |
17 | > EOF |
|
17 | > EOF | |
18 |
|
18 | |||
19 | Create the repo with a couple of revisions of both large and normal |
|
19 | Create the repo with a couple of revisions of both large and normal | |
20 | files, testing that status correctly shows largefiles and that summary output |
|
20 | files, testing that status correctly shows largefiles and that summary output | |
21 | is correct. |
|
21 | is correct. | |
22 |
|
22 | |||
23 | $ hg init a |
|
23 | $ hg init a | |
24 | $ cd a |
|
24 | $ cd a | |
25 | $ mkdir sub |
|
25 | $ mkdir sub | |
26 | $ echo normal1 > normal1 |
|
26 | $ echo normal1 > normal1 | |
27 | $ echo normal2 > sub/normal2 |
|
27 | $ echo normal2 > sub/normal2 | |
28 | $ echo large1 > large1 |
|
28 | $ echo large1 > large1 | |
29 | $ echo large2 > sub/large2 |
|
29 | $ echo large2 > sub/large2 | |
30 | $ hg add normal1 sub/normal2 |
|
30 | $ hg add normal1 sub/normal2 | |
31 | $ hg add --large large1 sub/large2 |
|
31 | $ hg add --large large1 sub/large2 | |
32 | $ hg commit -m "add files" |
|
32 | $ hg commit -m "add files" | |
33 | Invoking status precommit hook |
|
33 | Invoking status precommit hook | |
34 | A large1 |
|
34 | A large1 | |
35 | A normal1 |
|
35 | A normal1 | |
36 | A sub/large2 |
|
36 | A sub/large2 | |
37 | A sub/normal2 |
|
37 | A sub/normal2 | |
38 | $ echo normal11 > normal1 |
|
38 | $ echo normal11 > normal1 | |
39 | $ echo normal22 > sub/normal2 |
|
39 | $ echo normal22 > sub/normal2 | |
40 | $ echo large11 > large1 |
|
40 | $ echo large11 > large1 | |
41 | $ echo large22 > sub/large2 |
|
41 | $ echo large22 > sub/large2 | |
42 | $ hg commit -m "edit files" |
|
42 | $ hg commit -m "edit files" | |
43 | Invoking status precommit hook |
|
43 | Invoking status precommit hook | |
44 | M large1 |
|
44 | M large1 | |
45 | M normal1 |
|
45 | M normal1 | |
46 | M sub/large2 |
|
46 | M sub/large2 | |
47 | M sub/normal2 |
|
47 | M sub/normal2 | |
48 | $ hg sum --large |
|
48 | $ hg sum --large | |
49 | parent: 1:ce8896473775 tip |
|
49 | parent: 1:ce8896473775 tip | |
50 | edit files |
|
50 | edit files | |
51 | branch: default |
|
51 | branch: default | |
52 | commit: (clean) |
|
52 | commit: (clean) | |
53 | update: (current) |
|
53 | update: (current) | |
54 | largefiles: No remote repo |
|
54 | largefiles: No remote repo | |
55 |
|
55 | |||
56 | Commit preserved largefile contents. |
|
56 | Commit preserved largefile contents. | |
57 |
|
57 | |||
58 | $ cat normal1 |
|
58 | $ cat normal1 | |
59 | normal11 |
|
59 | normal11 | |
60 | $ cat large1 |
|
60 | $ cat large1 | |
61 | large11 |
|
61 | large11 | |
62 | $ cat sub/normal2 |
|
62 | $ cat sub/normal2 | |
63 | normal22 |
|
63 | normal22 | |
64 | $ cat sub/large2 |
|
64 | $ cat sub/large2 | |
65 | large22 |
|
65 | large22 | |
66 |
|
66 | |||
67 | Test status, subdir and unknown files |
|
67 | Test status, subdir and unknown files | |
68 |
|
68 | |||
69 | $ echo unknown > sub/unknown |
|
69 | $ echo unknown > sub/unknown | |
70 | $ hg st --all |
|
70 | $ hg st --all | |
71 | ? sub/unknown |
|
71 | ? sub/unknown | |
72 | C large1 |
|
72 | C large1 | |
73 | C normal1 |
|
73 | C normal1 | |
74 | C sub/large2 |
|
74 | C sub/large2 | |
75 | C sub/normal2 |
|
75 | C sub/normal2 | |
76 | $ hg st --all sub |
|
76 | $ hg st --all sub | |
77 | ? sub/unknown |
|
77 | ? sub/unknown | |
78 | C sub/large2 |
|
78 | C sub/large2 | |
79 | C sub/normal2 |
|
79 | C sub/normal2 | |
80 | $ rm sub/unknown |
|
80 | $ rm sub/unknown | |
81 |
|
81 | |||
82 | Test exit codes for remove warning cases (modified and still exiting) |
|
82 | Test exit codes for remove warning cases (modified and still exiting) | |
83 |
|
83 | |||
84 | $ hg remove -A large1 |
|
84 | $ hg remove -A large1 | |
85 | not removing large1: file still exists (use forget to undo) |
|
85 | not removing large1: file still exists (use forget to undo) | |
86 | [1] |
|
86 | [1] | |
87 | $ echo 'modified' > large1 |
|
87 | $ echo 'modified' > large1 | |
88 | $ hg remove large1 |
|
88 | $ hg remove large1 | |
89 | not removing large1: file is modified (use forget to undo) |
|
89 | not removing large1: file is modified (use forget to undo) | |
90 | [1] |
|
90 | [1] | |
91 | $ hg up -Cq |
|
91 | $ hg up -Cq | |
92 |
|
92 | |||
93 | Remove both largefiles and normal files. |
|
93 | Remove both largefiles and normal files. | |
94 |
|
94 | |||
95 | $ hg remove normal1 large1 |
|
95 | $ hg remove normal1 large1 | |
96 | $ hg status large1 |
|
96 | $ hg status large1 | |
97 | R large1 |
|
97 | R large1 | |
98 | $ hg commit -m "remove files" |
|
98 | $ hg commit -m "remove files" | |
99 | Invoking status precommit hook |
|
99 | Invoking status precommit hook | |
100 | R large1 |
|
100 | R large1 | |
101 | R normal1 |
|
101 | R normal1 | |
102 | $ ls |
|
102 | $ ls | |
103 | sub |
|
103 | sub | |
104 | $ echo "testlargefile" > large1-test |
|
104 | $ echo "testlargefile" > large1-test | |
105 | $ hg add --large large1-test |
|
105 | $ hg add --large large1-test | |
106 | $ hg st |
|
106 | $ hg st | |
107 | A large1-test |
|
107 | A large1-test | |
108 | $ hg rm large1-test |
|
108 | $ hg rm large1-test | |
109 | not removing large1-test: file has been marked for add (use forget to undo) |
|
109 | not removing large1-test: file has been marked for add (use forget to undo) | |
110 | [1] |
|
110 | [1] | |
111 | $ hg st |
|
111 | $ hg st | |
112 | A large1-test |
|
112 | A large1-test | |
113 | $ hg forget large1-test |
|
113 | $ hg forget large1-test | |
114 | $ hg st |
|
114 | $ hg st | |
115 | ? large1-test |
|
115 | ? large1-test | |
116 | $ hg remove large1-test |
|
116 | $ hg remove large1-test | |
117 | not removing large1-test: file is untracked |
|
117 | not removing large1-test: file is untracked | |
118 | [1] |
|
118 | [1] | |
119 | $ hg forget large1-test |
|
119 | $ hg forget large1-test | |
120 | not removing large1-test: file is already untracked |
|
120 | not removing large1-test: file is already untracked | |
121 | [1] |
|
121 | [1] | |
122 | $ rm large1-test |
|
122 | $ rm large1-test | |
123 |
|
123 | |||
124 | Copy both largefiles and normal files (testing that status output is correct). |
|
124 | Copy both largefiles and normal files (testing that status output is correct). | |
125 |
|
125 | |||
126 | $ hg cp sub/normal2 normal1 |
|
126 | $ hg cp sub/normal2 normal1 | |
127 | $ hg cp sub/large2 large1 |
|
127 | $ hg cp sub/large2 large1 | |
128 | $ hg commit -m "copy files" |
|
128 | $ hg commit -m "copy files" | |
129 | Invoking status precommit hook |
|
129 | Invoking status precommit hook | |
130 | A large1 |
|
130 | A large1 | |
131 | A normal1 |
|
131 | A normal1 | |
132 | $ cat normal1 |
|
132 | $ cat normal1 | |
133 | normal22 |
|
133 | normal22 | |
134 | $ cat large1 |
|
134 | $ cat large1 | |
135 | large22 |
|
135 | large22 | |
136 |
|
136 | |||
137 | Test moving largefiles and verify that normal files are also unaffected. |
|
137 | Test moving largefiles and verify that normal files are also unaffected. | |
138 |
|
138 | |||
139 | $ hg mv normal1 normal3 |
|
139 | $ hg mv normal1 normal3 | |
140 | $ hg mv large1 large3 |
|
140 | $ hg mv large1 large3 | |
141 | $ hg mv sub/normal2 sub/normal4 |
|
141 | $ hg mv sub/normal2 sub/normal4 | |
142 | $ hg mv sub/large2 sub/large4 |
|
142 | $ hg mv sub/large2 sub/large4 | |
143 | $ hg commit -m "move files" |
|
143 | $ hg commit -m "move files" | |
144 | Invoking status precommit hook |
|
144 | Invoking status precommit hook | |
145 | A large3 |
|
145 | A large3 | |
146 | A normal3 |
|
146 | A normal3 | |
147 | A sub/large4 |
|
147 | A sub/large4 | |
148 | A sub/normal4 |
|
148 | A sub/normal4 | |
149 | R large1 |
|
149 | R large1 | |
150 | R normal1 |
|
150 | R normal1 | |
151 | R sub/large2 |
|
151 | R sub/large2 | |
152 | R sub/normal2 |
|
152 | R sub/normal2 | |
153 | $ cat normal3 |
|
153 | $ cat normal3 | |
154 | normal22 |
|
154 | normal22 | |
155 | $ cat large3 |
|
155 | $ cat large3 | |
156 | large22 |
|
156 | large22 | |
157 | $ cat sub/normal4 |
|
157 | $ cat sub/normal4 | |
158 | normal22 |
|
158 | normal22 | |
159 | $ cat sub/large4 |
|
159 | $ cat sub/large4 | |
160 | large22 |
|
160 | large22 | |
161 |
|
161 | |||
162 | Test copies and moves from a directory other than root (issue3516) |
|
162 | Test copies and moves from a directory other than root (issue3516) | |
163 |
|
163 | |||
164 | $ cd .. |
|
164 | $ cd .. | |
165 | $ hg init lf_cpmv |
|
165 | $ hg init lf_cpmv | |
166 | $ cd lf_cpmv |
|
166 | $ cd lf_cpmv | |
167 | $ mkdir dira |
|
167 | $ mkdir dira | |
168 | $ mkdir dira/dirb |
|
168 | $ mkdir dira/dirb | |
169 | $ touch dira/dirb/largefile |
|
169 | $ touch dira/dirb/largefile | |
170 | $ hg add --large dira/dirb/largefile |
|
170 | $ hg add --large dira/dirb/largefile | |
171 | $ hg commit -m "added" |
|
171 | $ hg commit -m "added" | |
172 | Invoking status precommit hook |
|
172 | Invoking status precommit hook | |
173 | A dira/dirb/largefile |
|
173 | A dira/dirb/largefile | |
174 | $ cd dira |
|
174 | $ cd dira | |
175 | $ hg cp dirb/largefile foo/largefile |
|
175 | $ hg cp dirb/largefile foo/largefile | |
176 | $ hg ci -m "deep copy" |
|
176 | $ hg ci -m "deep copy" | |
177 | Invoking status precommit hook |
|
177 | Invoking status precommit hook | |
178 | A dira/foo/largefile |
|
178 | A dira/foo/largefile | |
179 | $ find . | sort |
|
179 | $ find . | sort | |
180 | . |
|
180 | . | |
181 | ./dirb |
|
181 | ./dirb | |
182 | ./dirb/largefile |
|
182 | ./dirb/largefile | |
183 | ./foo |
|
183 | ./foo | |
184 | ./foo/largefile |
|
184 | ./foo/largefile | |
185 | $ hg mv foo/largefile baz/largefile |
|
185 | $ hg mv foo/largefile baz/largefile | |
186 | $ hg ci -m "moved" |
|
186 | $ hg ci -m "moved" | |
187 | Invoking status precommit hook |
|
187 | Invoking status precommit hook | |
188 | A dira/baz/largefile |
|
188 | A dira/baz/largefile | |
189 | R dira/foo/largefile |
|
189 | R dira/foo/largefile | |
190 | $ find . | sort |
|
190 | $ find . | sort | |
191 | . |
|
191 | . | |
192 | ./baz |
|
192 | ./baz | |
193 | ./baz/largefile |
|
193 | ./baz/largefile | |
194 | ./dirb |
|
194 | ./dirb | |
195 | ./dirb/largefile |
|
195 | ./dirb/largefile | |
196 | ./foo |
|
196 | ./foo | |
197 | $ cd ../../a |
|
197 | $ cd ../../a | |
198 |
|
198 | |||
199 | #if hgweb |
|
199 | #if hgweb | |
200 | Test display of largefiles in hgweb |
|
200 | Test display of largefiles in hgweb | |
201 |
|
201 | |||
202 | $ hg serve -d -p $HGPORT --pid-file ../hg.pid |
|
202 | $ hg serve -d -p $HGPORT --pid-file ../hg.pid | |
203 | $ cat ../hg.pid >> $DAEMON_PIDS |
|
203 | $ cat ../hg.pid >> $DAEMON_PIDS | |
204 | $ "$TESTDIR/get-with-headers.py" 127.0.0.1:$HGPORT 'file/tip/?style=raw' |
|
204 | $ "$TESTDIR/get-with-headers.py" 127.0.0.1:$HGPORT 'file/tip/?style=raw' | |
205 | 200 Script output follows |
|
205 | 200 Script output follows | |
206 |
|
206 | |||
207 |
|
207 | |||
208 | drwxr-xr-x sub |
|
208 | drwxr-xr-x sub | |
209 | -rw-r--r-- 41 large3 |
|
209 | -rw-r--r-- 41 large3 | |
210 | -rw-r--r-- 9 normal3 |
|
210 | -rw-r--r-- 9 normal3 | |
211 |
|
211 | |||
212 |
|
212 | |||
213 | $ "$TESTDIR/get-with-headers.py" 127.0.0.1:$HGPORT 'file/tip/sub/?style=raw' |
|
213 | $ "$TESTDIR/get-with-headers.py" 127.0.0.1:$HGPORT 'file/tip/sub/?style=raw' | |
214 | 200 Script output follows |
|
214 | 200 Script output follows | |
215 |
|
215 | |||
216 |
|
216 | |||
217 | -rw-r--r-- 41 large4 |
|
217 | -rw-r--r-- 41 large4 | |
218 | -rw-r--r-- 9 normal4 |
|
218 | -rw-r--r-- 9 normal4 | |
219 |
|
219 | |||
220 |
|
220 | |||
221 | $ "$TESTDIR/killdaemons.py" $DAEMON_PIDS |
|
221 | $ "$TESTDIR/killdaemons.py" $DAEMON_PIDS | |
222 | #endif |
|
222 | #endif | |
223 |
|
223 | |||
224 | Test archiving the various revisions. These hit corner cases known with |
|
224 | Test archiving the various revisions. These hit corner cases known with | |
225 | archiving. |
|
225 | archiving. | |
226 |
|
226 | |||
227 | $ hg archive -r 0 ../archive0 |
|
227 | $ hg archive -r 0 ../archive0 | |
228 | $ hg archive -r 1 ../archive1 |
|
228 | $ hg archive -r 1 ../archive1 | |
229 | $ hg archive -r 2 ../archive2 |
|
229 | $ hg archive -r 2 ../archive2 | |
230 | $ hg archive -r 3 ../archive3 |
|
230 | $ hg archive -r 3 ../archive3 | |
231 | $ hg archive -r 4 ../archive4 |
|
231 | $ hg archive -r 4 ../archive4 | |
232 | $ cd ../archive0 |
|
232 | $ cd ../archive0 | |
233 | $ cat normal1 |
|
233 | $ cat normal1 | |
234 | normal1 |
|
234 | normal1 | |
235 | $ cat large1 |
|
235 | $ cat large1 | |
236 | large1 |
|
236 | large1 | |
237 | $ cat sub/normal2 |
|
237 | $ cat sub/normal2 | |
238 | normal2 |
|
238 | normal2 | |
239 | $ cat sub/large2 |
|
239 | $ cat sub/large2 | |
240 | large2 |
|
240 | large2 | |
241 | $ cd ../archive1 |
|
241 | $ cd ../archive1 | |
242 | $ cat normal1 |
|
242 | $ cat normal1 | |
243 | normal11 |
|
243 | normal11 | |
244 | $ cat large1 |
|
244 | $ cat large1 | |
245 | large11 |
|
245 | large11 | |
246 | $ cat sub/normal2 |
|
246 | $ cat sub/normal2 | |
247 | normal22 |
|
247 | normal22 | |
248 | $ cat sub/large2 |
|
248 | $ cat sub/large2 | |
249 | large22 |
|
249 | large22 | |
250 | $ cd ../archive2 |
|
250 | $ cd ../archive2 | |
251 | $ ls |
|
251 | $ ls | |
252 | sub |
|
252 | sub | |
253 | $ cat sub/normal2 |
|
253 | $ cat sub/normal2 | |
254 | normal22 |
|
254 | normal22 | |
255 | $ cat sub/large2 |
|
255 | $ cat sub/large2 | |
256 | large22 |
|
256 | large22 | |
257 | $ cd ../archive3 |
|
257 | $ cd ../archive3 | |
258 | $ cat normal1 |
|
258 | $ cat normal1 | |
259 | normal22 |
|
259 | normal22 | |
260 | $ cat large1 |
|
260 | $ cat large1 | |
261 | large22 |
|
261 | large22 | |
262 | $ cat sub/normal2 |
|
262 | $ cat sub/normal2 | |
263 | normal22 |
|
263 | normal22 | |
264 | $ cat sub/large2 |
|
264 | $ cat sub/large2 | |
265 | large22 |
|
265 | large22 | |
266 | $ cd ../archive4 |
|
266 | $ cd ../archive4 | |
267 | $ cat normal3 |
|
267 | $ cat normal3 | |
268 | normal22 |
|
268 | normal22 | |
269 | $ cat large3 |
|
269 | $ cat large3 | |
270 | large22 |
|
270 | large22 | |
271 | $ cat sub/normal4 |
|
271 | $ cat sub/normal4 | |
272 | normal22 |
|
272 | normal22 | |
273 | $ cat sub/large4 |
|
273 | $ cat sub/large4 | |
274 | large22 |
|
274 | large22 | |
275 |
|
275 | |||
276 | Commit corner case: specify files to commit. |
|
276 | Commit corner case: specify files to commit. | |
277 |
|
277 | |||
278 | $ cd ../a |
|
278 | $ cd ../a | |
279 | $ echo normal3 > normal3 |
|
279 | $ echo normal3 > normal3 | |
280 | $ echo large3 > large3 |
|
280 | $ echo large3 > large3 | |
281 | $ echo normal4 > sub/normal4 |
|
281 | $ echo normal4 > sub/normal4 | |
282 | $ echo large4 > sub/large4 |
|
282 | $ echo large4 > sub/large4 | |
283 | $ hg commit normal3 large3 sub/normal4 sub/large4 -m "edit files again" |
|
283 | $ hg commit normal3 large3 sub/normal4 sub/large4 -m "edit files again" | |
284 | Invoking status precommit hook |
|
284 | Invoking status precommit hook | |
285 | M large3 |
|
285 | M large3 | |
286 | M normal3 |
|
286 | M normal3 | |
287 | M sub/large4 |
|
287 | M sub/large4 | |
288 | M sub/normal4 |
|
288 | M sub/normal4 | |
289 | $ cat normal3 |
|
289 | $ cat normal3 | |
290 | normal3 |
|
290 | normal3 | |
291 | $ cat large3 |
|
291 | $ cat large3 | |
292 | large3 |
|
292 | large3 | |
293 | $ cat sub/normal4 |
|
293 | $ cat sub/normal4 | |
294 | normal4 |
|
294 | normal4 | |
295 | $ cat sub/large4 |
|
295 | $ cat sub/large4 | |
296 | large4 |
|
296 | large4 | |
297 |
|
297 | |||
298 | One more commit corner case: commit from a subdirectory. |
|
298 | One more commit corner case: commit from a subdirectory. | |
299 |
|
299 | |||
300 | $ cd ../a |
|
300 | $ cd ../a | |
301 | $ echo normal33 > normal3 |
|
301 | $ echo normal33 > normal3 | |
302 | $ echo large33 > large3 |
|
302 | $ echo large33 > large3 | |
303 | $ echo normal44 > sub/normal4 |
|
303 | $ echo normal44 > sub/normal4 | |
304 | $ echo large44 > sub/large4 |
|
304 | $ echo large44 > sub/large4 | |
305 | $ cd sub |
|
305 | $ cd sub | |
306 | $ hg commit -m "edit files yet again" |
|
306 | $ hg commit -m "edit files yet again" | |
307 | Invoking status precommit hook |
|
307 | Invoking status precommit hook | |
308 | M large3 |
|
308 | M large3 | |
309 | M normal3 |
|
309 | M normal3 | |
310 | M sub/large4 |
|
310 | M sub/large4 | |
311 | M sub/normal4 |
|
311 | M sub/normal4 | |
312 | $ cat ../normal3 |
|
312 | $ cat ../normal3 | |
313 | normal33 |
|
313 | normal33 | |
314 | $ cat ../large3 |
|
314 | $ cat ../large3 | |
315 | large33 |
|
315 | large33 | |
316 | $ cat normal4 |
|
316 | $ cat normal4 | |
317 | normal44 |
|
317 | normal44 | |
318 | $ cat large4 |
|
318 | $ cat large4 | |
319 | large44 |
|
319 | large44 | |
320 |
|
320 | |||
321 | Committing standins is not allowed. |
|
321 | Committing standins is not allowed. | |
322 |
|
322 | |||
323 | $ cd .. |
|
323 | $ cd .. | |
324 | $ echo large3 > large3 |
|
324 | $ echo large3 > large3 | |
325 | $ hg commit .hglf/large3 -m "try to commit standin" |
|
325 | $ hg commit .hglf/large3 -m "try to commit standin" | |
326 | abort: file ".hglf/large3" is a largefile standin |
|
326 | abort: file ".hglf/large3" is a largefile standin | |
327 | (commit the largefile itself instead) |
|
327 | (commit the largefile itself instead) | |
328 | [255] |
|
328 | [255] | |
329 |
|
329 | |||
330 | Corner cases for adding largefiles. |
|
330 | Corner cases for adding largefiles. | |
331 |
|
331 | |||
332 | $ echo large5 > large5 |
|
332 | $ echo large5 > large5 | |
333 | $ hg add --large large5 |
|
333 | $ hg add --large large5 | |
334 | $ hg add --large large5 |
|
334 | $ hg add --large large5 | |
335 | large5 already a largefile |
|
335 | large5 already a largefile | |
336 | $ mkdir sub2 |
|
336 | $ mkdir sub2 | |
337 | $ echo large6 > sub2/large6 |
|
337 | $ echo large6 > sub2/large6 | |
338 | $ echo large7 > sub2/large7 |
|
338 | $ echo large7 > sub2/large7 | |
339 | $ hg add --large sub2 |
|
339 | $ hg add --large sub2 | |
340 | adding sub2/large6 as a largefile (glob) |
|
340 | adding sub2/large6 as a largefile (glob) | |
341 | adding sub2/large7 as a largefile (glob) |
|
341 | adding sub2/large7 as a largefile (glob) | |
342 | $ hg st |
|
342 | $ hg st | |
343 | M large3 |
|
343 | M large3 | |
344 | A large5 |
|
344 | A large5 | |
345 | A sub2/large6 |
|
345 | A sub2/large6 | |
346 | A sub2/large7 |
|
346 | A sub2/large7 | |
347 |
|
347 | |||
348 | Test "hg status" with combination of 'file pattern' and 'directory |
|
348 | Test "hg status" with combination of 'file pattern' and 'directory | |
349 | pattern' for largefiles: |
|
349 | pattern' for largefiles: | |
350 |
|
350 | |||
351 | $ hg status sub2/large6 sub2 |
|
351 | $ hg status sub2/large6 sub2 | |
352 | A sub2/large6 |
|
352 | A sub2/large6 | |
353 | A sub2/large7 |
|
353 | A sub2/large7 | |
354 |
|
354 | |||
355 | Config settings (pattern **.dat, minsize 2 MB) are respected. |
|
355 | Config settings (pattern **.dat, minsize 2 MB) are respected. | |
356 |
|
356 | |||
357 | $ echo testdata > test.dat |
|
357 | $ echo testdata > test.dat | |
358 | $ dd bs=1k count=2k if=/dev/zero of=reallylarge > /dev/null 2> /dev/null |
|
358 | $ dd bs=1k count=2k if=/dev/zero of=reallylarge > /dev/null 2> /dev/null | |
359 | $ hg add |
|
359 | $ hg add | |
360 | adding reallylarge as a largefile |
|
360 | adding reallylarge as a largefile | |
361 | adding test.dat as a largefile |
|
361 | adding test.dat as a largefile | |
362 |
|
362 | |||
363 | Test that minsize and --lfsize handle float values; |
|
363 | Test that minsize and --lfsize handle float values; | |
364 | also tests that --lfsize overrides largefiles.minsize. |
|
364 | also tests that --lfsize overrides largefiles.minsize. | |
365 | (0.250 MB = 256 kB = 262144 B) |
|
365 | (0.250 MB = 256 kB = 262144 B) | |
366 |
|
366 | |||
367 | $ dd if=/dev/zero of=ratherlarge bs=1024 count=256 > /dev/null 2> /dev/null |
|
367 | $ dd if=/dev/zero of=ratherlarge bs=1024 count=256 > /dev/null 2> /dev/null | |
368 | $ dd if=/dev/zero of=medium bs=1024 count=128 > /dev/null 2> /dev/null |
|
368 | $ dd if=/dev/zero of=medium bs=1024 count=128 > /dev/null 2> /dev/null | |
369 | $ hg --config largefiles.minsize=.25 add |
|
369 | $ hg --config largefiles.minsize=.25 add | |
370 | adding ratherlarge as a largefile |
|
370 | adding ratherlarge as a largefile | |
371 | adding medium |
|
371 | adding medium | |
372 | $ hg forget medium |
|
372 | $ hg forget medium | |
373 | $ hg --config largefiles.minsize=.25 add --lfsize=.125 |
|
373 | $ hg --config largefiles.minsize=.25 add --lfsize=.125 | |
374 | adding medium as a largefile |
|
374 | adding medium as a largefile | |
375 | $ dd if=/dev/zero of=notlarge bs=1024 count=127 > /dev/null 2> /dev/null |
|
375 | $ dd if=/dev/zero of=notlarge bs=1024 count=127 > /dev/null 2> /dev/null | |
376 | $ hg --config largefiles.minsize=.25 add --lfsize=.125 |
|
376 | $ hg --config largefiles.minsize=.25 add --lfsize=.125 | |
377 | adding notlarge |
|
377 | adding notlarge | |
378 | $ hg forget notlarge |
|
378 | $ hg forget notlarge | |
379 |
|
379 | |||
380 | Test forget on largefiles. |
|
380 | Test forget on largefiles. | |
381 |
|
381 | |||
382 | $ hg forget large3 large5 test.dat reallylarge ratherlarge medium |
|
382 | $ hg forget large3 large5 test.dat reallylarge ratherlarge medium | |
383 | $ hg commit -m "add/edit more largefiles" |
|
383 | $ hg commit -m "add/edit more largefiles" | |
384 | Invoking status precommit hook |
|
384 | Invoking status precommit hook | |
385 | A sub2/large6 |
|
385 | A sub2/large6 | |
386 | A sub2/large7 |
|
386 | A sub2/large7 | |
387 | R large3 |
|
387 | R large3 | |
388 | ? large5 |
|
388 | ? large5 | |
389 | ? medium |
|
389 | ? medium | |
390 | ? notlarge |
|
390 | ? notlarge | |
391 | ? ratherlarge |
|
391 | ? ratherlarge | |
392 | ? reallylarge |
|
392 | ? reallylarge | |
393 | ? test.dat |
|
393 | ? test.dat | |
394 | $ hg st |
|
394 | $ hg st | |
395 | ? large3 |
|
395 | ? large3 | |
396 | ? large5 |
|
396 | ? large5 | |
397 | ? medium |
|
397 | ? medium | |
398 | ? notlarge |
|
398 | ? notlarge | |
399 | ? ratherlarge |
|
399 | ? ratherlarge | |
400 | ? reallylarge |
|
400 | ? reallylarge | |
401 | ? test.dat |
|
401 | ? test.dat | |
402 |
|
402 | |||
403 | Purge with largefiles: verify that largefiles are still in the working |
|
403 | Purge with largefiles: verify that largefiles are still in the working | |
404 | dir after a purge. |
|
404 | dir after a purge. | |
405 |
|
405 | |||
406 | $ hg purge --all |
|
406 | $ hg purge --all | |
407 | $ cat sub/large4 |
|
407 | $ cat sub/large4 | |
408 | large44 |
|
408 | large44 | |
409 | $ cat sub2/large6 |
|
409 | $ cat sub2/large6 | |
410 | large6 |
|
410 | large6 | |
411 | $ cat sub2/large7 |
|
411 | $ cat sub2/large7 | |
412 | large7 |
|
412 | large7 | |
413 |
|
413 | |||
414 | Test addremove: verify that files that should be added as largfiles are added as |
|
414 | Test addremove: verify that files that should be added as largfiles are added as | |
415 | such and that already-existing largfiles are not added as normal files by |
|
415 | such and that already-existing largfiles are not added as normal files by | |
416 | accident. |
|
416 | accident. | |
417 |
|
417 | |||
418 | $ rm normal3 |
|
418 | $ rm normal3 | |
419 | $ rm sub/large4 |
|
419 | $ rm sub/large4 | |
420 | $ echo "testing addremove with patterns" > testaddremove.dat |
|
420 | $ echo "testing addremove with patterns" > testaddremove.dat | |
421 | $ echo "normaladdremove" > normaladdremove |
|
421 | $ echo "normaladdremove" > normaladdremove | |
422 | $ hg addremove |
|
422 | $ hg addremove | |
423 | removing sub/large4 |
|
423 | removing sub/large4 | |
424 | adding testaddremove.dat as a largefile |
|
424 | adding testaddremove.dat as a largefile | |
425 | removing normal3 |
|
425 | removing normal3 | |
426 | adding normaladdremove |
|
426 | adding normaladdremove | |
427 |
|
427 | |||
428 | Test addremove with -R |
|
428 | Test addremove with -R | |
429 |
|
429 | |||
430 | $ hg up -C |
|
430 | $ hg up -C | |
431 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
431 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
432 | getting changed largefiles |
|
432 | getting changed largefiles | |
433 | 1 largefiles updated, 0 removed |
|
433 | 1 largefiles updated, 0 removed | |
434 | $ rm normal3 |
|
434 | $ rm normal3 | |
435 | $ rm sub/large4 |
|
435 | $ rm sub/large4 | |
436 | $ echo "testing addremove with patterns" > testaddremove.dat |
|
436 | $ echo "testing addremove with patterns" > testaddremove.dat | |
437 | $ echo "normaladdremove" > normaladdremove |
|
437 | $ echo "normaladdremove" > normaladdremove | |
438 | $ cd .. |
|
438 | $ cd .. | |
439 | $ hg -R a addremove |
|
439 | $ hg -R a addremove | |
440 | removing sub/large4 |
|
440 | removing sub/large4 | |
441 | adding a/testaddremove.dat as a largefile (glob) |
|
441 | adding a/testaddremove.dat as a largefile (glob) | |
442 | removing normal3 |
|
442 | removing normal3 | |
443 | adding normaladdremove |
|
443 | adding normaladdremove | |
444 | $ cd a |
|
444 | $ cd a | |
445 |
|
445 | |||
446 | Test 3364 |
|
446 | Test 3364 | |
447 | $ hg clone . ../addrm |
|
447 | $ hg clone . ../addrm | |
448 | updating to branch default |
|
448 | updating to branch default | |
449 | 5 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
449 | 5 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
450 | getting changed largefiles |
|
450 | getting changed largefiles | |
451 | 3 largefiles updated, 0 removed |
|
451 | 3 largefiles updated, 0 removed | |
452 | $ cd ../addrm |
|
452 | $ cd ../addrm | |
453 | $ cat >> .hg/hgrc <<EOF |
|
453 | $ cat >> .hg/hgrc <<EOF | |
454 | > [hooks] |
|
454 | > [hooks] | |
455 | > post-commit.stat=sh -c "echo \\"Invoking status postcommit hook\\"; hg status -A" |
|
455 | > post-commit.stat=sh -c "echo \\"Invoking status postcommit hook\\"; hg status -A" | |
456 | > EOF |
|
456 | > EOF | |
457 | $ touch foo |
|
457 | $ touch foo | |
458 | $ hg add --large foo |
|
458 | $ hg add --large foo | |
459 | $ hg ci -m "add foo" |
|
459 | $ hg ci -m "add foo" | |
460 | Invoking status precommit hook |
|
460 | Invoking status precommit hook | |
461 | A foo |
|
461 | A foo | |
462 | Invoking status postcommit hook |
|
462 | Invoking status postcommit hook | |
463 | C foo |
|
463 | C foo | |
464 | C normal3 |
|
464 | C normal3 | |
465 | C sub/large4 |
|
465 | C sub/large4 | |
466 | C sub/normal4 |
|
466 | C sub/normal4 | |
467 | C sub2/large6 |
|
467 | C sub2/large6 | |
468 | C sub2/large7 |
|
468 | C sub2/large7 | |
469 | $ rm foo |
|
469 | $ rm foo | |
470 | $ hg st |
|
470 | $ hg st | |
471 | ! foo |
|
471 | ! foo | |
472 | hmm.. no precommit invoked, but there is a postcommit?? |
|
472 | hmm.. no precommit invoked, but there is a postcommit?? | |
473 | $ hg ci -m "will not checkin" |
|
473 | $ hg ci -m "will not checkin" | |
474 | nothing changed |
|
474 | nothing changed | |
475 | Invoking status postcommit hook |
|
475 | Invoking status postcommit hook | |
476 | ! foo |
|
476 | ! foo | |
477 | C normal3 |
|
477 | C normal3 | |
478 | C sub/large4 |
|
478 | C sub/large4 | |
479 | C sub/normal4 |
|
479 | C sub/normal4 | |
480 | C sub2/large6 |
|
480 | C sub2/large6 | |
481 | C sub2/large7 |
|
481 | C sub2/large7 | |
482 | [1] |
|
482 | [1] | |
483 | $ hg addremove |
|
483 | $ hg addremove | |
484 | removing foo |
|
484 | removing foo | |
485 | $ hg st |
|
485 | $ hg st | |
486 | R foo |
|
486 | R foo | |
487 | $ hg ci -m "used to say nothing changed" |
|
487 | $ hg ci -m "used to say nothing changed" | |
488 | Invoking status precommit hook |
|
488 | Invoking status precommit hook | |
489 | R foo |
|
489 | R foo | |
490 | Invoking status postcommit hook |
|
490 | Invoking status postcommit hook | |
491 | C normal3 |
|
491 | C normal3 | |
492 | C sub/large4 |
|
492 | C sub/large4 | |
493 | C sub/normal4 |
|
493 | C sub/normal4 | |
494 | C sub2/large6 |
|
494 | C sub2/large6 | |
495 | C sub2/large7 |
|
495 | C sub2/large7 | |
496 | $ hg st |
|
496 | $ hg st | |
497 |
|
497 | |||
498 | Test 3507 (both normal files and largefiles were a problem) |
|
498 | Test 3507 (both normal files and largefiles were a problem) | |
499 |
|
499 | |||
500 | $ touch normal |
|
500 | $ touch normal | |
501 | $ touch large |
|
501 | $ touch large | |
502 | $ hg add normal |
|
502 | $ hg add normal | |
503 | $ hg add --large large |
|
503 | $ hg add --large large | |
504 | $ hg ci -m "added" |
|
504 | $ hg ci -m "added" | |
505 | Invoking status precommit hook |
|
505 | Invoking status precommit hook | |
506 | A large |
|
506 | A large | |
507 | A normal |
|
507 | A normal | |
508 | Invoking status postcommit hook |
|
508 | Invoking status postcommit hook | |
509 | C large |
|
509 | C large | |
510 | C normal |
|
510 | C normal | |
511 | C normal3 |
|
511 | C normal3 | |
512 | C sub/large4 |
|
512 | C sub/large4 | |
513 | C sub/normal4 |
|
513 | C sub/normal4 | |
514 | C sub2/large6 |
|
514 | C sub2/large6 | |
515 | C sub2/large7 |
|
515 | C sub2/large7 | |
516 | $ hg remove normal |
|
516 | $ hg remove normal | |
517 | $ hg addremove --traceback |
|
517 | $ hg addremove --traceback | |
518 | $ hg ci -m "addremoved normal" |
|
518 | $ hg ci -m "addremoved normal" | |
519 | Invoking status precommit hook |
|
519 | Invoking status precommit hook | |
520 | R normal |
|
520 | R normal | |
521 | Invoking status postcommit hook |
|
521 | Invoking status postcommit hook | |
522 | C large |
|
522 | C large | |
523 | C normal3 |
|
523 | C normal3 | |
524 | C sub/large4 |
|
524 | C sub/large4 | |
525 | C sub/normal4 |
|
525 | C sub/normal4 | |
526 | C sub2/large6 |
|
526 | C sub2/large6 | |
527 | C sub2/large7 |
|
527 | C sub2/large7 | |
528 | $ hg up -C '.^' |
|
528 | $ hg up -C '.^' | |
529 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
529 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
530 | getting changed largefiles |
|
530 | getting changed largefiles | |
531 | 0 largefiles updated, 0 removed |
|
531 | 0 largefiles updated, 0 removed | |
532 | $ hg remove large |
|
532 | $ hg remove large | |
533 | $ hg addremove --traceback |
|
533 | $ hg addremove --traceback | |
534 | $ hg ci -m "removed large" |
|
534 | $ hg ci -m "removed large" | |
535 | Invoking status precommit hook |
|
535 | Invoking status precommit hook | |
536 | R large |
|
536 | R large | |
537 | created new head |
|
537 | created new head | |
538 | Invoking status postcommit hook |
|
538 | Invoking status postcommit hook | |
539 | C normal |
|
539 | C normal | |
540 | C normal3 |
|
540 | C normal3 | |
541 | C sub/large4 |
|
541 | C sub/large4 | |
542 | C sub/normal4 |
|
542 | C sub/normal4 | |
543 | C sub2/large6 |
|
543 | C sub2/large6 | |
544 | C sub2/large7 |
|
544 | C sub2/large7 | |
545 |
|
545 | |||
546 | Test commit -A (issue 3542) |
|
546 | Test commit -A (issue 3542) | |
547 | $ echo large8 > large8 |
|
547 | $ echo large8 > large8 | |
548 | $ hg add --large large8 |
|
548 | $ hg add --large large8 | |
549 | $ hg ci -Am 'this used to add large8 as normal and commit both' |
|
549 | $ hg ci -Am 'this used to add large8 as normal and commit both' | |
550 | Invoking status precommit hook |
|
550 | Invoking status precommit hook | |
551 | A large8 |
|
551 | A large8 | |
552 | Invoking status postcommit hook |
|
552 | Invoking status postcommit hook | |
553 | C large8 |
|
553 | C large8 | |
554 | C normal |
|
554 | C normal | |
555 | C normal3 |
|
555 | C normal3 | |
556 | C sub/large4 |
|
556 | C sub/large4 | |
557 | C sub/normal4 |
|
557 | C sub/normal4 | |
558 | C sub2/large6 |
|
558 | C sub2/large6 | |
559 | C sub2/large7 |
|
559 | C sub2/large7 | |
560 | $ rm large8 |
|
560 | $ rm large8 | |
561 | $ hg ci -Am 'this used to not notice the rm' |
|
561 | $ hg ci -Am 'this used to not notice the rm' | |
562 | removing large8 |
|
562 | removing large8 | |
563 | Invoking status precommit hook |
|
563 | Invoking status precommit hook | |
564 | R large8 |
|
564 | R large8 | |
565 | Invoking status postcommit hook |
|
565 | Invoking status postcommit hook | |
566 | C normal |
|
566 | C normal | |
567 | C normal3 |
|
567 | C normal3 | |
568 | C sub/large4 |
|
568 | C sub/large4 | |
569 | C sub/normal4 |
|
569 | C sub/normal4 | |
570 | C sub2/large6 |
|
570 | C sub2/large6 | |
571 | C sub2/large7 |
|
571 | C sub2/large7 | |
572 |
|
572 | |||
573 | Test that a standin can't be added as a large file |
|
573 | Test that a standin can't be added as a large file | |
574 |
|
574 | |||
575 | $ touch large |
|
575 | $ touch large | |
576 | $ hg add --large large |
|
576 | $ hg add --large large | |
577 | $ hg ci -m "add" |
|
577 | $ hg ci -m "add" | |
578 | Invoking status precommit hook |
|
578 | Invoking status precommit hook | |
579 | A large |
|
579 | A large | |
580 | Invoking status postcommit hook |
|
580 | Invoking status postcommit hook | |
581 | C large |
|
581 | C large | |
582 | C normal |
|
582 | C normal | |
583 | C normal3 |
|
583 | C normal3 | |
584 | C sub/large4 |
|
584 | C sub/large4 | |
585 | C sub/normal4 |
|
585 | C sub/normal4 | |
586 | C sub2/large6 |
|
586 | C sub2/large6 | |
587 | C sub2/large7 |
|
587 | C sub2/large7 | |
588 | $ hg remove large |
|
588 | $ hg remove large | |
589 | $ touch large |
|
589 | $ touch large | |
590 | $ hg addremove --config largefiles.patterns=**large --traceback |
|
590 | $ hg addremove --config largefiles.patterns=**large --traceback | |
591 | adding large as a largefile |
|
591 | adding large as a largefile | |
592 |
|
592 | |||
593 | Test that outgoing --large works (with revsets too) |
|
593 | Test that outgoing --large works (with revsets too) | |
594 | $ hg outgoing --rev '.^' --large |
|
594 | $ hg outgoing --rev '.^' --large | |
595 | comparing with $TESTTMP/a (glob) |
|
595 | comparing with $TESTTMP/a (glob) | |
596 | searching for changes |
|
596 | searching for changes | |
597 | changeset: 8:c02fd3b77ec4 |
|
597 | changeset: 8:c02fd3b77ec4 | |
598 | user: test |
|
598 | user: test | |
599 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
599 | date: Thu Jan 01 00:00:00 1970 +0000 | |
600 | summary: add foo |
|
600 | summary: add foo | |
601 |
|
601 | |||
602 | changeset: 9:289dd08c9bbb |
|
602 | changeset: 9:289dd08c9bbb | |
603 | user: test |
|
603 | user: test | |
604 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
604 | date: Thu Jan 01 00:00:00 1970 +0000 | |
605 | summary: used to say nothing changed |
|
605 | summary: used to say nothing changed | |
606 |
|
606 | |||
607 | changeset: 10:34f23ac6ac12 |
|
607 | changeset: 10:34f23ac6ac12 | |
608 | user: test |
|
608 | user: test | |
609 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
609 | date: Thu Jan 01 00:00:00 1970 +0000 | |
610 | summary: added |
|
610 | summary: added | |
611 |
|
611 | |||
612 | changeset: 12:710c1b2f523c |
|
612 | changeset: 12:710c1b2f523c | |
613 | parent: 10:34f23ac6ac12 |
|
613 | parent: 10:34f23ac6ac12 | |
614 | user: test |
|
614 | user: test | |
615 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
615 | date: Thu Jan 01 00:00:00 1970 +0000 | |
616 | summary: removed large |
|
616 | summary: removed large | |
617 |
|
617 | |||
618 | changeset: 13:0a3e75774479 |
|
618 | changeset: 13:0a3e75774479 | |
619 | user: test |
|
619 | user: test | |
620 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
620 | date: Thu Jan 01 00:00:00 1970 +0000 | |
621 | summary: this used to add large8 as normal and commit both |
|
621 | summary: this used to add large8 as normal and commit both | |
622 |
|
622 | |||
623 | changeset: 14:84f3d378175c |
|
623 | changeset: 14:84f3d378175c | |
624 | user: test |
|
624 | user: test | |
625 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
625 | date: Thu Jan 01 00:00:00 1970 +0000 | |
626 | summary: this used to not notice the rm |
|
626 | summary: this used to not notice the rm | |
627 |
|
627 | |||
628 | searching for changes |
|
628 | searching for changes | |
629 | largefiles to upload: |
|
629 | largefiles to upload: | |
630 | large8 |
|
630 | large8 | |
631 | large |
|
631 | large | |
632 | foo |
|
632 | foo | |
633 |
|
633 | |||
634 | $ cd ../a |
|
634 | $ cd ../a | |
635 |
|
635 | |||
636 | Clone a largefiles repo. |
|
636 | Clone a largefiles repo. | |
637 |
|
637 | |||
638 | $ hg clone . ../b |
|
638 | $ hg clone . ../b | |
639 | updating to branch default |
|
639 | updating to branch default | |
640 | 5 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
640 | 5 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
641 | getting changed largefiles |
|
641 | getting changed largefiles | |
642 | 3 largefiles updated, 0 removed |
|
642 | 3 largefiles updated, 0 removed | |
643 | $ cd ../b |
|
643 | $ cd ../b | |
644 | $ hg log --template '{rev}:{node|short} {desc|firstline}\n' |
|
644 | $ hg log --template '{rev}:{node|short} {desc|firstline}\n' | |
645 | 7:daea875e9014 add/edit more largefiles |
|
645 | 7:daea875e9014 add/edit more largefiles | |
646 | 6:4355d653f84f edit files yet again |
|
646 | 6:4355d653f84f edit files yet again | |
647 | 5:9d5af5072dbd edit files again |
|
647 | 5:9d5af5072dbd edit files again | |
648 | 4:74c02385b94c move files |
|
648 | 4:74c02385b94c move files | |
649 | 3:9e8fbc4bce62 copy files |
|
649 | 3:9e8fbc4bce62 copy files | |
650 | 2:51a0ae4d5864 remove files |
|
650 | 2:51a0ae4d5864 remove files | |
651 | 1:ce8896473775 edit files |
|
651 | 1:ce8896473775 edit files | |
652 | 0:30d30fe6a5be add files |
|
652 | 0:30d30fe6a5be add files | |
653 | $ cat normal3 |
|
653 | $ cat normal3 | |
654 | normal33 |
|
654 | normal33 | |
655 | $ cat sub/normal4 |
|
655 | $ cat sub/normal4 | |
656 | normal44 |
|
656 | normal44 | |
657 | $ cat sub/large4 |
|
657 | $ cat sub/large4 | |
658 | large44 |
|
658 | large44 | |
659 | $ cat sub2/large6 |
|
659 | $ cat sub2/large6 | |
660 | large6 |
|
660 | large6 | |
661 | $ cat sub2/large7 |
|
661 | $ cat sub2/large7 | |
662 | large7 |
|
662 | large7 | |
663 | $ cd .. |
|
663 | $ cd .. | |
664 | $ hg clone a -r 3 c |
|
664 | $ hg clone a -r 3 c | |
665 | adding changesets |
|
665 | adding changesets | |
666 | adding manifests |
|
666 | adding manifests | |
667 | adding file changes |
|
667 | adding file changes | |
668 | added 4 changesets with 10 changes to 4 files |
|
668 | added 4 changesets with 10 changes to 4 files | |
669 | updating to branch default |
|
669 | updating to branch default | |
670 | 4 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
670 | 4 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
671 | getting changed largefiles |
|
671 | getting changed largefiles | |
672 | 2 largefiles updated, 0 removed |
|
672 | 2 largefiles updated, 0 removed | |
673 | $ cd c |
|
673 | $ cd c | |
674 | $ hg log --template '{rev}:{node|short} {desc|firstline}\n' |
|
674 | $ hg log --template '{rev}:{node|short} {desc|firstline}\n' | |
675 | 3:9e8fbc4bce62 copy files |
|
675 | 3:9e8fbc4bce62 copy files | |
676 | 2:51a0ae4d5864 remove files |
|
676 | 2:51a0ae4d5864 remove files | |
677 | 1:ce8896473775 edit files |
|
677 | 1:ce8896473775 edit files | |
678 | 0:30d30fe6a5be add files |
|
678 | 0:30d30fe6a5be add files | |
679 | $ cat normal1 |
|
679 | $ cat normal1 | |
680 | normal22 |
|
680 | normal22 | |
681 | $ cat large1 |
|
681 | $ cat large1 | |
682 | large22 |
|
682 | large22 | |
683 | $ cat sub/normal2 |
|
683 | $ cat sub/normal2 | |
684 | normal22 |
|
684 | normal22 | |
685 | $ cat sub/large2 |
|
685 | $ cat sub/large2 | |
686 | large22 |
|
686 | large22 | |
687 |
|
687 | |||
688 | Old revisions of a clone have correct largefiles content (this also |
|
688 | Old revisions of a clone have correct largefiles content (this also | |
689 | tests update). |
|
689 | tests update). | |
690 |
|
690 | |||
691 | $ hg update -r 1 |
|
691 | $ hg update -r 1 | |
692 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
692 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
693 | getting changed largefiles |
|
693 | getting changed largefiles | |
694 | 1 largefiles updated, 0 removed |
|
694 | 1 largefiles updated, 0 removed | |
695 | $ cat large1 |
|
695 | $ cat large1 | |
696 | large11 |
|
696 | large11 | |
697 | $ cat sub/large2 |
|
697 | $ cat sub/large2 | |
698 | large22 |
|
698 | large22 | |
699 | $ cd .. |
|
699 | $ cd .. | |
700 |
|
700 | |||
701 | Test cloning with --all-largefiles flag |
|
701 | Test cloning with --all-largefiles flag | |
702 |
|
702 | |||
703 | $ rm "${USERCACHE}"/* |
|
703 | $ rm "${USERCACHE}"/* | |
704 | $ hg clone --all-largefiles a a-backup |
|
704 | $ hg clone --all-largefiles a a-backup | |
705 | updating to branch default |
|
705 | updating to branch default | |
706 | 5 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
706 | 5 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
707 | getting changed largefiles |
|
707 | getting changed largefiles | |
708 | 3 largefiles updated, 0 removed |
|
708 | 3 largefiles updated, 0 removed | |
709 | 8 additional largefiles cached |
|
709 | 8 additional largefiles cached | |
710 |
|
710 | |||
711 | $ rm "${USERCACHE}"/* |
|
711 | $ rm "${USERCACHE}"/* | |
712 | $ hg clone --all-largefiles -u 0 a a-clone0 |
|
712 | $ hg clone --all-largefiles -u 0 a a-clone0 | |
713 | updating to branch default |
|
713 | updating to branch default | |
714 | 4 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
714 | 4 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
715 | getting changed largefiles |
|
715 | getting changed largefiles | |
716 | 2 largefiles updated, 0 removed |
|
716 | 2 largefiles updated, 0 removed | |
717 | 9 additional largefiles cached |
|
717 | 9 additional largefiles cached | |
718 | $ hg -R a-clone0 sum |
|
718 | $ hg -R a-clone0 sum | |
719 | parent: 0:30d30fe6a5be |
|
719 | parent: 0:30d30fe6a5be | |
720 | add files |
|
720 | add files | |
721 | branch: default |
|
721 | branch: default | |
722 | commit: (clean) |
|
722 | commit: (clean) | |
723 | update: 7 new changesets (update) |
|
723 | update: 7 new changesets (update) | |
724 |
|
724 | |||
725 | $ rm "${USERCACHE}"/* |
|
725 | $ rm "${USERCACHE}"/* | |
726 | $ hg clone --all-largefiles -u 1 a a-clone1 |
|
726 | $ hg clone --all-largefiles -u 1 a a-clone1 | |
727 | updating to branch default |
|
727 | updating to branch default | |
728 | 4 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
728 | 4 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
729 | getting changed largefiles |
|
729 | getting changed largefiles | |
730 | 2 largefiles updated, 0 removed |
|
730 | 2 largefiles updated, 0 removed | |
731 | 8 additional largefiles cached |
|
731 | 8 additional largefiles cached | |
732 | $ hg -R a-clone1 sum |
|
732 | $ hg -R a-clone1 sum | |
733 | parent: 1:ce8896473775 |
|
733 | parent: 1:ce8896473775 | |
734 | edit files |
|
734 | edit files | |
735 | branch: default |
|
735 | branch: default | |
736 | commit: (clean) |
|
736 | commit: (clean) | |
737 | update: 6 new changesets (update) |
|
737 | update: 6 new changesets (update) | |
738 |
|
738 | |||
739 | $ rm "${USERCACHE}"/* |
|
739 | $ rm "${USERCACHE}"/* | |
740 | $ hg clone --all-largefiles -U a a-clone-u |
|
740 | $ hg clone --all-largefiles -U a a-clone-u | |
741 | 11 additional largefiles cached |
|
741 | 11 additional largefiles cached | |
742 | $ hg -R a-clone-u sum |
|
742 | $ hg -R a-clone-u sum | |
743 | parent: -1:000000000000 (no revision checked out) |
|
743 | parent: -1:000000000000 (no revision checked out) | |
744 | branch: default |
|
744 | branch: default | |
745 | commit: (clean) |
|
745 | commit: (clean) | |
746 | update: 8 new changesets (update) |
|
746 | update: 8 new changesets (update) | |
747 |
|
747 | |||
748 | $ mkdir xyz |
|
748 | $ mkdir xyz | |
749 | $ cd xyz |
|
749 | $ cd xyz | |
750 | $ hg clone ../a |
|
750 | $ hg clone ../a | |
751 | destination directory: a |
|
751 | destination directory: a | |
752 | updating to branch default |
|
752 | updating to branch default | |
753 | 5 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
753 | 5 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
754 | getting changed largefiles |
|
754 | getting changed largefiles | |
755 | 3 largefiles updated, 0 removed |
|
755 | 3 largefiles updated, 0 removed | |
756 | $ cd .. |
|
756 | $ cd .. | |
757 |
|
757 | |||
758 | Ensure base clone command argument validation |
|
758 | Ensure base clone command argument validation | |
759 |
|
759 | |||
760 | $ hg clone -U -u 0 a a-clone-failure |
|
760 | $ hg clone -U -u 0 a a-clone-failure | |
761 | abort: cannot specify both --noupdate and --updaterev |
|
761 | abort: cannot specify both --noupdate and --updaterev | |
762 | [255] |
|
762 | [255] | |
763 |
|
763 | |||
764 | $ hg clone --all-largefiles a ssh://localhost/a |
|
764 | $ hg clone --all-largefiles a ssh://localhost/a | |
765 | abort: --all-largefiles is incompatible with non-local destination ssh://localhost/a |
|
765 | abort: --all-largefiles is incompatible with non-local destination ssh://localhost/a | |
766 | [255] |
|
766 | [255] | |
767 |
|
767 | |||
768 | Test pulling with --all-largefiles flag |
|
768 | Test pulling with --all-largefiles flag | |
769 |
|
769 | |||
770 | $ rm -Rf a-backup |
|
770 | $ rm -Rf a-backup | |
771 | $ hg clone -r 1 a a-backup |
|
771 | $ hg clone -r 1 a a-backup | |
772 | adding changesets |
|
772 | adding changesets | |
773 | adding manifests |
|
773 | adding manifests | |
774 | adding file changes |
|
774 | adding file changes | |
775 | added 2 changesets with 8 changes to 4 files |
|
775 | added 2 changesets with 8 changes to 4 files | |
776 | updating to branch default |
|
776 | updating to branch default | |
777 | 4 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
777 | 4 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
778 | getting changed largefiles |
|
778 | getting changed largefiles | |
779 | 2 largefiles updated, 0 removed |
|
779 | 2 largefiles updated, 0 removed | |
780 | $ rm "${USERCACHE}"/* |
|
780 | $ rm "${USERCACHE}"/* | |
781 | $ cd a-backup |
|
781 | $ cd a-backup | |
782 | $ hg pull --all-largefiles |
|
782 | $ hg pull --all-largefiles | |
783 | pulling from $TESTTMP/a (glob) |
|
783 | pulling from $TESTTMP/a (glob) | |
784 | searching for changes |
|
784 | searching for changes | |
785 | adding changesets |
|
785 | adding changesets | |
786 | adding manifests |
|
786 | adding manifests | |
787 | adding file changes |
|
787 | adding file changes | |
788 | added 6 changesets with 16 changes to 8 files |
|
788 | added 6 changesets with 16 changes to 8 files | |
789 | (run 'hg update' to get a working copy) |
|
789 | (run 'hg update' to get a working copy) | |
790 | caching new largefiles |
|
790 | caching new largefiles | |
791 | 3 largefiles cached |
|
791 | 3 largefiles cached | |
792 | 3 additional largefiles cached |
|
792 | 3 additional largefiles cached | |
793 | $ cd .. |
|
793 | $ cd .. | |
794 |
|
794 | |||
795 | Rebasing between two repositories does not revert largefiles to old |
|
795 | Rebasing between two repositories does not revert largefiles to old | |
796 | revisions (this was a very bad bug that took a lot of work to fix). |
|
796 | revisions (this was a very bad bug that took a lot of work to fix). | |
797 |
|
797 | |||
798 | $ hg clone a d |
|
798 | $ hg clone a d | |
799 | updating to branch default |
|
799 | updating to branch default | |
800 | 5 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
800 | 5 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
801 | getting changed largefiles |
|
801 | getting changed largefiles | |
802 | 3 largefiles updated, 0 removed |
|
802 | 3 largefiles updated, 0 removed | |
803 | $ cd b |
|
803 | $ cd b | |
804 | $ echo large4-modified > sub/large4 |
|
804 | $ echo large4-modified > sub/large4 | |
805 | $ echo normal3-modified > normal3 |
|
805 | $ echo normal3-modified > normal3 | |
806 | $ hg commit -m "modify normal file and largefile in repo b" |
|
806 | $ hg commit -m "modify normal file and largefile in repo b" | |
807 | Invoking status precommit hook |
|
807 | Invoking status precommit hook | |
808 | M normal3 |
|
808 | M normal3 | |
809 | M sub/large4 |
|
809 | M sub/large4 | |
810 | $ cd ../d |
|
810 | $ cd ../d | |
811 | $ echo large6-modified > sub2/large6 |
|
811 | $ echo large6-modified > sub2/large6 | |
812 | $ echo normal4-modified > sub/normal4 |
|
812 | $ echo normal4-modified > sub/normal4 | |
813 | $ hg commit -m "modify normal file largefile in repo d" |
|
813 | $ hg commit -m "modify normal file largefile in repo d" | |
814 | Invoking status precommit hook |
|
814 | Invoking status precommit hook | |
815 | M sub/normal4 |
|
815 | M sub/normal4 | |
816 | M sub2/large6 |
|
816 | M sub2/large6 | |
817 | $ cd .. |
|
817 | $ cd .. | |
818 | $ hg clone d e |
|
818 | $ hg clone d e | |
819 | updating to branch default |
|
819 | updating to branch default | |
820 | 5 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
820 | 5 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
821 | getting changed largefiles |
|
821 | getting changed largefiles | |
822 | 3 largefiles updated, 0 removed |
|
822 | 3 largefiles updated, 0 removed | |
823 | $ cd d |
|
823 | $ cd d | |
824 | $ hg pull --rebase ../b |
|
824 | $ hg pull --rebase ../b | |
825 | pulling from ../b |
|
825 | pulling from ../b | |
826 | searching for changes |
|
826 | searching for changes | |
827 | adding changesets |
|
827 | adding changesets | |
828 | adding manifests |
|
828 | adding manifests | |
829 | adding file changes |
|
829 | adding file changes | |
830 | added 1 changesets with 2 changes to 2 files (+1 heads) |
|
830 | added 1 changesets with 2 changes to 2 files (+1 heads) | |
831 | Invoking status precommit hook |
|
831 | Invoking status precommit hook | |
832 | M sub/normal4 |
|
832 | M sub/normal4 | |
833 | M sub2/large6 |
|
833 | M sub2/large6 | |
834 | saved backup bundle to $TESTTMP/d/.hg/strip-backup/f574fb32bb45-backup.hg (glob) |
|
834 | saved backup bundle to $TESTTMP/d/.hg/strip-backup/f574fb32bb45-backup.hg (glob) | |
835 | nothing to rebase |
|
835 | nothing to rebase | |
836 | $ hg log --template '{rev}:{node|short} {desc|firstline}\n' |
|
836 | $ hg log --template '{rev}:{node|short} {desc|firstline}\n' | |
837 | 9:598410d3eb9a modify normal file largefile in repo d |
|
837 | 9:598410d3eb9a modify normal file largefile in repo d | |
838 | 8:a381d2c8c80e modify normal file and largefile in repo b |
|
838 | 8:a381d2c8c80e modify normal file and largefile in repo b | |
839 | 7:daea875e9014 add/edit more largefiles |
|
839 | 7:daea875e9014 add/edit more largefiles | |
840 | 6:4355d653f84f edit files yet again |
|
840 | 6:4355d653f84f edit files yet again | |
841 | 5:9d5af5072dbd edit files again |
|
841 | 5:9d5af5072dbd edit files again | |
842 | 4:74c02385b94c move files |
|
842 | 4:74c02385b94c move files | |
843 | 3:9e8fbc4bce62 copy files |
|
843 | 3:9e8fbc4bce62 copy files | |
844 | 2:51a0ae4d5864 remove files |
|
844 | 2:51a0ae4d5864 remove files | |
845 | 1:ce8896473775 edit files |
|
845 | 1:ce8896473775 edit files | |
846 | 0:30d30fe6a5be add files |
|
846 | 0:30d30fe6a5be add files | |
847 | $ cat normal3 |
|
847 | $ cat normal3 | |
848 | normal3-modified |
|
848 | normal3-modified | |
849 | $ cat sub/normal4 |
|
849 | $ cat sub/normal4 | |
850 | normal4-modified |
|
850 | normal4-modified | |
851 | $ cat sub/large4 |
|
851 | $ cat sub/large4 | |
852 | large4-modified |
|
852 | large4-modified | |
853 | $ cat sub2/large6 |
|
853 | $ cat sub2/large6 | |
854 | large6-modified |
|
854 | large6-modified | |
855 | $ cat sub2/large7 |
|
855 | $ cat sub2/large7 | |
856 | large7 |
|
856 | large7 | |
857 | $ cd ../e |
|
857 | $ cd ../e | |
858 | $ hg pull ../b |
|
858 | $ hg pull ../b | |
859 | pulling from ../b |
|
859 | pulling from ../b | |
860 | searching for changes |
|
860 | searching for changes | |
861 | adding changesets |
|
861 | adding changesets | |
862 | adding manifests |
|
862 | adding manifests | |
863 | adding file changes |
|
863 | adding file changes | |
864 | added 1 changesets with 2 changes to 2 files (+1 heads) |
|
864 | added 1 changesets with 2 changes to 2 files (+1 heads) | |
865 | (run 'hg heads' to see heads, 'hg merge' to merge) |
|
865 | (run 'hg heads' to see heads, 'hg merge' to merge) | |
866 | caching new largefiles |
|
866 | caching new largefiles | |
867 | 0 largefiles cached |
|
867 | 0 largefiles cached | |
868 | $ hg rebase |
|
868 | $ hg rebase | |
869 | Invoking status precommit hook |
|
869 | Invoking status precommit hook | |
870 | M sub/normal4 |
|
870 | M sub/normal4 | |
871 | M sub2/large6 |
|
871 | M sub2/large6 | |
872 | saved backup bundle to $TESTTMP/e/.hg/strip-backup/f574fb32bb45-backup.hg (glob) |
|
872 | saved backup bundle to $TESTTMP/e/.hg/strip-backup/f574fb32bb45-backup.hg (glob) | |
873 | $ hg log --template '{rev}:{node|short} {desc|firstline}\n' |
|
873 | $ hg log --template '{rev}:{node|short} {desc|firstline}\n' | |
874 | 9:598410d3eb9a modify normal file largefile in repo d |
|
874 | 9:598410d3eb9a modify normal file largefile in repo d | |
875 | 8:a381d2c8c80e modify normal file and largefile in repo b |
|
875 | 8:a381d2c8c80e modify normal file and largefile in repo b | |
876 | 7:daea875e9014 add/edit more largefiles |
|
876 | 7:daea875e9014 add/edit more largefiles | |
877 | 6:4355d653f84f edit files yet again |
|
877 | 6:4355d653f84f edit files yet again | |
878 | 5:9d5af5072dbd edit files again |
|
878 | 5:9d5af5072dbd edit files again | |
879 | 4:74c02385b94c move files |
|
879 | 4:74c02385b94c move files | |
880 | 3:9e8fbc4bce62 copy files |
|
880 | 3:9e8fbc4bce62 copy files | |
881 | 2:51a0ae4d5864 remove files |
|
881 | 2:51a0ae4d5864 remove files | |
882 | 1:ce8896473775 edit files |
|
882 | 1:ce8896473775 edit files | |
883 | 0:30d30fe6a5be add files |
|
883 | 0:30d30fe6a5be add files | |
884 | $ cat normal3 |
|
884 | $ cat normal3 | |
885 | normal3-modified |
|
885 | normal3-modified | |
886 | $ cat sub/normal4 |
|
886 | $ cat sub/normal4 | |
887 | normal4-modified |
|
887 | normal4-modified | |
888 | $ cat sub/large4 |
|
888 | $ cat sub/large4 | |
889 | large4-modified |
|
889 | large4-modified | |
890 | $ cat sub2/large6 |
|
890 | $ cat sub2/large6 | |
891 | large6-modified |
|
891 | large6-modified | |
892 | $ cat sub2/large7 |
|
892 | $ cat sub2/large7 | |
893 | large7 |
|
893 | large7 | |
894 |
|
894 | |||
895 | Rollback on largefiles. |
|
895 | Rollback on largefiles. | |
896 |
|
896 | |||
897 | $ echo large4-modified-again > sub/large4 |
|
897 | $ echo large4-modified-again > sub/large4 | |
898 | $ hg commit -m "Modify large4 again" |
|
898 | $ hg commit -m "Modify large4 again" | |
899 | Invoking status precommit hook |
|
899 | Invoking status precommit hook | |
900 | M sub/large4 |
|
900 | M sub/large4 | |
901 | $ hg rollback |
|
901 | $ hg rollback | |
902 | repository tip rolled back to revision 9 (undo commit) |
|
902 | repository tip rolled back to revision 9 (undo commit) | |
903 | working directory now based on revision 9 |
|
903 | working directory now based on revision 9 | |
904 | $ hg st |
|
904 | $ hg st | |
905 | M sub/large4 |
|
905 | M sub/large4 | |
906 | $ hg log --template '{rev}:{node|short} {desc|firstline}\n' |
|
906 | $ hg log --template '{rev}:{node|short} {desc|firstline}\n' | |
907 | 9:598410d3eb9a modify normal file largefile in repo d |
|
907 | 9:598410d3eb9a modify normal file largefile in repo d | |
908 | 8:a381d2c8c80e modify normal file and largefile in repo b |
|
908 | 8:a381d2c8c80e modify normal file and largefile in repo b | |
909 | 7:daea875e9014 add/edit more largefiles |
|
909 | 7:daea875e9014 add/edit more largefiles | |
910 | 6:4355d653f84f edit files yet again |
|
910 | 6:4355d653f84f edit files yet again | |
911 | 5:9d5af5072dbd edit files again |
|
911 | 5:9d5af5072dbd edit files again | |
912 | 4:74c02385b94c move files |
|
912 | 4:74c02385b94c move files | |
913 | 3:9e8fbc4bce62 copy files |
|
913 | 3:9e8fbc4bce62 copy files | |
914 | 2:51a0ae4d5864 remove files |
|
914 | 2:51a0ae4d5864 remove files | |
915 | 1:ce8896473775 edit files |
|
915 | 1:ce8896473775 edit files | |
916 | 0:30d30fe6a5be add files |
|
916 | 0:30d30fe6a5be add files | |
917 | $ cat sub/large4 |
|
917 | $ cat sub/large4 | |
918 | large4-modified-again |
|
918 | large4-modified-again | |
919 |
|
919 | |||
920 | "update --check" refuses to update with uncommitted changes. |
|
920 | "update --check" refuses to update with uncommitted changes. | |
921 | $ hg update --check 8 |
|
921 | $ hg update --check 8 | |
922 | abort: uncommitted local changes |
|
922 | abort: uncommitted local changes | |
923 | [255] |
|
923 | [255] | |
924 |
|
924 | |||
925 | "update --clean" leaves correct largefiles in working copy. |
|
925 | "update --clean" leaves correct largefiles in working copy. | |
926 |
|
926 | |||
927 | $ hg update --clean |
|
927 | $ hg update --clean | |
928 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
928 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
929 | getting changed largefiles |
|
929 | getting changed largefiles | |
930 | 1 largefiles updated, 0 removed |
|
930 | 1 largefiles updated, 0 removed | |
931 | $ cat normal3 |
|
931 | $ cat normal3 | |
932 | normal3-modified |
|
932 | normal3-modified | |
933 | $ cat sub/normal4 |
|
933 | $ cat sub/normal4 | |
934 | normal4-modified |
|
934 | normal4-modified | |
935 | $ cat sub/large4 |
|
935 | $ cat sub/large4 | |
936 | large4-modified |
|
936 | large4-modified | |
937 | $ cat sub2/large6 |
|
937 | $ cat sub2/large6 | |
938 | large6-modified |
|
938 | large6-modified | |
939 | $ cat sub2/large7 |
|
939 | $ cat sub2/large7 | |
940 | large7 |
|
940 | large7 | |
941 |
|
941 | |||
942 | Now "update check" is happy. |
|
942 | Now "update check" is happy. | |
943 | $ hg update --check 8 |
|
943 | $ hg update --check 8 | |
944 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
944 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
945 | getting changed largefiles |
|
945 | getting changed largefiles | |
946 | 1 largefiles updated, 0 removed |
|
946 | 1 largefiles updated, 0 removed | |
947 | $ hg update --check |
|
947 | $ hg update --check | |
948 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
948 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
949 | getting changed largefiles |
|
949 | getting changed largefiles | |
950 | 1 largefiles updated, 0 removed |
|
950 | 1 largefiles updated, 0 removed | |
951 |
|
951 | |||
952 | Test removing empty largefiles directories on update |
|
952 | Test removing empty largefiles directories on update | |
953 | $ test -d sub2 && echo "sub2 exists" |
|
953 | $ test -d sub2 && echo "sub2 exists" | |
954 | sub2 exists |
|
954 | sub2 exists | |
955 | $ hg update -q null |
|
955 | $ hg update -q null | |
956 | $ test -d sub2 && echo "error: sub2 should not exist anymore" |
|
956 | $ test -d sub2 && echo "error: sub2 should not exist anymore" | |
957 | [1] |
|
957 | [1] | |
958 | $ hg update -q |
|
958 | $ hg update -q | |
959 |
|
959 | |||
960 | Test hg remove removes empty largefiles directories |
|
960 | Test hg remove removes empty largefiles directories | |
961 | $ test -d sub2 && echo "sub2 exists" |
|
961 | $ test -d sub2 && echo "sub2 exists" | |
962 | sub2 exists |
|
962 | sub2 exists | |
963 | $ hg remove sub2/* |
|
963 | $ hg remove sub2/* | |
964 | $ test -d sub2 && echo "error: sub2 should not exist anymore" |
|
964 | $ test -d sub2 && echo "error: sub2 should not exist anymore" | |
965 | [1] |
|
965 | [1] | |
966 | $ hg revert sub2/large6 sub2/large7 |
|
966 | $ hg revert sub2/large6 sub2/large7 | |
967 |
|
967 | |||
968 | "revert" works on largefiles (and normal files too). |
|
968 | "revert" works on largefiles (and normal files too). | |
969 | $ echo hack3 >> normal3 |
|
969 | $ echo hack3 >> normal3 | |
970 | $ echo hack4 >> sub/normal4 |
|
970 | $ echo hack4 >> sub/normal4 | |
971 | $ echo hack4 >> sub/large4 |
|
971 | $ echo hack4 >> sub/large4 | |
972 | $ rm sub2/large6 |
|
972 | $ rm sub2/large6 | |
973 | $ hg revert sub2/large6 |
|
973 | $ hg revert sub2/large6 | |
974 | $ hg rm sub2/large6 |
|
974 | $ hg rm sub2/large6 | |
975 | $ echo new >> sub2/large8 |
|
975 | $ echo new >> sub2/large8 | |
976 | $ hg add --large sub2/large8 |
|
976 | $ hg add --large sub2/large8 | |
977 | # XXX we don't really want to report that we're reverting the standin; |
|
977 | # XXX we don't really want to report that we're reverting the standin; | |
978 | # that's just an implementation detail. But I don't see an obvious fix. ;-( |
|
978 | # that's just an implementation detail. But I don't see an obvious fix. ;-( | |
979 | $ hg revert sub |
|
979 | $ hg revert sub | |
980 | reverting .hglf/sub/large4 (glob) |
|
980 | reverting .hglf/sub/large4 (glob) | |
981 | reverting sub/normal4 (glob) |
|
981 | reverting sub/normal4 (glob) | |
982 | $ hg status |
|
982 | $ hg status | |
983 | M normal3 |
|
983 | M normal3 | |
984 | A sub2/large8 |
|
984 | A sub2/large8 | |
985 | R sub2/large6 |
|
985 | R sub2/large6 | |
986 | ? sub/large4.orig |
|
986 | ? sub/large4.orig | |
987 | ? sub/normal4.orig |
|
987 | ? sub/normal4.orig | |
988 | $ cat sub/normal4 |
|
988 | $ cat sub/normal4 | |
989 | normal4-modified |
|
989 | normal4-modified | |
990 | $ cat sub/large4 |
|
990 | $ cat sub/large4 | |
991 | large4-modified |
|
991 | large4-modified | |
992 | $ hg revert -a --no-backup |
|
992 | $ hg revert -a --no-backup | |
993 | undeleting .hglf/sub2/large6 (glob) |
|
993 | undeleting .hglf/sub2/large6 (glob) | |
994 | forgetting .hglf/sub2/large8 (glob) |
|
994 | forgetting .hglf/sub2/large8 (glob) | |
995 | reverting normal3 |
|
995 | reverting normal3 | |
996 | $ hg status |
|
996 | $ hg status | |
997 | ? sub/large4.orig |
|
997 | ? sub/large4.orig | |
998 | ? sub/normal4.orig |
|
998 | ? sub/normal4.orig | |
999 | ? sub2/large8 |
|
999 | ? sub2/large8 | |
1000 | $ cat normal3 |
|
1000 | $ cat normal3 | |
1001 | normal3-modified |
|
1001 | normal3-modified | |
1002 | $ cat sub2/large6 |
|
1002 | $ cat sub2/large6 | |
1003 | large6-modified |
|
1003 | large6-modified | |
1004 | $ rm sub/*.orig sub2/large8 |
|
1004 | $ rm sub/*.orig sub2/large8 | |
1005 |
|
1005 | |||
1006 | revert some files to an older revision |
|
1006 | revert some files to an older revision | |
1007 | $ hg revert --no-backup -r 8 sub2 |
|
1007 | $ hg revert --no-backup -r 8 sub2 | |
1008 | reverting .hglf/sub2/large6 (glob) |
|
1008 | reverting .hglf/sub2/large6 (glob) | |
1009 | $ cat sub2/large6 |
|
1009 | $ cat sub2/large6 | |
1010 | large6 |
|
1010 | large6 | |
1011 | $ hg revert --no-backup -C -r '.^' sub2 |
|
1011 | $ hg revert --no-backup -C -r '.^' sub2 | |
1012 | reverting .hglf/sub2/large6 (glob) |
|
1012 | reverting .hglf/sub2/large6 (glob) | |
1013 | $ hg revert --no-backup sub2 |
|
1013 | $ hg revert --no-backup sub2 | |
1014 | reverting .hglf/sub2/large6 (glob) |
|
1014 | reverting .hglf/sub2/large6 (glob) | |
1015 | $ hg status |
|
1015 | $ hg status | |
1016 |
|
1016 | |||
1017 | "verify --large" actually verifies largefiles |
|
1017 | "verify --large" actually verifies largefiles | |
1018 |
|
1018 | |||
1019 | $ hg verify --large |
|
1019 | $ hg verify --large | |
1020 | checking changesets |
|
1020 | checking changesets | |
1021 | checking manifests |
|
1021 | checking manifests | |
1022 | crosschecking files in changesets and manifests |
|
1022 | crosschecking files in changesets and manifests | |
1023 | checking files |
|
1023 | checking files | |
1024 | 10 files, 10 changesets, 28 total revisions |
|
1024 | 10 files, 10 changesets, 28 total revisions | |
1025 | searching 1 changesets for largefiles |
|
1025 | searching 1 changesets for largefiles | |
1026 | verified existence of 3 revisions of 3 largefiles |
|
1026 | verified existence of 3 revisions of 3 largefiles | |
1027 |
|
1027 | |||
1028 | Merging does not revert to old versions of largefiles and also check |
|
1028 | Merging does not revert to old versions of largefiles and also check | |
1029 | that merging after having pulled from a non-default remote works |
|
1029 | that merging after having pulled from a non-default remote works | |
1030 | correctly. |
|
1030 | correctly. | |
1031 |
|
1031 | |||
1032 | $ cd .. |
|
1032 | $ cd .. | |
1033 | $ hg clone -r 7 e temp |
|
1033 | $ hg clone -r 7 e temp | |
1034 | adding changesets |
|
1034 | adding changesets | |
1035 | adding manifests |
|
1035 | adding manifests | |
1036 | adding file changes |
|
1036 | adding file changes | |
1037 | added 8 changesets with 24 changes to 10 files |
|
1037 | added 8 changesets with 24 changes to 10 files | |
1038 | updating to branch default |
|
1038 | updating to branch default | |
1039 | 5 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
1039 | 5 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
1040 | getting changed largefiles |
|
1040 | getting changed largefiles | |
1041 | 3 largefiles updated, 0 removed |
|
1041 | 3 largefiles updated, 0 removed | |
1042 | $ hg clone temp f |
|
1042 | $ hg clone temp f | |
1043 | updating to branch default |
|
1043 | updating to branch default | |
1044 | 5 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
1044 | 5 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
1045 | getting changed largefiles |
|
1045 | getting changed largefiles | |
1046 | 3 largefiles updated, 0 removed |
|
1046 | 3 largefiles updated, 0 removed | |
1047 | # Delete the largefiles in the largefiles system cache so that we have an |
|
1047 | # Delete the largefiles in the largefiles system cache so that we have an | |
1048 | # opportunity to test that caching after a pull works. |
|
1048 | # opportunity to test that caching after a pull works. | |
1049 | $ rm "${USERCACHE}"/* |
|
1049 | $ rm "${USERCACHE}"/* | |
1050 | $ cd f |
|
1050 | $ cd f | |
1051 | $ echo "large4-merge-test" > sub/large4 |
|
1051 | $ echo "large4-merge-test" > sub/large4 | |
1052 | $ hg commit -m "Modify large4 to test merge" |
|
1052 | $ hg commit -m "Modify large4 to test merge" | |
1053 | Invoking status precommit hook |
|
1053 | Invoking status precommit hook | |
1054 | M sub/large4 |
|
1054 | M sub/large4 | |
1055 | $ hg pull ../e |
|
1055 | $ hg pull ../e | |
1056 | pulling from ../e |
|
1056 | pulling from ../e | |
1057 | searching for changes |
|
1057 | searching for changes | |
1058 | adding changesets |
|
1058 | adding changesets | |
1059 | adding manifests |
|
1059 | adding manifests | |
1060 | adding file changes |
|
1060 | adding file changes | |
1061 | added 2 changesets with 4 changes to 4 files (+1 heads) |
|
1061 | added 2 changesets with 4 changes to 4 files (+1 heads) | |
1062 | (run 'hg heads' to see heads, 'hg merge' to merge) |
|
1062 | (run 'hg heads' to see heads, 'hg merge' to merge) | |
1063 | caching new largefiles |
|
1063 | caching new largefiles | |
1064 | 2 largefiles cached |
|
1064 | 2 largefiles cached | |
1065 | $ hg merge |
|
1065 | $ hg merge | |
1066 | merging sub/large4 |
|
1066 | merging sub/large4 | |
1067 | largefile sub/large4 has a merge conflict |
|
1067 | largefile sub/large4 has a merge conflict | |
1068 | keep (l)ocal or take (o)ther? l |
|
1068 | keep (l)ocal or take (o)ther? l | |
1069 | 3 files updated, 1 files merged, 0 files removed, 0 files unresolved |
|
1069 | 3 files updated, 1 files merged, 0 files removed, 0 files unresolved | |
1070 | (branch merge, don't forget to commit) |
|
1070 | (branch merge, don't forget to commit) | |
1071 | getting changed largefiles |
|
1071 | getting changed largefiles | |
1072 | 1 largefiles updated, 0 removed |
|
1072 | 1 largefiles updated, 0 removed | |
1073 | $ hg commit -m "Merge repos e and f" |
|
1073 | $ hg commit -m "Merge repos e and f" | |
1074 | Invoking status precommit hook |
|
1074 | Invoking status precommit hook | |
1075 | M normal3 |
|
1075 | M normal3 | |
1076 | M sub/normal4 |
|
1076 | M sub/normal4 | |
1077 | M sub2/large6 |
|
1077 | M sub2/large6 | |
1078 | $ cat normal3 |
|
1078 | $ cat normal3 | |
1079 | normal3-modified |
|
1079 | normal3-modified | |
1080 | $ cat sub/normal4 |
|
1080 | $ cat sub/normal4 | |
1081 | normal4-modified |
|
1081 | normal4-modified | |
1082 | $ cat sub/large4 |
|
1082 | $ cat sub/large4 | |
1083 | large4-merge-test |
|
1083 | large4-merge-test | |
1084 | $ cat sub2/large6 |
|
1084 | $ cat sub2/large6 | |
1085 | large6-modified |
|
1085 | large6-modified | |
1086 | $ cat sub2/large7 |
|
1086 | $ cat sub2/large7 | |
1087 | large7 |
|
1087 | large7 | |
1088 |
|
1088 | |||
1089 | Test status after merging with a branch that introduces a new largefile: |
|
1089 | Test status after merging with a branch that introduces a new largefile: | |
1090 |
|
1090 | |||
1091 | $ echo large > large |
|
1091 | $ echo large > large | |
1092 | $ hg add --large large |
|
1092 | $ hg add --large large | |
1093 | $ hg commit -m 'add largefile' |
|
1093 | $ hg commit -m 'add largefile' | |
1094 | Invoking status precommit hook |
|
1094 | Invoking status precommit hook | |
1095 | A large |
|
1095 | A large | |
1096 | $ hg update -q ".^" |
|
1096 | $ hg update -q ".^" | |
1097 | $ echo change >> normal3 |
|
1097 | $ echo change >> normal3 | |
1098 | $ hg commit -m 'some change' |
|
1098 | $ hg commit -m 'some change' | |
1099 | Invoking status precommit hook |
|
1099 | Invoking status precommit hook | |
1100 | M normal3 |
|
1100 | M normal3 | |
1101 | created new head |
|
1101 | created new head | |
1102 | $ hg merge |
|
1102 | $ hg merge | |
1103 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
1103 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
1104 | (branch merge, don't forget to commit) |
|
1104 | (branch merge, don't forget to commit) | |
1105 | getting changed largefiles |
|
1105 | getting changed largefiles | |
1106 | 1 largefiles updated, 0 removed |
|
1106 | 1 largefiles updated, 0 removed | |
1107 | $ hg status |
|
1107 | $ hg status | |
1108 | M large |
|
1108 | M large | |
1109 |
|
1109 | |||
1110 | Test that a normal file and a largefile with the same name and path cannot |
|
1110 | Test that a normal file and a largefile with the same name and path cannot | |
1111 | coexist. |
|
1111 | coexist. | |
1112 |
|
1112 | |||
1113 | $ rm sub2/large7 |
|
1113 | $ rm sub2/large7 | |
1114 | $ echo "largeasnormal" > sub2/large7 |
|
1114 | $ echo "largeasnormal" > sub2/large7 | |
1115 | $ hg add sub2/large7 |
|
1115 | $ hg add sub2/large7 | |
1116 | sub2/large7 already a largefile |
|
1116 | sub2/large7 already a largefile | |
1117 |
|
1117 | |||
1118 | Test that transplanting a largefile change works correctly. |
|
1118 | Test that transplanting a largefile change works correctly. | |
1119 |
|
1119 | |||
1120 | $ cd .. |
|
1120 | $ cd .. | |
1121 | $ hg clone -r 8 d g |
|
1121 | $ hg clone -r 8 d g | |
1122 | adding changesets |
|
1122 | adding changesets | |
1123 | adding manifests |
|
1123 | adding manifests | |
1124 | adding file changes |
|
1124 | adding file changes | |
1125 | added 9 changesets with 26 changes to 10 files |
|
1125 | added 9 changesets with 26 changes to 10 files | |
1126 | updating to branch default |
|
1126 | updating to branch default | |
1127 | 5 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
1127 | 5 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
1128 | getting changed largefiles |
|
1128 | getting changed largefiles | |
1129 | 3 largefiles updated, 0 removed |
|
1129 | 3 largefiles updated, 0 removed | |
1130 | $ cd g |
|
1130 | $ cd g | |
1131 | $ hg transplant -s ../d 598410d3eb9a |
|
1131 | $ hg transplant -s ../d 598410d3eb9a | |
1132 | searching for changes |
|
1132 | searching for changes | |
1133 | searching for changes |
|
1133 | searching for changes | |
1134 | adding changesets |
|
1134 | adding changesets | |
1135 | adding manifests |
|
1135 | adding manifests | |
1136 | adding file changes |
|
1136 | adding file changes | |
1137 | added 1 changesets with 2 changes to 2 files |
|
1137 | added 1 changesets with 2 changes to 2 files | |
1138 | getting changed largefiles |
|
1138 | getting changed largefiles | |
1139 | 1 largefiles updated, 0 removed |
|
1139 | 1 largefiles updated, 0 removed | |
1140 | $ hg log --template '{rev}:{node|short} {desc|firstline}\n' |
|
1140 | $ hg log --template '{rev}:{node|short} {desc|firstline}\n' | |
1141 | 9:598410d3eb9a modify normal file largefile in repo d |
|
1141 | 9:598410d3eb9a modify normal file largefile in repo d | |
1142 | 8:a381d2c8c80e modify normal file and largefile in repo b |
|
1142 | 8:a381d2c8c80e modify normal file and largefile in repo b | |
1143 | 7:daea875e9014 add/edit more largefiles |
|
1143 | 7:daea875e9014 add/edit more largefiles | |
1144 | 6:4355d653f84f edit files yet again |
|
1144 | 6:4355d653f84f edit files yet again | |
1145 | 5:9d5af5072dbd edit files again |
|
1145 | 5:9d5af5072dbd edit files again | |
1146 | 4:74c02385b94c move files |
|
1146 | 4:74c02385b94c move files | |
1147 | 3:9e8fbc4bce62 copy files |
|
1147 | 3:9e8fbc4bce62 copy files | |
1148 | 2:51a0ae4d5864 remove files |
|
1148 | 2:51a0ae4d5864 remove files | |
1149 | 1:ce8896473775 edit files |
|
1149 | 1:ce8896473775 edit files | |
1150 | 0:30d30fe6a5be add files |
|
1150 | 0:30d30fe6a5be add files | |
1151 | $ cat normal3 |
|
1151 | $ cat normal3 | |
1152 | normal3-modified |
|
1152 | normal3-modified | |
1153 | $ cat sub/normal4 |
|
1153 | $ cat sub/normal4 | |
1154 | normal4-modified |
|
1154 | normal4-modified | |
1155 | $ cat sub/large4 |
|
1155 | $ cat sub/large4 | |
1156 | large4-modified |
|
1156 | large4-modified | |
1157 | $ cat sub2/large6 |
|
1157 | $ cat sub2/large6 | |
1158 | large6-modified |
|
1158 | large6-modified | |
1159 | $ cat sub2/large7 |
|
1159 | $ cat sub2/large7 | |
1160 | large7 |
|
1160 | large7 | |
1161 |
|
1161 | |||
1162 | Cat a largefile |
|
1162 | Cat a largefile | |
1163 | $ hg cat normal3 |
|
1163 | $ hg cat normal3 | |
1164 | normal3-modified |
|
1164 | normal3-modified | |
1165 | $ hg cat sub/large4 |
|
1165 | $ hg cat sub/large4 | |
1166 | large4-modified |
|
1166 | large4-modified | |
1167 | $ rm "${USERCACHE}"/* |
|
1167 | $ rm "${USERCACHE}"/* | |
1168 | $ hg cat -r a381d2c8c80e -o cat.out sub/large4 |
|
1168 | $ hg cat -r a381d2c8c80e -o cat.out sub/large4 | |
1169 | $ cat cat.out |
|
1169 | $ cat cat.out | |
1170 | large4-modified |
|
1170 | large4-modified | |
1171 | $ rm cat.out |
|
1171 | $ rm cat.out | |
1172 | $ hg cat -r a381d2c8c80e normal3 |
|
1172 | $ hg cat -r a381d2c8c80e normal3 | |
1173 | normal3-modified |
|
1173 | normal3-modified | |
1174 | $ hg cat -r '.^' normal3 |
|
1174 | $ hg cat -r '.^' normal3 | |
1175 | normal3-modified |
|
1175 | normal3-modified | |
1176 | $ hg cat -r '.^' sub/large4 |
|
1176 | $ hg cat -r '.^' sub/large4 | |
1177 | large4-modified |
|
1177 | large4-modified | |
1178 |
|
1178 | |||
1179 | Test that renaming a largefile results in correct output for status |
|
1179 | Test that renaming a largefile results in correct output for status | |
1180 |
|
1180 | |||
1181 | $ hg rename sub/large4 large4-renamed |
|
1181 | $ hg rename sub/large4 large4-renamed | |
1182 | $ hg commit -m "test rename output" |
|
1182 | $ hg commit -m "test rename output" | |
1183 | Invoking status precommit hook |
|
1183 | Invoking status precommit hook | |
1184 | A large4-renamed |
|
1184 | A large4-renamed | |
1185 | R sub/large4 |
|
1185 | R sub/large4 | |
1186 | $ cat large4-renamed |
|
1186 | $ cat large4-renamed | |
1187 | large4-modified |
|
1187 | large4-modified | |
1188 | $ cd sub2 |
|
1188 | $ cd sub2 | |
1189 | $ hg rename large6 large6-renamed |
|
1189 | $ hg rename large6 large6-renamed | |
1190 | $ hg st |
|
1190 | $ hg st | |
1191 | A sub2/large6-renamed |
|
1191 | A sub2/large6-renamed | |
1192 | R sub2/large6 |
|
1192 | R sub2/large6 | |
1193 | $ cd .. |
|
1193 | $ cd .. | |
1194 |
|
1194 | |||
1195 | Test --normal flag |
|
1195 | Test --normal flag | |
1196 |
|
1196 | |||
1197 | $ dd if=/dev/zero bs=2k count=11k > new-largefile 2> /dev/null |
|
1197 | $ dd if=/dev/zero bs=2k count=11k > new-largefile 2> /dev/null | |
1198 | $ hg add --normal --large new-largefile |
|
1198 | $ hg add --normal --large new-largefile | |
1199 | abort: --normal cannot be used with --large |
|
1199 | abort: --normal cannot be used with --large | |
1200 | [255] |
|
1200 | [255] | |
1201 | $ hg add --normal new-largefile |
|
1201 | $ hg add --normal new-largefile | |
1202 | new-largefile: up to 69 MB of RAM may be required to manage this file |
|
1202 | new-largefile: up to 69 MB of RAM may be required to manage this file | |
1203 | (use 'hg revert new-largefile' to cancel the pending addition) |
|
1203 | (use 'hg revert new-largefile' to cancel the pending addition) | |
1204 | $ cd .. |
|
1204 | $ cd .. | |
1205 |
|
1205 | |||
1206 | #if serve |
|
1206 | #if serve | |
1207 | vanilla clients not locked out from largefiles servers on vanilla repos |
|
1207 | vanilla clients not locked out from largefiles servers on vanilla repos | |
1208 | $ mkdir r1 |
|
1208 | $ mkdir r1 | |
1209 | $ cd r1 |
|
1209 | $ cd r1 | |
1210 | $ hg init |
|
1210 | $ hg init | |
1211 | $ echo c1 > f1 |
|
1211 | $ echo c1 > f1 | |
1212 | $ hg add f1 |
|
1212 | $ hg add f1 | |
1213 | $ hg commit -m "m1" |
|
1213 | $ hg commit -m "m1" | |
1214 | Invoking status precommit hook |
|
1214 | Invoking status precommit hook | |
1215 | A f1 |
|
1215 | A f1 | |
1216 | $ cd .. |
|
1216 | $ cd .. | |
1217 | $ hg serve -R r1 -d -p $HGPORT --pid-file hg.pid |
|
1217 | $ hg serve -R r1 -d -p $HGPORT --pid-file hg.pid | |
1218 | $ cat hg.pid >> $DAEMON_PIDS |
|
1218 | $ cat hg.pid >> $DAEMON_PIDS | |
1219 | $ hg --config extensions.largefiles=! clone http://localhost:$HGPORT r2 |
|
1219 | $ hg --config extensions.largefiles=! clone http://localhost:$HGPORT r2 | |
1220 | requesting all changes |
|
1220 | requesting all changes | |
1221 | adding changesets |
|
1221 | adding changesets | |
1222 | adding manifests |
|
1222 | adding manifests | |
1223 | adding file changes |
|
1223 | adding file changes | |
1224 | added 1 changesets with 1 changes to 1 files |
|
1224 | added 1 changesets with 1 changes to 1 files | |
1225 | updating to branch default |
|
1225 | updating to branch default | |
1226 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
1226 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
1227 |
|
1227 | |||
1228 | largefiles clients still work with vanilla servers |
|
1228 | largefiles clients still work with vanilla servers | |
1229 | $ hg --config extensions.largefiles=! serve -R r1 -d -p $HGPORT1 --pid-file hg.pid |
|
1229 | $ hg --config extensions.largefiles=! serve -R r1 -d -p $HGPORT1 --pid-file hg.pid | |
1230 | $ cat hg.pid >> $DAEMON_PIDS |
|
1230 | $ cat hg.pid >> $DAEMON_PIDS | |
1231 | $ hg clone http://localhost:$HGPORT1 r3 |
|
1231 | $ hg clone http://localhost:$HGPORT1 r3 | |
1232 | requesting all changes |
|
1232 | requesting all changes | |
1233 | adding changesets |
|
1233 | adding changesets | |
1234 | adding manifests |
|
1234 | adding manifests | |
1235 | adding file changes |
|
1235 | adding file changes | |
1236 | added 1 changesets with 1 changes to 1 files |
|
1236 | added 1 changesets with 1 changes to 1 files | |
1237 | updating to branch default |
|
1237 | updating to branch default | |
1238 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
1238 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
1239 | #endif |
|
1239 | #endif | |
1240 |
|
1240 | |||
1241 |
|
1241 | |||
1242 | vanilla clients locked out from largefiles http repos |
|
1242 | vanilla clients locked out from largefiles http repos | |
1243 | $ mkdir r4 |
|
1243 | $ mkdir r4 | |
1244 | $ cd r4 |
|
1244 | $ cd r4 | |
1245 | $ hg init |
|
1245 | $ hg init | |
1246 | $ echo c1 > f1 |
|
1246 | $ echo c1 > f1 | |
1247 | $ hg add --large f1 |
|
1247 | $ hg add --large f1 | |
1248 | $ hg commit -m "m1" |
|
1248 | $ hg commit -m "m1" | |
1249 | Invoking status precommit hook |
|
1249 | Invoking status precommit hook | |
1250 | A f1 |
|
1250 | A f1 | |
1251 | $ cd .. |
|
1251 | $ cd .. | |
1252 |
|
1252 | |||
1253 | largefiles can be pushed locally (issue3583) |
|
1253 | largefiles can be pushed locally (issue3583) | |
1254 | $ hg init dest |
|
1254 | $ hg init dest | |
1255 | $ cd r4 |
|
1255 | $ cd r4 | |
1256 | $ hg outgoing ../dest |
|
1256 | $ hg outgoing ../dest | |
1257 | comparing with ../dest |
|
1257 | comparing with ../dest | |
1258 | searching for changes |
|
1258 | searching for changes | |
1259 | changeset: 0:639881c12b4c |
|
1259 | changeset: 0:639881c12b4c | |
1260 | tag: tip |
|
1260 | tag: tip | |
1261 | user: test |
|
1261 | user: test | |
1262 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
1262 | date: Thu Jan 01 00:00:00 1970 +0000 | |
1263 | summary: m1 |
|
1263 | summary: m1 | |
1264 |
|
1264 | |||
1265 | $ hg push ../dest |
|
1265 | $ hg push ../dest | |
1266 | pushing to ../dest |
|
1266 | pushing to ../dest | |
1267 | searching for changes |
|
1267 | searching for changes | |
1268 | searching for changes |
|
1268 | searching for changes | |
1269 | adding changesets |
|
1269 | adding changesets | |
1270 | adding manifests |
|
1270 | adding manifests | |
1271 | adding file changes |
|
1271 | adding file changes | |
1272 | added 1 changesets with 1 changes to 1 files |
|
1272 | added 1 changesets with 1 changes to 1 files | |
1273 |
|
1273 | |||
1274 | exit code with nothing outgoing (issue3611) |
|
1274 | exit code with nothing outgoing (issue3611) | |
1275 | $ hg outgoing ../dest |
|
1275 | $ hg outgoing ../dest | |
1276 | comparing with ../dest |
|
1276 | comparing with ../dest | |
1277 | searching for changes |
|
1277 | searching for changes | |
1278 | no changes found |
|
1278 | no changes found | |
1279 | [1] |
|
1279 | [1] | |
1280 | $ cd .. |
|
1280 | $ cd .. | |
1281 |
|
1281 | |||
1282 | #if serve |
|
1282 | #if serve | |
1283 | $ hg serve -R r4 -d -p $HGPORT2 --pid-file hg.pid |
|
1283 | $ hg serve -R r4 -d -p $HGPORT2 --pid-file hg.pid | |
1284 | $ cat hg.pid >> $DAEMON_PIDS |
|
1284 | $ cat hg.pid >> $DAEMON_PIDS | |
1285 | $ hg --config extensions.largefiles=! clone http://localhost:$HGPORT2 r5 |
|
1285 | $ hg --config extensions.largefiles=! clone http://localhost:$HGPORT2 r5 | |
1286 | abort: remote error: |
|
1286 | abort: remote error: | |
1287 |
|
1287 | |||
1288 | This repository uses the largefiles extension. |
|
1288 | This repository uses the largefiles extension. | |
1289 |
|
1289 | |||
1290 | Please enable it in your Mercurial config file. |
|
1290 | Please enable it in your Mercurial config file. | |
1291 | [255] |
|
1291 | [255] | |
1292 |
|
1292 | |||
1293 | used all HGPORTs, kill all daemons |
|
1293 | used all HGPORTs, kill all daemons | |
1294 | $ "$TESTDIR/killdaemons.py" $DAEMON_PIDS |
|
1294 | $ "$TESTDIR/killdaemons.py" $DAEMON_PIDS | |
1295 | #endif |
|
1295 | #endif | |
1296 |
|
1296 | |||
1297 | vanilla clients locked out from largefiles ssh repos |
|
1297 | vanilla clients locked out from largefiles ssh repos | |
1298 | $ hg --config extensions.largefiles=! clone -e "python \"$TESTDIR/dummyssh\"" ssh://user@dummy/r4 r5 |
|
1298 | $ hg --config extensions.largefiles=! clone -e "python \"$TESTDIR/dummyssh\"" ssh://user@dummy/r4 r5 | |
1299 | abort: remote error: |
|
1299 | abort: remote error: | |
1300 |
|
1300 | |||
1301 | This repository uses the largefiles extension. |
|
1301 | This repository uses the largefiles extension. | |
1302 |
|
1302 | |||
1303 | Please enable it in your Mercurial config file. |
|
1303 | Please enable it in your Mercurial config file. | |
1304 | [255] |
|
1304 | [255] | |
1305 |
|
1305 | |||
1306 | #if serve |
|
1306 | #if serve | |
1307 |
|
1307 | |||
1308 | largefiles clients refuse to push largefiles repos to vanilla servers |
|
1308 | largefiles clients refuse to push largefiles repos to vanilla servers | |
1309 | $ mkdir r6 |
|
1309 | $ mkdir r6 | |
1310 | $ cd r6 |
|
1310 | $ cd r6 | |
1311 | $ hg init |
|
1311 | $ hg init | |
1312 | $ echo c1 > f1 |
|
1312 | $ echo c1 > f1 | |
1313 | $ hg add f1 |
|
1313 | $ hg add f1 | |
1314 | $ hg commit -m "m1" |
|
1314 | $ hg commit -m "m1" | |
1315 | Invoking status precommit hook |
|
1315 | Invoking status precommit hook | |
1316 | A f1 |
|
1316 | A f1 | |
1317 | $ cat >> .hg/hgrc <<! |
|
1317 | $ cat >> .hg/hgrc <<! | |
1318 | > [web] |
|
1318 | > [web] | |
1319 | > push_ssl = false |
|
1319 | > push_ssl = false | |
1320 | > allow_push = * |
|
1320 | > allow_push = * | |
1321 | > ! |
|
1321 | > ! | |
1322 | $ cd .. |
|
1322 | $ cd .. | |
1323 | $ hg clone r6 r7 |
|
1323 | $ hg clone r6 r7 | |
1324 | updating to branch default |
|
1324 | updating to branch default | |
1325 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
1325 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
1326 | $ cd r7 |
|
1326 | $ cd r7 | |
1327 | $ echo c2 > f2 |
|
1327 | $ echo c2 > f2 | |
1328 | $ hg add --large f2 |
|
1328 | $ hg add --large f2 | |
1329 | $ hg commit -m "m2" |
|
1329 | $ hg commit -m "m2" | |
1330 | Invoking status precommit hook |
|
1330 | Invoking status precommit hook | |
1331 | A f2 |
|
1331 | A f2 | |
1332 | $ hg --config extensions.largefiles=! -R ../r6 serve -d -p $HGPORT --pid-file ../hg.pid |
|
1332 | $ hg --config extensions.largefiles=! -R ../r6 serve -d -p $HGPORT --pid-file ../hg.pid | |
1333 | $ cat ../hg.pid >> $DAEMON_PIDS |
|
1333 | $ cat ../hg.pid >> $DAEMON_PIDS | |
1334 | $ hg push http://localhost:$HGPORT |
|
1334 | $ hg push http://localhost:$HGPORT | |
1335 | pushing to http://localhost:$HGPORT/ |
|
1335 | pushing to http://localhost:$HGPORT/ | |
1336 | searching for changes |
|
1336 | searching for changes | |
1337 | abort: http://localhost:$HGPORT/ does not appear to be a largefile store |
|
1337 | abort: http://localhost:$HGPORT/ does not appear to be a largefile store | |
1338 | [255] |
|
1338 | [255] | |
1339 | $ cd .. |
|
1339 | $ cd .. | |
1340 |
|
1340 | |||
1341 | putlfile errors are shown (issue3123) |
|
1341 | putlfile errors are shown (issue3123) | |
1342 | Corrupt the cached largefile in r7 and in the usercache (required for testing on vfat) |
|
1342 | Corrupt the cached largefile in r7 and in the usercache (required for testing on vfat) | |
1343 | $ echo corruption > "$TESTTMP/r7/.hg/largefiles/4cdac4d8b084d0b599525cf732437fb337d422a8" |
|
1343 | $ echo corruption > "$TESTTMP/r7/.hg/largefiles/4cdac4d8b084d0b599525cf732437fb337d422a8" | |
1344 | $ echo corruption > "$USERCACHE/4cdac4d8b084d0b599525cf732437fb337d422a8" |
|
1344 | $ echo corruption > "$USERCACHE/4cdac4d8b084d0b599525cf732437fb337d422a8" | |
1345 | $ hg init empty |
|
1345 | $ hg init empty | |
1346 | $ hg serve -R empty -d -p $HGPORT1 --pid-file hg.pid \ |
|
1346 | $ hg serve -R empty -d -p $HGPORT1 --pid-file hg.pid \ | |
1347 | > --config 'web.allow_push=*' --config web.push_ssl=False |
|
1347 | > --config 'web.allow_push=*' --config web.push_ssl=False | |
1348 | $ cat hg.pid >> $DAEMON_PIDS |
|
1348 | $ cat hg.pid >> $DAEMON_PIDS | |
1349 | $ hg push -R r7 http://localhost:$HGPORT1 |
|
1349 | $ hg push -R r7 http://localhost:$HGPORT1 | |
1350 | pushing to http://localhost:$HGPORT1/ |
|
1350 | pushing to http://localhost:$HGPORT1/ | |
1351 | searching for changes |
|
1351 | searching for changes | |
1352 | remote: largefiles: failed to put 4cdac4d8b084d0b599525cf732437fb337d422a8 into store: largefile contents do not match hash |
|
1352 | remote: largefiles: failed to put 4cdac4d8b084d0b599525cf732437fb337d422a8 into store: largefile contents do not match hash | |
1353 | abort: remotestore: could not put $TESTTMP/r7/.hg/largefiles/4cdac4d8b084d0b599525cf732437fb337d422a8 to remote store http://localhost:$HGPORT1/ (glob) |
|
1353 | abort: remotestore: could not put $TESTTMP/r7/.hg/largefiles/4cdac4d8b084d0b599525cf732437fb337d422a8 to remote store http://localhost:$HGPORT1/ (glob) | |
1354 | [255] |
|
1354 | [255] | |
1355 | $ rm -rf empty |
|
1355 | $ rm -rf empty | |
1356 |
|
1356 | |||
1357 | Push a largefiles repository to a served empty repository |
|
1357 | Push a largefiles repository to a served empty repository | |
1358 | $ hg init r8 |
|
1358 | $ hg init r8 | |
1359 | $ echo c3 > r8/f1 |
|
1359 | $ echo c3 > r8/f1 | |
1360 | $ hg add --large r8/f1 -R r8 |
|
1360 | $ hg add --large r8/f1 -R r8 | |
1361 | $ hg commit -m "m1" -R r8 |
|
1361 | $ hg commit -m "m1" -R r8 | |
1362 | Invoking status precommit hook |
|
1362 | Invoking status precommit hook | |
1363 | A f1 |
|
1363 | A f1 | |
1364 | $ hg init empty |
|
1364 | $ hg init empty | |
1365 | $ hg serve -R empty -d -p $HGPORT2 --pid-file hg.pid \ |
|
1365 | $ hg serve -R empty -d -p $HGPORT2 --pid-file hg.pid \ | |
1366 | > --config 'web.allow_push=*' --config web.push_ssl=False |
|
1366 | > --config 'web.allow_push=*' --config web.push_ssl=False | |
1367 | $ cat hg.pid >> $DAEMON_PIDS |
|
1367 | $ cat hg.pid >> $DAEMON_PIDS | |
1368 | $ rm "${USERCACHE}"/* |
|
1368 | $ rm "${USERCACHE}"/* | |
1369 | $ hg push -R r8 http://localhost:$HGPORT2 |
|
1369 | $ hg push -R r8 http://localhost:$HGPORT2 | |
1370 | pushing to http://localhost:$HGPORT2/ |
|
1370 | pushing to http://localhost:$HGPORT2/ | |
1371 | searching for changes |
|
1371 | searching for changes | |
1372 | searching for changes |
|
1372 | searching for changes | |
1373 | remote: adding changesets |
|
1373 | remote: adding changesets | |
1374 | remote: adding manifests |
|
1374 | remote: adding manifests | |
1375 | remote: adding file changes |
|
1375 | remote: adding file changes | |
1376 | remote: added 1 changesets with 1 changes to 1 files |
|
1376 | remote: added 1 changesets with 1 changes to 1 files | |
1377 | $ rm -rf empty |
|
1377 | $ rm -rf empty | |
1378 |
|
1378 | |||
1379 | used all HGPORTs, kill all daemons |
|
1379 | used all HGPORTs, kill all daemons | |
1380 | $ "$TESTDIR/killdaemons.py" $DAEMON_PIDS |
|
1380 | $ "$TESTDIR/killdaemons.py" $DAEMON_PIDS | |
1381 |
|
1381 | |||
1382 | #endif |
|
1382 | #endif | |
1383 |
|
1383 | |||
1384 |
|
1384 | |||
1385 | #if unix-permissions |
|
1385 | #if unix-permissions | |
1386 |
|
1386 | |||
1387 | Clone a local repository owned by another user |
|
1387 | Clone a local repository owned by another user | |
1388 | We have to simulate that here by setting $HOME and removing write permissions |
|
1388 | We have to simulate that here by setting $HOME and removing write permissions | |
1389 | $ ORIGHOME="$HOME" |
|
1389 | $ ORIGHOME="$HOME" | |
1390 | $ mkdir alice |
|
1390 | $ mkdir alice | |
1391 | $ HOME="`pwd`/alice" |
|
1391 | $ HOME="`pwd`/alice" | |
1392 | $ cd alice |
|
1392 | $ cd alice | |
1393 | $ hg init pubrepo |
|
1393 | $ hg init pubrepo | |
1394 | $ cd pubrepo |
|
1394 | $ cd pubrepo | |
1395 | $ dd if=/dev/zero bs=1k count=11k > a-large-file 2> /dev/null |
|
1395 | $ dd if=/dev/zero bs=1k count=11k > a-large-file 2> /dev/null | |
1396 | $ hg add --large a-large-file |
|
1396 | $ hg add --large a-large-file | |
1397 | $ hg commit -m "Add a large file" |
|
1397 | $ hg commit -m "Add a large file" | |
1398 | Invoking status precommit hook |
|
1398 | Invoking status precommit hook | |
1399 | A a-large-file |
|
1399 | A a-large-file | |
1400 | $ cd .. |
|
1400 | $ cd .. | |
1401 | $ chmod -R a-w pubrepo |
|
1401 | $ chmod -R a-w pubrepo | |
1402 | $ cd .. |
|
1402 | $ cd .. | |
1403 | $ mkdir bob |
|
1403 | $ mkdir bob | |
1404 | $ HOME="`pwd`/bob" |
|
1404 | $ HOME="`pwd`/bob" | |
1405 | $ cd bob |
|
1405 | $ cd bob | |
1406 | $ hg clone --pull ../alice/pubrepo pubrepo |
|
1406 | $ hg clone --pull ../alice/pubrepo pubrepo | |
1407 | requesting all changes |
|
1407 | requesting all changes | |
1408 | adding changesets |
|
1408 | adding changesets | |
1409 | adding manifests |
|
1409 | adding manifests | |
1410 | adding file changes |
|
1410 | adding file changes | |
1411 | added 1 changesets with 1 changes to 1 files |
|
1411 | added 1 changesets with 1 changes to 1 files | |
1412 | updating to branch default |
|
1412 | updating to branch default | |
1413 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
1413 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
1414 | getting changed largefiles |
|
1414 | getting changed largefiles | |
1415 | 1 largefiles updated, 0 removed |
|
1415 | 1 largefiles updated, 0 removed | |
1416 | $ cd .. |
|
1416 | $ cd .. | |
1417 | $ chmod -R u+w alice/pubrepo |
|
1417 | $ chmod -R u+w alice/pubrepo | |
1418 | $ HOME="$ORIGHOME" |
|
1418 | $ HOME="$ORIGHOME" | |
1419 |
|
1419 | |||
1420 | #endif |
|
1420 | #endif | |
1421 |
|
1421 | |||
1422 | #if symlink |
|
1422 | #if symlink | |
1423 |
|
1423 | |||
1424 | Symlink to a large largefile should behave the same as a symlink to a normal file |
|
1424 | Symlink to a large largefile should behave the same as a symlink to a normal file | |
1425 | $ hg init largesymlink |
|
1425 | $ hg init largesymlink | |
1426 | $ cd largesymlink |
|
1426 | $ cd largesymlink | |
1427 | $ dd if=/dev/zero bs=1k count=10k of=largefile 2>/dev/null |
|
1427 | $ dd if=/dev/zero bs=1k count=10k of=largefile 2>/dev/null | |
1428 | $ hg add --large largefile |
|
1428 | $ hg add --large largefile | |
1429 | $ hg commit -m "commit a large file" |
|
1429 | $ hg commit -m "commit a large file" | |
1430 | Invoking status precommit hook |
|
1430 | Invoking status precommit hook | |
1431 | A largefile |
|
1431 | A largefile | |
1432 | $ ln -s largefile largelink |
|
1432 | $ ln -s largefile largelink | |
1433 | $ hg add largelink |
|
1433 | $ hg add largelink | |
1434 | $ hg commit -m "commit a large symlink" |
|
1434 | $ hg commit -m "commit a large symlink" | |
1435 | Invoking status precommit hook |
|
1435 | Invoking status precommit hook | |
1436 | A largelink |
|
1436 | A largelink | |
1437 | $ rm -f largelink |
|
1437 | $ rm -f largelink | |
1438 | $ hg up >/dev/null |
|
1438 | $ hg up >/dev/null | |
1439 | $ test -f largelink |
|
1439 | $ test -f largelink | |
1440 | [1] |
|
1440 | [1] | |
1441 | $ test -L largelink |
|
1441 | $ test -L largelink | |
1442 | [1] |
|
1442 | [1] | |
1443 | $ rm -f largelink # make next part of the test independent of the previous |
|
1443 | $ rm -f largelink # make next part of the test independent of the previous | |
1444 | $ hg up -C >/dev/null |
|
1444 | $ hg up -C >/dev/null | |
1445 | $ test -f largelink |
|
1445 | $ test -f largelink | |
1446 | $ test -L largelink |
|
1446 | $ test -L largelink | |
1447 | $ cd .. |
|
1447 | $ cd .. | |
1448 |
|
1448 | |||
1449 | #endif |
|
1449 | #endif | |
1450 |
|
1450 | |||
1451 | test for pattern matching on 'hg status': |
|
1451 | test for pattern matching on 'hg status': | |
1452 | to boost performance, largefiles checks whether specified patterns are |
|
1452 | to boost performance, largefiles checks whether specified patterns are | |
1453 | related to largefiles in working directory (NOT to STANDIN) or not. |
|
1453 | related to largefiles in working directory (NOT to STANDIN) or not. | |
1454 |
|
1454 | |||
1455 | $ hg init statusmatch |
|
1455 | $ hg init statusmatch | |
1456 | $ cd statusmatch |
|
1456 | $ cd statusmatch | |
1457 |
|
1457 | |||
1458 | $ mkdir -p a/b/c/d |
|
1458 | $ mkdir -p a/b/c/d | |
1459 | $ echo normal > a/b/c/d/e.normal.txt |
|
1459 | $ echo normal > a/b/c/d/e.normal.txt | |
1460 | $ hg add a/b/c/d/e.normal.txt |
|
1460 | $ hg add a/b/c/d/e.normal.txt | |
1461 | $ echo large > a/b/c/d/e.large.txt |
|
1461 | $ echo large > a/b/c/d/e.large.txt | |
1462 | $ hg add --large a/b/c/d/e.large.txt |
|
1462 | $ hg add --large a/b/c/d/e.large.txt | |
1463 | $ mkdir -p a/b/c/x |
|
1463 | $ mkdir -p a/b/c/x | |
1464 | $ echo normal > a/b/c/x/y.normal.txt |
|
1464 | $ echo normal > a/b/c/x/y.normal.txt | |
1465 | $ hg add a/b/c/x/y.normal.txt |
|
1465 | $ hg add a/b/c/x/y.normal.txt | |
1466 | $ hg commit -m 'add files' |
|
1466 | $ hg commit -m 'add files' | |
1467 | Invoking status precommit hook |
|
1467 | Invoking status precommit hook | |
1468 | A a/b/c/d/e.large.txt |
|
1468 | A a/b/c/d/e.large.txt | |
1469 | A a/b/c/d/e.normal.txt |
|
1469 | A a/b/c/d/e.normal.txt | |
1470 | A a/b/c/x/y.normal.txt |
|
1470 | A a/b/c/x/y.normal.txt | |
1471 |
|
1471 | |||
1472 | (1) no pattern: no performance boost |
|
1472 | (1) no pattern: no performance boost | |
1473 | $ hg status -A |
|
1473 | $ hg status -A | |
1474 | C a/b/c/d/e.large.txt |
|
1474 | C a/b/c/d/e.large.txt | |
1475 | C a/b/c/d/e.normal.txt |
|
1475 | C a/b/c/d/e.normal.txt | |
1476 | C a/b/c/x/y.normal.txt |
|
1476 | C a/b/c/x/y.normal.txt | |
1477 |
|
1477 | |||
1478 | (2) pattern not related to largefiles: performance boost |
|
1478 | (2) pattern not related to largefiles: performance boost | |
1479 | $ hg status -A a/b/c/x |
|
1479 | $ hg status -A a/b/c/x | |
1480 | C a/b/c/x/y.normal.txt |
|
1480 | C a/b/c/x/y.normal.txt | |
1481 |
|
1481 | |||
1482 | (3) pattern related to largefiles: no performance boost |
|
1482 | (3) pattern related to largefiles: no performance boost | |
1483 | $ hg status -A a/b/c/d |
|
1483 | $ hg status -A a/b/c/d | |
1484 | C a/b/c/d/e.large.txt |
|
1484 | C a/b/c/d/e.large.txt | |
1485 | C a/b/c/d/e.normal.txt |
|
1485 | C a/b/c/d/e.normal.txt | |
1486 |
|
1486 | |||
1487 | (4) pattern related to STANDIN (not to largefiles): performance boost |
|
1487 | (4) pattern related to STANDIN (not to largefiles): performance boost | |
1488 | $ hg status -A .hglf/a |
|
1488 | $ hg status -A .hglf/a | |
1489 | C .hglf/a/b/c/d/e.large.txt |
|
1489 | C .hglf/a/b/c/d/e.large.txt | |
1490 |
|
1490 | |||
1491 | (5) mixed case: no performance boost |
|
1491 | (5) mixed case: no performance boost | |
1492 | $ hg status -A a/b/c/x a/b/c/d |
|
1492 | $ hg status -A a/b/c/x a/b/c/d | |
1493 | C a/b/c/d/e.large.txt |
|
1493 | C a/b/c/d/e.large.txt | |
1494 | C a/b/c/d/e.normal.txt |
|
1494 | C a/b/c/d/e.normal.txt | |
1495 | C a/b/c/x/y.normal.txt |
|
1495 | C a/b/c/x/y.normal.txt | |
1496 |
|
1496 | |||
1497 | verify that largefiles doesn't break filesets |
|
1497 | verify that largefiles doesn't break filesets | |
1498 |
|
1498 | |||
1499 | $ hg log --rev . --exclude "set:binary()" |
|
1499 | $ hg log --rev . --exclude "set:binary()" | |
1500 | changeset: 0:41bd42f10efa |
|
1500 | changeset: 0:41bd42f10efa | |
1501 | tag: tip |
|
1501 | tag: tip | |
1502 | user: test |
|
1502 | user: test | |
1503 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
1503 | date: Thu Jan 01 00:00:00 1970 +0000 | |
1504 | summary: add files |
|
1504 | summary: add files | |
1505 |
|
1505 | |||
1506 | verify that large files in subrepos handled properly |
|
1506 | verify that large files in subrepos handled properly | |
1507 | $ hg init subrepo |
|
1507 | $ hg init subrepo | |
1508 | $ echo "subrepo = subrepo" > .hgsub |
|
1508 | $ echo "subrepo = subrepo" > .hgsub | |
1509 | $ hg add .hgsub |
|
1509 | $ hg add .hgsub | |
1510 | $ hg ci -m "add subrepo" |
|
1510 | $ hg ci -m "add subrepo" | |
1511 | Invoking status precommit hook |
|
1511 | Invoking status precommit hook | |
1512 | A .hgsub |
|
1512 | A .hgsub | |
1513 | ? .hgsubstate |
|
1513 | ? .hgsubstate | |
1514 | $ echo "rev 1" > subrepo/large.txt |
|
1514 | $ echo "rev 1" > subrepo/large.txt | |
1515 | $ hg -R subrepo add --large subrepo/large.txt |
|
1515 | $ hg -R subrepo add --large subrepo/large.txt | |
1516 | $ hg sum |
|
1516 | $ hg sum | |
1517 | parent: 1:8ee150ea2e9c tip |
|
1517 | parent: 1:8ee150ea2e9c tip | |
1518 | add subrepo |
|
1518 | add subrepo | |
1519 | branch: default |
|
1519 | branch: default | |
1520 | commit: 1 subrepos |
|
1520 | commit: 1 subrepos | |
1521 | update: (current) |
|
1521 | update: (current) | |
1522 | $ hg st |
|
1522 | $ hg st | |
1523 | $ hg st -S |
|
1523 | $ hg st -S | |
1524 | A subrepo/large.txt |
|
1524 | A subrepo/large.txt | |
1525 | $ hg ci -S -m "commit top repo" |
|
1525 | $ hg ci -S -m "commit top repo" | |
1526 | committing subrepository subrepo |
|
1526 | committing subrepository subrepo | |
1527 | Invoking status precommit hook |
|
1527 | Invoking status precommit hook | |
1528 | A large.txt |
|
1528 | A large.txt | |
1529 | Invoking status precommit hook |
|
1529 | Invoking status precommit hook | |
1530 | M .hgsubstate |
|
1530 | M .hgsubstate | |
1531 | # No differences |
|
1531 | # No differences | |
1532 | $ hg st -S |
|
1532 | $ hg st -S | |
1533 | $ hg sum |
|
1533 | $ hg sum | |
1534 | parent: 2:ce4cd0c527a6 tip |
|
1534 | parent: 2:ce4cd0c527a6 tip | |
1535 | commit top repo |
|
1535 | commit top repo | |
1536 | branch: default |
|
1536 | branch: default | |
1537 | commit: (clean) |
|
1537 | commit: (clean) | |
1538 | update: (current) |
|
1538 | update: (current) | |
1539 | $ echo "rev 2" > subrepo/large.txt |
|
1539 | $ echo "rev 2" > subrepo/large.txt | |
1540 | $ hg st -S |
|
1540 | $ hg st -S | |
1541 | M subrepo/large.txt |
|
1541 | M subrepo/large.txt | |
1542 | $ hg sum |
|
1542 | $ hg sum | |
1543 | parent: 2:ce4cd0c527a6 tip |
|
1543 | parent: 2:ce4cd0c527a6 tip | |
1544 | commit top repo |
|
1544 | commit top repo | |
1545 | branch: default |
|
1545 | branch: default | |
1546 | commit: 1 subrepos |
|
1546 | commit: 1 subrepos | |
1547 | update: (current) |
|
1547 | update: (current) | |
1548 | $ hg ci -m "this commit should fail without -S" |
|
1548 | $ hg ci -m "this commit should fail without -S" | |
1549 | abort: uncommitted changes in subrepo subrepo |
|
1549 | abort: uncommitted changes in subrepo subrepo | |
1550 | (use --subrepos for recursive commit) |
|
1550 | (use --subrepos for recursive commit) | |
1551 | [255] |
|
1551 | [255] | |
1552 |
|
1552 | |||
1553 | Add a normal file to the subrepo, then test archiving |
|
1553 | Add a normal file to the subrepo, then test archiving | |
1554 |
|
1554 | |||
1555 | $ echo 'normal file' > subrepo/normal.txt |
|
1555 | $ echo 'normal file' > subrepo/normal.txt | |
1556 | $ hg -R subrepo add subrepo/normal.txt |
|
1556 | $ hg -R subrepo add subrepo/normal.txt | |
1557 |
|
1557 | |||
1558 | Lock in subrepo, otherwise the change isn't archived |
|
1558 | Lock in subrepo, otherwise the change isn't archived | |
1559 |
|
1559 | |||
1560 | $ hg ci -S -m "add normal file to top level" |
|
1560 | $ hg ci -S -m "add normal file to top level" | |
1561 | committing subrepository subrepo |
|
1561 | committing subrepository subrepo | |
1562 | Invoking status precommit hook |
|
1562 | Invoking status precommit hook | |
1563 | M large.txt |
|
1563 | M large.txt | |
1564 | A normal.txt |
|
1564 | A normal.txt | |
1565 | Invoking status precommit hook |
|
1565 | Invoking status precommit hook | |
1566 | M .hgsubstate |
|
1566 | M .hgsubstate | |
1567 | $ hg archive -S lf_subrepo_archive |
|
1567 | $ hg archive -S lf_subrepo_archive | |
1568 | $ find lf_subrepo_archive | sort |
|
1568 | $ find lf_subrepo_archive | sort | |
1569 | lf_subrepo_archive |
|
1569 | lf_subrepo_archive | |
1570 | lf_subrepo_archive/.hg_archival.txt |
|
1570 | lf_subrepo_archive/.hg_archival.txt | |
1571 | lf_subrepo_archive/.hgsub |
|
1571 | lf_subrepo_archive/.hgsub | |
1572 | lf_subrepo_archive/.hgsubstate |
|
1572 | lf_subrepo_archive/.hgsubstate | |
1573 | lf_subrepo_archive/a |
|
1573 | lf_subrepo_archive/a | |
1574 | lf_subrepo_archive/a/b |
|
1574 | lf_subrepo_archive/a/b | |
1575 | lf_subrepo_archive/a/b/c |
|
1575 | lf_subrepo_archive/a/b/c | |
1576 | lf_subrepo_archive/a/b/c/d |
|
1576 | lf_subrepo_archive/a/b/c/d | |
1577 | lf_subrepo_archive/a/b/c/d/e.large.txt |
|
1577 | lf_subrepo_archive/a/b/c/d/e.large.txt | |
1578 | lf_subrepo_archive/a/b/c/d/e.normal.txt |
|
1578 | lf_subrepo_archive/a/b/c/d/e.normal.txt | |
1579 | lf_subrepo_archive/a/b/c/x |
|
1579 | lf_subrepo_archive/a/b/c/x | |
1580 | lf_subrepo_archive/a/b/c/x/y.normal.txt |
|
1580 | lf_subrepo_archive/a/b/c/x/y.normal.txt | |
1581 | lf_subrepo_archive/subrepo |
|
1581 | lf_subrepo_archive/subrepo | |
1582 | lf_subrepo_archive/subrepo/large.txt |
|
1582 | lf_subrepo_archive/subrepo/large.txt | |
1583 | lf_subrepo_archive/subrepo/normal.txt |
|
1583 | lf_subrepo_archive/subrepo/normal.txt | |
1584 |
|
1584 | |||
1585 | Test archiving a revision that references a subrepo that is not yet |
|
1585 | Test archiving a revision that references a subrepo that is not yet | |
1586 | cloned (see test-subrepo-recursion.t): |
|
1586 | cloned (see test-subrepo-recursion.t): | |
1587 |
|
1587 | |||
1588 | $ hg clone -U . ../empty |
|
1588 | $ hg clone -U . ../empty | |
1589 | $ cd ../empty |
|
1589 | $ cd ../empty | |
1590 | $ hg archive --subrepos -r tip ../archive.tar.gz |
|
1590 | $ hg archive --subrepos -r tip ../archive.tar.gz | |
1591 | cloning subrepo subrepo from $TESTTMP/statusmatch/subrepo |
|
1591 | cloning subrepo subrepo from $TESTTMP/statusmatch/subrepo | |
1592 | $ cd .. |
|
1592 | $ cd .. | |
1593 |
|
1593 | |||
1594 | Test that addremove picks up largefiles prior to the initial commit (issue3541) |
|
1594 | Test that addremove picks up largefiles prior to the initial commit (issue3541) | |
1595 |
|
1595 | |||
1596 | $ hg init addrm2 |
|
1596 | $ hg init addrm2 | |
1597 | $ cd addrm2 |
|
1597 | $ cd addrm2 | |
1598 | $ touch large.dat |
|
1598 | $ touch large.dat | |
1599 | $ touch large2.dat |
|
1599 | $ touch large2.dat | |
1600 | $ touch normal |
|
1600 | $ touch normal | |
1601 | $ hg add --large large.dat |
|
1601 | $ hg add --large large.dat | |
1602 | $ hg addremove -v |
|
1602 | $ hg addremove -v | |
1603 | adding large2.dat as a largefile |
|
1603 | adding large2.dat as a largefile | |
1604 | adding normal |
|
1604 | adding normal | |
1605 |
|
1605 | |||
1606 | Test that forgetting all largefiles reverts to islfilesrepo() == False |
|
1606 | Test that forgetting all largefiles reverts to islfilesrepo() == False | |
1607 | (addremove will add *.dat as normal files now) |
|
1607 | (addremove will add *.dat as normal files now) | |
1608 | $ hg forget large.dat |
|
1608 | $ hg forget large.dat | |
1609 | $ hg forget large2.dat |
|
1609 | $ hg forget large2.dat | |
1610 | $ hg addremove -v |
|
1610 | $ hg addremove -v | |
1611 | adding large.dat |
|
1611 | adding large.dat | |
1612 | adding large2.dat |
|
1612 | adding large2.dat | |
1613 |
|
1613 | |||
1614 | Test commit's addremove option prior to the first commit |
|
1614 | Test commit's addremove option prior to the first commit | |
1615 | $ hg forget large.dat |
|
1615 | $ hg forget large.dat | |
1616 | $ hg forget large2.dat |
|
1616 | $ hg forget large2.dat | |
1617 | $ hg add --large large.dat |
|
1617 | $ hg add --large large.dat | |
1618 | $ hg ci -Am "commit" |
|
1618 | $ hg ci -Am "commit" | |
1619 | adding large2.dat as a largefile |
|
1619 | adding large2.dat as a largefile | |
1620 | Invoking status precommit hook |
|
1620 | Invoking status precommit hook | |
1621 | A large.dat |
|
1621 | A large.dat | |
1622 | A large2.dat |
|
1622 | A large2.dat | |
1623 | A normal |
|
1623 | A normal | |
1624 | $ find .hglf | sort |
|
1624 | $ find .hglf | sort | |
1625 | .hglf |
|
1625 | .hglf | |
1626 | .hglf/large.dat |
|
1626 | .hglf/large.dat | |
1627 | .hglf/large2.dat |
|
1627 | .hglf/large2.dat | |
1628 |
|
1628 | |||
1629 | $ cd .. |
|
1629 | $ cd .. | |
|
1630 | ||||
|
1631 | issue3651: summary/outgoing with largefiles shows "no remote repo" | |||
|
1632 | unexpectedly | |||
|
1633 | ||||
|
1634 | $ mkdir issue3651 | |||
|
1635 | $ cd issue3651 | |||
|
1636 | ||||
|
1637 | $ hg init src | |||
|
1638 | $ echo a > src/a | |||
|
1639 | $ hg -R src add --large src/a | |||
|
1640 | $ hg -R src commit -m '#0' | |||
|
1641 | Invoking status precommit hook | |||
|
1642 | A a | |||
|
1643 | ||||
|
1644 | check messages when no remote repository is specified: | |||
|
1645 | "no remote repo" route for "hg outgoing --large" is not tested here, | |||
|
1646 | because it can't be reproduced easily. | |||
|
1647 | ||||
|
1648 | $ hg init clone1 | |||
|
1649 | $ hg -R clone1 -q pull src | |||
|
1650 | $ hg -R clone1 -q update | |||
|
1651 | $ hg -R clone1 paths | grep default | |||
|
1652 | [1] | |||
|
1653 | ||||
|
1654 | $ hg -R clone1 summary --large | |||
|
1655 | parent: 0:fc0bd45326d3 tip | |||
|
1656 | #0 | |||
|
1657 | branch: default | |||
|
1658 | commit: (clean) | |||
|
1659 | update: (current) | |||
|
1660 | largefiles: No remote repo | |||
|
1661 | ||||
|
1662 | check messages when there is no files to upload: | |||
|
1663 | ||||
|
1664 | $ hg -q clone src clone2 | |||
|
1665 | $ hg -R clone2 paths | grep default | |||
|
1666 | default = $TESTTMP/issue3651/src | |||
|
1667 | ||||
|
1668 | $ hg -R clone2 summary --large | |||
|
1669 | parent: 0:fc0bd45326d3 tip | |||
|
1670 | #0 | |||
|
1671 | branch: default | |||
|
1672 | commit: (clean) | |||
|
1673 | update: (current) | |||
|
1674 | searching for changes | |||
|
1675 | largefiles: (no files to upload) | |||
|
1676 | $ hg -R clone2 outgoing --large | |||
|
1677 | comparing with $TESTTMP/issue3651/src | |||
|
1678 | searching for changes | |||
|
1679 | no changes found | |||
|
1680 | searching for changes | |||
|
1681 | largefiles: no files to upload | |||
|
1682 | [1] | |||
|
1683 | ||||
|
1684 | check messages when there are files to upload: | |||
|
1685 | ||||
|
1686 | $ echo b > clone2/b | |||
|
1687 | $ hg -R clone2 add --large clone2/b | |||
|
1688 | $ hg -R clone2 commit -m '#1' | |||
|
1689 | Invoking status precommit hook | |||
|
1690 | A b | |||
|
1691 | $ hg -R clone2 summary --large | |||
|
1692 | parent: 1:1acbe71ce432 tip | |||
|
1693 | #1 | |||
|
1694 | branch: default | |||
|
1695 | commit: (clean) | |||
|
1696 | update: (current) | |||
|
1697 | searching for changes | |||
|
1698 | largefiles: 1 to upload | |||
|
1699 | $ hg -R clone2 outgoing --large | |||
|
1700 | comparing with $TESTTMP/issue3651/src | |||
|
1701 | searching for changes | |||
|
1702 | changeset: 1:1acbe71ce432 | |||
|
1703 | tag: tip | |||
|
1704 | user: test | |||
|
1705 | date: Thu Jan 01 00:00:00 1970 +0000 | |||
|
1706 | summary: #1 | |||
|
1707 | ||||
|
1708 | searching for changes | |||
|
1709 | largefiles to upload: | |||
|
1710 | b | |||
|
1711 | ||||
|
1712 | ||||
|
1713 | $ cd .. |
General Comments 0
You need to be logged in to leave comments.
Login now