##// END OF EJS Templates
largefiles: include largefiles when doing log on a directory (issue4241)...
Mads Kiilerich -
r21275:c7e9fb88 default
parent child Browse files
Show More
@@ -1,1172 +1,1174 b''
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 archival, merge, pathutil, revset
15 archival, merge, pathutil, revset
16 from mercurial.i18n import _
16 from mercurial.i18n import _
17 from mercurial.node import hex
17 from mercurial.node import hex
18 from hgext import rebase
18 from hgext import rebase
19
19
20 import lfutil
20 import lfutil
21 import lfcommands
21 import lfcommands
22 import basestore
22 import basestore
23
23
24 # -- Utility functions: commonly/repeatedly needed functionality ---------------
24 # -- Utility functions: commonly/repeatedly needed functionality ---------------
25
25
26 def installnormalfilesmatchfn(manifest):
26 def installnormalfilesmatchfn(manifest):
27 '''installmatchfn with a matchfn that ignores all largefiles'''
27 '''installmatchfn with a matchfn that ignores all largefiles'''
28 def overridematch(ctx, pats=[], opts={}, globbed=False,
28 def overridematch(ctx, pats=[], opts={}, globbed=False,
29 default='relpath'):
29 default='relpath'):
30 match = oldmatch(ctx, pats, opts, globbed, default)
30 match = oldmatch(ctx, pats, opts, globbed, default)
31 m = copy.copy(match)
31 m = copy.copy(match)
32 notlfile = lambda f: not (lfutil.isstandin(f) or lfutil.standin(f) in
32 notlfile = lambda f: not (lfutil.isstandin(f) or lfutil.standin(f) in
33 manifest)
33 manifest)
34 m._files = filter(notlfile, m._files)
34 m._files = filter(notlfile, m._files)
35 m._fmap = set(m._files)
35 m._fmap = set(m._files)
36 m._always = False
36 m._always = False
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 '''monkey patch the scmutil module with a custom match function.
43 '''monkey patch the scmutil module with a custom match function.
44 Warning: it is monkey patching the _module_ on runtime! Not thread safe!'''
44 Warning: it is monkey patching the _module_ on runtime! Not thread safe!'''
45 oldmatch = scmutil.match
45 oldmatch = scmutil.match
46 setattr(f, 'oldmatch', oldmatch)
46 setattr(f, 'oldmatch', oldmatch)
47 scmutil.match = f
47 scmutil.match = f
48 return oldmatch
48 return oldmatch
49
49
50 def restorematchfn():
50 def restorematchfn():
51 '''restores scmutil.match to what it was before installmatchfn
51 '''restores scmutil.match to what it was before installmatchfn
52 was called. no-op if scmutil.match is its original function.
52 was called. no-op if scmutil.match is its original function.
53
53
54 Note that n calls to installmatchfn will require n calls to
54 Note that n calls to installmatchfn will require n calls to
55 restore matchfn to reverse'''
55 restore matchfn to reverse'''
56 scmutil.match = getattr(scmutil.match, 'oldmatch')
56 scmutil.match = getattr(scmutil.match, 'oldmatch')
57
57
58 def installmatchandpatsfn(f):
58 def installmatchandpatsfn(f):
59 oldmatchandpats = scmutil.matchandpats
59 oldmatchandpats = scmutil.matchandpats
60 setattr(f, 'oldmatchandpats', oldmatchandpats)
60 setattr(f, 'oldmatchandpats', oldmatchandpats)
61 scmutil.matchandpats = f
61 scmutil.matchandpats = f
62 return oldmatchandpats
62 return oldmatchandpats
63
63
64 def restorematchandpatsfn():
64 def restorematchandpatsfn():
65 '''restores scmutil.matchandpats to what it was before
65 '''restores scmutil.matchandpats to what it was before
66 installnormalfilesmatchandpatsfn was called. no-op if scmutil.matchandpats
66 installnormalfilesmatchandpatsfn was called. no-op if scmutil.matchandpats
67 is its original function.
67 is its original function.
68
68
69 Note that n calls to installnormalfilesmatchandpatsfn will require n calls
69 Note that n calls to installnormalfilesmatchandpatsfn will require n calls
70 to restore matchfn to reverse'''
70 to restore matchfn to reverse'''
71 scmutil.matchandpats = getattr(scmutil.matchandpats, 'oldmatchandpats',
71 scmutil.matchandpats = getattr(scmutil.matchandpats, 'oldmatchandpats',
72 scmutil.matchandpats)
72 scmutil.matchandpats)
73
73
74 def addlargefiles(ui, repo, *pats, **opts):
74 def addlargefiles(ui, repo, *pats, **opts):
75 large = opts.pop('large', None)
75 large = opts.pop('large', None)
76 lfsize = lfutil.getminsize(
76 lfsize = lfutil.getminsize(
77 ui, lfutil.islfilesrepo(repo), opts.pop('lfsize', None))
77 ui, lfutil.islfilesrepo(repo), opts.pop('lfsize', None))
78
78
79 lfmatcher = None
79 lfmatcher = None
80 if lfutil.islfilesrepo(repo):
80 if lfutil.islfilesrepo(repo):
81 lfpats = ui.configlist(lfutil.longname, 'patterns', default=[])
81 lfpats = ui.configlist(lfutil.longname, 'patterns', default=[])
82 if lfpats:
82 if lfpats:
83 lfmatcher = match_.match(repo.root, '', list(lfpats))
83 lfmatcher = match_.match(repo.root, '', list(lfpats))
84
84
85 lfnames = []
85 lfnames = []
86 m = scmutil.match(repo[None], pats, opts)
86 m = scmutil.match(repo[None], pats, opts)
87 m.bad = lambda x, y: None
87 m.bad = lambda x, y: None
88 wctx = repo[None]
88 wctx = repo[None]
89 for f in repo.walk(m):
89 for f in repo.walk(m):
90 exact = m.exact(f)
90 exact = m.exact(f)
91 lfile = lfutil.standin(f) in wctx
91 lfile = lfutil.standin(f) in wctx
92 nfile = f in wctx
92 nfile = f in wctx
93 exists = lfile or nfile
93 exists = lfile or nfile
94
94
95 # Don't warn the user when they attempt to add a normal tracked file.
95 # Don't warn the user when they attempt to add a normal tracked file.
96 # The normal add code will do that for us.
96 # The normal add code will do that for us.
97 if exact and exists:
97 if exact and exists:
98 if lfile:
98 if lfile:
99 ui.warn(_('%s already a largefile\n') % f)
99 ui.warn(_('%s already a largefile\n') % f)
100 continue
100 continue
101
101
102 if (exact or not exists) and not lfutil.isstandin(f):
102 if (exact or not exists) and not lfutil.isstandin(f):
103 wfile = repo.wjoin(f)
103 wfile = repo.wjoin(f)
104
104
105 # In case the file was removed previously, but not committed
105 # In case the file was removed previously, but not committed
106 # (issue3507)
106 # (issue3507)
107 if not os.path.exists(wfile):
107 if not os.path.exists(wfile):
108 continue
108 continue
109
109
110 abovemin = (lfsize and
110 abovemin = (lfsize and
111 os.lstat(wfile).st_size >= lfsize * 1024 * 1024)
111 os.lstat(wfile).st_size >= lfsize * 1024 * 1024)
112 if large or abovemin or (lfmatcher and lfmatcher(f)):
112 if large or abovemin or (lfmatcher and lfmatcher(f)):
113 lfnames.append(f)
113 lfnames.append(f)
114 if ui.verbose or not exact:
114 if ui.verbose or not exact:
115 ui.status(_('adding %s as a largefile\n') % m.rel(f))
115 ui.status(_('adding %s as a largefile\n') % m.rel(f))
116
116
117 bad = []
117 bad = []
118 standins = []
118 standins = []
119
119
120 # Need to lock, otherwise there could be a race condition between
120 # Need to lock, otherwise there could be a race condition between
121 # when standins are created and added to the repo.
121 # when standins are created and added to the repo.
122 wlock = repo.wlock()
122 wlock = repo.wlock()
123 try:
123 try:
124 if not opts.get('dry_run'):
124 if not opts.get('dry_run'):
125 lfdirstate = lfutil.openlfdirstate(ui, repo)
125 lfdirstate = lfutil.openlfdirstate(ui, repo)
126 for f in lfnames:
126 for f in lfnames:
127 standinname = lfutil.standin(f)
127 standinname = lfutil.standin(f)
128 lfutil.writestandin(repo, standinname, hash='',
128 lfutil.writestandin(repo, standinname, hash='',
129 executable=lfutil.getexecutable(repo.wjoin(f)))
129 executable=lfutil.getexecutable(repo.wjoin(f)))
130 standins.append(standinname)
130 standins.append(standinname)
131 if lfdirstate[f] == 'r':
131 if lfdirstate[f] == 'r':
132 lfdirstate.normallookup(f)
132 lfdirstate.normallookup(f)
133 else:
133 else:
134 lfdirstate.add(f)
134 lfdirstate.add(f)
135 lfdirstate.write()
135 lfdirstate.write()
136 bad += [lfutil.splitstandin(f)
136 bad += [lfutil.splitstandin(f)
137 for f in repo[None].add(standins)
137 for f in repo[None].add(standins)
138 if f in m.files()]
138 if f in m.files()]
139 finally:
139 finally:
140 wlock.release()
140 wlock.release()
141 return bad
141 return bad
142
142
143 def removelargefiles(ui, repo, *pats, **opts):
143 def removelargefiles(ui, repo, *pats, **opts):
144 after = opts.get('after')
144 after = opts.get('after')
145 if not pats and not after:
145 if not pats and not after:
146 raise util.Abort(_('no files specified'))
146 raise util.Abort(_('no files specified'))
147 m = scmutil.match(repo[None], pats, opts)
147 m = scmutil.match(repo[None], pats, opts)
148 try:
148 try:
149 repo.lfstatus = True
149 repo.lfstatus = True
150 s = repo.status(match=m, clean=True)
150 s = repo.status(match=m, clean=True)
151 finally:
151 finally:
152 repo.lfstatus = False
152 repo.lfstatus = False
153 manifest = repo[None].manifest()
153 manifest = repo[None].manifest()
154 modified, added, deleted, clean = [[f for f in list
154 modified, added, deleted, clean = [[f for f in list
155 if lfutil.standin(f) in manifest]
155 if lfutil.standin(f) in manifest]
156 for list in [s[0], s[1], s[3], s[6]]]
156 for list in [s[0], s[1], s[3], s[6]]]
157
157
158 def warn(files, msg):
158 def warn(files, msg):
159 for f in files:
159 for f in files:
160 ui.warn(msg % m.rel(f))
160 ui.warn(msg % m.rel(f))
161 return int(len(files) > 0)
161 return int(len(files) > 0)
162
162
163 result = 0
163 result = 0
164
164
165 if after:
165 if after:
166 remove, forget = deleted, []
166 remove, forget = deleted, []
167 result = warn(modified + added + clean,
167 result = warn(modified + added + clean,
168 _('not removing %s: file still exists\n'))
168 _('not removing %s: file still exists\n'))
169 else:
169 else:
170 remove, forget = deleted + clean, []
170 remove, forget = deleted + clean, []
171 result = warn(modified, _('not removing %s: file is modified (use -f'
171 result = warn(modified, _('not removing %s: file is modified (use -f'
172 ' to force removal)\n'))
172 ' to force removal)\n'))
173 result = warn(added, _('not removing %s: file has been marked for add'
173 result = warn(added, _('not removing %s: file has been marked for add'
174 ' (use forget to undo)\n')) or result
174 ' (use forget to undo)\n')) or result
175
175
176 for f in sorted(remove + forget):
176 for f in sorted(remove + forget):
177 if ui.verbose or not m.exact(f):
177 if ui.verbose or not m.exact(f):
178 ui.status(_('removing %s\n') % m.rel(f))
178 ui.status(_('removing %s\n') % m.rel(f))
179
179
180 # Need to lock because standin files are deleted then removed from the
180 # Need to lock because standin files are deleted then removed from the
181 # repository and we could race in-between.
181 # repository and we could race in-between.
182 wlock = repo.wlock()
182 wlock = repo.wlock()
183 try:
183 try:
184 lfdirstate = lfutil.openlfdirstate(ui, repo)
184 lfdirstate = lfutil.openlfdirstate(ui, repo)
185 for f in remove:
185 for f in remove:
186 if not after:
186 if not after:
187 # If this is being called by addremove, notify the user that we
187 # If this is being called by addremove, notify the user that we
188 # are removing the file.
188 # are removing the file.
189 if getattr(repo, "_isaddremove", False):
189 if getattr(repo, "_isaddremove", False):
190 ui.status(_('removing %s\n') % f)
190 ui.status(_('removing %s\n') % f)
191 util.unlinkpath(repo.wjoin(f), ignoremissing=True)
191 util.unlinkpath(repo.wjoin(f), ignoremissing=True)
192 lfdirstate.remove(f)
192 lfdirstate.remove(f)
193 lfdirstate.write()
193 lfdirstate.write()
194 forget = [lfutil.standin(f) for f in forget]
194 forget = [lfutil.standin(f) for f in forget]
195 remove = [lfutil.standin(f) for f in remove]
195 remove = [lfutil.standin(f) for f in remove]
196 repo[None].forget(forget)
196 repo[None].forget(forget)
197 # If this is being called by addremove, let the original addremove
197 # If this is being called by addremove, let the original addremove
198 # function handle this.
198 # function handle this.
199 if not getattr(repo, "_isaddremove", False):
199 if not getattr(repo, "_isaddremove", False):
200 for f in remove:
200 for f in remove:
201 util.unlinkpath(repo.wjoin(f), ignoremissing=True)
201 util.unlinkpath(repo.wjoin(f), ignoremissing=True)
202 repo[None].forget(remove)
202 repo[None].forget(remove)
203 finally:
203 finally:
204 wlock.release()
204 wlock.release()
205
205
206 return result
206 return result
207
207
208 # For overriding mercurial.hgweb.webcommands so that largefiles will
208 # For overriding mercurial.hgweb.webcommands so that largefiles will
209 # appear at their right place in the manifests.
209 # appear at their right place in the manifests.
210 def decodepath(orig, path):
210 def decodepath(orig, path):
211 return lfutil.splitstandin(path) or path
211 return lfutil.splitstandin(path) or path
212
212
213 # -- Wrappers: modify existing commands --------------------------------
213 # -- Wrappers: modify existing commands --------------------------------
214
214
215 # Add works by going through the files that the user wanted to add and
215 # Add works by going through the files that the user wanted to add and
216 # checking if they should be added as largefiles. Then it makes a new
216 # checking if they should be added as largefiles. Then it makes a new
217 # matcher which matches only the normal files and runs the original
217 # matcher which matches only the normal files and runs the original
218 # version of add.
218 # version of add.
219 def overrideadd(orig, ui, repo, *pats, **opts):
219 def overrideadd(orig, ui, repo, *pats, **opts):
220 normal = opts.pop('normal')
220 normal = opts.pop('normal')
221 if normal:
221 if normal:
222 if opts.get('large'):
222 if opts.get('large'):
223 raise util.Abort(_('--normal cannot be used with --large'))
223 raise util.Abort(_('--normal cannot be used with --large'))
224 return orig(ui, repo, *pats, **opts)
224 return orig(ui, repo, *pats, **opts)
225 bad = addlargefiles(ui, repo, *pats, **opts)
225 bad = addlargefiles(ui, repo, *pats, **opts)
226 installnormalfilesmatchfn(repo[None].manifest())
226 installnormalfilesmatchfn(repo[None].manifest())
227 result = orig(ui, repo, *pats, **opts)
227 result = orig(ui, repo, *pats, **opts)
228 restorematchfn()
228 restorematchfn()
229
229
230 return (result == 1 or bad) and 1 or 0
230 return (result == 1 or bad) and 1 or 0
231
231
232 def overrideremove(orig, ui, repo, *pats, **opts):
232 def overrideremove(orig, ui, repo, *pats, **opts):
233 installnormalfilesmatchfn(repo[None].manifest())
233 installnormalfilesmatchfn(repo[None].manifest())
234 result = orig(ui, repo, *pats, **opts)
234 result = orig(ui, repo, *pats, **opts)
235 restorematchfn()
235 restorematchfn()
236 return removelargefiles(ui, repo, *pats, **opts) or result
236 return removelargefiles(ui, repo, *pats, **opts) or result
237
237
238 def overridestatusfn(orig, repo, rev2, **opts):
238 def overridestatusfn(orig, repo, rev2, **opts):
239 try:
239 try:
240 repo._repo.lfstatus = True
240 repo._repo.lfstatus = True
241 return orig(repo, rev2, **opts)
241 return orig(repo, rev2, **opts)
242 finally:
242 finally:
243 repo._repo.lfstatus = False
243 repo._repo.lfstatus = False
244
244
245 def overridestatus(orig, ui, repo, *pats, **opts):
245 def overridestatus(orig, ui, repo, *pats, **opts):
246 try:
246 try:
247 repo.lfstatus = True
247 repo.lfstatus = True
248 return orig(ui, repo, *pats, **opts)
248 return orig(ui, repo, *pats, **opts)
249 finally:
249 finally:
250 repo.lfstatus = False
250 repo.lfstatus = False
251
251
252 def overridedirty(orig, repo, ignoreupdate=False):
252 def overridedirty(orig, repo, ignoreupdate=False):
253 try:
253 try:
254 repo._repo.lfstatus = True
254 repo._repo.lfstatus = True
255 return orig(repo, ignoreupdate)
255 return orig(repo, ignoreupdate)
256 finally:
256 finally:
257 repo._repo.lfstatus = False
257 repo._repo.lfstatus = False
258
258
259 def overridelog(orig, ui, repo, *pats, **opts):
259 def overridelog(orig, ui, repo, *pats, **opts):
260 def overridematchandpats(ctx, pats=[], opts={}, globbed=False,
260 def overridematchandpats(ctx, pats=[], opts={}, globbed=False,
261 default='relpath'):
261 default='relpath'):
262 """Matcher that merges root directory with .hglf, suitable for log.
262 """Matcher that merges root directory with .hglf, suitable for log.
263 It is still possible to match .hglf directly.
263 It is still possible to match .hglf directly.
264 For any listed files run log on the standin too.
264 For any listed files run log on the standin too.
265 matchfn tries both the given filename and with .hglf stripped.
265 matchfn tries both the given filename and with .hglf stripped.
266 """
266 """
267 matchandpats = oldmatchandpats(ctx, pats, opts, globbed, default)
267 matchandpats = oldmatchandpats(ctx, pats, opts, globbed, default)
268 m, p = copy.copy(matchandpats)
268 m, p = copy.copy(matchandpats)
269
269
270 pats = set(p)
270 pats = set(p)
271 # TODO: handling of patterns in both cases below
271 # TODO: handling of patterns in both cases below
272 if m._cwd:
272 if m._cwd:
273 if os.path.isabs(m._cwd):
273 if os.path.isabs(m._cwd):
274 # TODO: handle largefile magic when invoked from other cwd
274 # TODO: handle largefile magic when invoked from other cwd
275 return matchandpats
275 return matchandpats
276 back = (m._cwd.count('/') + 1) * '../'
276 back = (m._cwd.count('/') + 1) * '../'
277 pats.update(back + lfutil.standin(m._cwd + '/' + f) for f in p)
277 pats.update(back + lfutil.standin(m._cwd + '/' + f) for f in p)
278 else:
278 else:
279 pats.update(lfutil.standin(f) for f in p)
279 pats.update(lfutil.standin(f) for f in p)
280
280
281 for i in range(0, len(m._files)):
281 for i in range(0, len(m._files)):
282 standin = lfutil.standin(m._files[i])
282 standin = lfutil.standin(m._files[i])
283 if standin in repo[ctx.node()]:
283 if standin in repo[ctx.node()]:
284 m._files[i] = standin
284 m._files[i] = standin
285 elif m._files[i] not in repo[ctx.node()]:
286 m._files.append(standin)
285 pats.add(standin)
287 pats.add(standin)
286
288
287 m._fmap = set(m._files)
289 m._fmap = set(m._files)
288 m._always = False
290 m._always = False
289 origmatchfn = m.matchfn
291 origmatchfn = m.matchfn
290 def lfmatchfn(f):
292 def lfmatchfn(f):
291 lf = lfutil.splitstandin(f)
293 lf = lfutil.splitstandin(f)
292 if lf is not None and origmatchfn(lf):
294 if lf is not None and origmatchfn(lf):
293 return True
295 return True
294 r = origmatchfn(f)
296 r = origmatchfn(f)
295 return r
297 return r
296 m.matchfn = lfmatchfn
298 m.matchfn = lfmatchfn
297
299
298 return m, pats
300 return m, pats
299
301
300 oldmatchandpats = installmatchandpatsfn(overridematchandpats)
302 oldmatchandpats = installmatchandpatsfn(overridematchandpats)
301 try:
303 try:
302 repo.lfstatus = True
304 repo.lfstatus = True
303 return orig(ui, repo, *pats, **opts)
305 return orig(ui, repo, *pats, **opts)
304 finally:
306 finally:
305 repo.lfstatus = False
307 repo.lfstatus = False
306 restorematchandpatsfn()
308 restorematchandpatsfn()
307
309
308 def overrideverify(orig, ui, repo, *pats, **opts):
310 def overrideverify(orig, ui, repo, *pats, **opts):
309 large = opts.pop('large', False)
311 large = opts.pop('large', False)
310 all = opts.pop('lfa', False)
312 all = opts.pop('lfa', False)
311 contents = opts.pop('lfc', False)
313 contents = opts.pop('lfc', False)
312
314
313 result = orig(ui, repo, *pats, **opts)
315 result = orig(ui, repo, *pats, **opts)
314 if large or all or contents:
316 if large or all or contents:
315 result = result or lfcommands.verifylfiles(ui, repo, all, contents)
317 result = result or lfcommands.verifylfiles(ui, repo, all, contents)
316 return result
318 return result
317
319
318 def overridedebugstate(orig, ui, repo, *pats, **opts):
320 def overridedebugstate(orig, ui, repo, *pats, **opts):
319 large = opts.pop('large', False)
321 large = opts.pop('large', False)
320 if large:
322 if large:
321 class fakerepo(object):
323 class fakerepo(object):
322 dirstate = lfutil.openlfdirstate(ui, repo)
324 dirstate = lfutil.openlfdirstate(ui, repo)
323 orig(ui, fakerepo, *pats, **opts)
325 orig(ui, fakerepo, *pats, **opts)
324 else:
326 else:
325 orig(ui, repo, *pats, **opts)
327 orig(ui, repo, *pats, **opts)
326
328
327 # Override needs to refresh standins so that update's normal merge
329 # Override needs to refresh standins so that update's normal merge
328 # will go through properly. Then the other update hook (overriding repo.update)
330 # will go through properly. Then the other update hook (overriding repo.update)
329 # will get the new files. Filemerge is also overridden so that the merge
331 # will get the new files. Filemerge is also overridden so that the merge
330 # will merge standins correctly.
332 # will merge standins correctly.
331 def overrideupdate(orig, ui, repo, *pats, **opts):
333 def overrideupdate(orig, ui, repo, *pats, **opts):
332 # Need to lock between the standins getting updated and their
334 # Need to lock between the standins getting updated and their
333 # largefiles getting updated
335 # largefiles getting updated
334 wlock = repo.wlock()
336 wlock = repo.wlock()
335 try:
337 try:
336 lfdirstate = lfutil.openlfdirstate(ui, repo)
338 lfdirstate = lfutil.openlfdirstate(ui, repo)
337 s = lfdirstate.status(match_.always(repo.root, repo.getcwd()),
339 s = lfdirstate.status(match_.always(repo.root, repo.getcwd()),
338 [], False, False, False)
340 [], False, False, False)
339 (unsure, modified, added, removed, missing, unknown, ignored, clean) = s
341 (unsure, modified, added, removed, missing, unknown, ignored, clean) = s
340
342
341 if opts['check']:
343 if opts['check']:
342 mod = len(modified) > 0
344 mod = len(modified) > 0
343 for lfile in unsure:
345 for lfile in unsure:
344 standin = lfutil.standin(lfile)
346 standin = lfutil.standin(lfile)
345 if repo['.'][standin].data().strip() != \
347 if repo['.'][standin].data().strip() != \
346 lfutil.hashfile(repo.wjoin(lfile)):
348 lfutil.hashfile(repo.wjoin(lfile)):
347 mod = True
349 mod = True
348 else:
350 else:
349 lfdirstate.normal(lfile)
351 lfdirstate.normal(lfile)
350 lfdirstate.write()
352 lfdirstate.write()
351 if mod:
353 if mod:
352 raise util.Abort(_('uncommitted changes'))
354 raise util.Abort(_('uncommitted changes'))
353 # XXX handle removed differently
355 # XXX handle removed differently
354 if not opts['clean']:
356 if not opts['clean']:
355 for lfile in unsure + modified + added:
357 for lfile in unsure + modified + added:
356 lfutil.updatestandin(repo, lfutil.standin(lfile))
358 lfutil.updatestandin(repo, lfutil.standin(lfile))
357 return orig(ui, repo, *pats, **opts)
359 return orig(ui, repo, *pats, **opts)
358 finally:
360 finally:
359 wlock.release()
361 wlock.release()
360
362
361 # Before starting the manifest merge, merge.updates will call
363 # Before starting the manifest merge, merge.updates will call
362 # _checkunknown to check if there are any files in the merged-in
364 # _checkunknown to check if there are any files in the merged-in
363 # changeset that collide with unknown files in the working copy.
365 # changeset that collide with unknown files in the working copy.
364 #
366 #
365 # The largefiles are seen as unknown, so this prevents us from merging
367 # The largefiles are seen as unknown, so this prevents us from merging
366 # in a file 'foo' if we already have a largefile with the same name.
368 # in a file 'foo' if we already have a largefile with the same name.
367 #
369 #
368 # The overridden function filters the unknown files by removing any
370 # The overridden function filters the unknown files by removing any
369 # largefiles. This makes the merge proceed and we can then handle this
371 # largefiles. This makes the merge proceed and we can then handle this
370 # case further in the overridden manifestmerge function below.
372 # case further in the overridden manifestmerge function below.
371 def overridecheckunknownfile(origfn, repo, wctx, mctx, f):
373 def overridecheckunknownfile(origfn, repo, wctx, mctx, f):
372 if lfutil.standin(repo.dirstate.normalize(f)) in wctx:
374 if lfutil.standin(repo.dirstate.normalize(f)) in wctx:
373 return False
375 return False
374 return origfn(repo, wctx, mctx, f)
376 return origfn(repo, wctx, mctx, f)
375
377
376 # The manifest merge handles conflicts on the manifest level. We want
378 # The manifest merge handles conflicts on the manifest level. We want
377 # to handle changes in largefile-ness of files at this level too.
379 # to handle changes in largefile-ness of files at this level too.
378 #
380 #
379 # The strategy is to run the original manifestmerge and then process
381 # The strategy is to run the original manifestmerge and then process
380 # the action list it outputs. There are two cases we need to deal with:
382 # the action list it outputs. There are two cases we need to deal with:
381 #
383 #
382 # 1. Normal file in p1, largefile in p2. Here the largefile is
384 # 1. Normal file in p1, largefile in p2. Here the largefile is
383 # detected via its standin file, which will enter the working copy
385 # detected via its standin file, which will enter the working copy
384 # with a "get" action. It is not "merge" since the standin is all
386 # with a "get" action. It is not "merge" since the standin is all
385 # Mercurial is concerned with at this level -- the link to the
387 # Mercurial is concerned with at this level -- the link to the
386 # existing normal file is not relevant here.
388 # existing normal file is not relevant here.
387 #
389 #
388 # 2. Largefile in p1, normal file in p2. Here we get a "merge" action
390 # 2. Largefile in p1, normal file in p2. Here we get a "merge" action
389 # since the largefile will be present in the working copy and
391 # since the largefile will be present in the working copy and
390 # different from the normal file in p2. Mercurial therefore
392 # different from the normal file in p2. Mercurial therefore
391 # triggers a merge action.
393 # triggers a merge action.
392 #
394 #
393 # In both cases, we prompt the user and emit new actions to either
395 # In both cases, we prompt the user and emit new actions to either
394 # remove the standin (if the normal file was kept) or to remove the
396 # remove the standin (if the normal file was kept) or to remove the
395 # normal file and get the standin (if the largefile was kept). The
397 # normal file and get the standin (if the largefile was kept). The
396 # default prompt answer is to use the largefile version since it was
398 # default prompt answer is to use the largefile version since it was
397 # presumably changed on purpose.
399 # presumably changed on purpose.
398 #
400 #
399 # Finally, the merge.applyupdates function will then take care of
401 # Finally, the merge.applyupdates function will then take care of
400 # writing the files into the working copy and lfcommands.updatelfiles
402 # writing the files into the working copy and lfcommands.updatelfiles
401 # will update the largefiles.
403 # will update the largefiles.
402 def overridecalculateupdates(origfn, repo, p1, p2, pas, branchmerge, force,
404 def overridecalculateupdates(origfn, repo, p1, p2, pas, branchmerge, force,
403 partial, acceptremote, followcopies):
405 partial, acceptremote, followcopies):
404 overwrite = force and not branchmerge
406 overwrite = force and not branchmerge
405 actions = origfn(repo, p1, p2, pas, branchmerge, force, partial,
407 actions = origfn(repo, p1, p2, pas, branchmerge, force, partial,
406 acceptremote, followcopies)
408 acceptremote, followcopies)
407
409
408 if overwrite:
410 if overwrite:
409 return actions
411 return actions
410
412
411 removes = set(a[0] for a in actions if a[1] == 'r')
413 removes = set(a[0] for a in actions if a[1] == 'r')
412 processed = []
414 processed = []
413
415
414 for action in actions:
416 for action in actions:
415 f, m, args, msg = action
417 f, m, args, msg = action
416
418
417 splitstandin = f and lfutil.splitstandin(f)
419 splitstandin = f and lfutil.splitstandin(f)
418 if (m == "g" and splitstandin is not None and
420 if (m == "g" and splitstandin is not None and
419 splitstandin in p1 and splitstandin not in removes):
421 splitstandin in p1 and splitstandin not in removes):
420 # Case 1: normal file in the working copy, largefile in
422 # Case 1: normal file in the working copy, largefile in
421 # the second parent
423 # the second parent
422 lfile = splitstandin
424 lfile = splitstandin
423 standin = f
425 standin = f
424 msg = _('remote turned local normal file %s into a largefile\n'
426 msg = _('remote turned local normal file %s into a largefile\n'
425 'use (l)argefile or keep (n)ormal file?'
427 'use (l)argefile or keep (n)ormal file?'
426 '$$ &Largefile $$ &Normal file') % lfile
428 '$$ &Largefile $$ &Normal file') % lfile
427 if repo.ui.promptchoice(msg, 0) == 0:
429 if repo.ui.promptchoice(msg, 0) == 0:
428 processed.append((lfile, "r", None, msg))
430 processed.append((lfile, "r", None, msg))
429 processed.append((standin, "g", (p2.flags(standin),), msg))
431 processed.append((standin, "g", (p2.flags(standin),), msg))
430 else:
432 else:
431 processed.append((standin, "r", None, msg))
433 processed.append((standin, "r", None, msg))
432 elif (m == "g" and
434 elif (m == "g" and
433 lfutil.standin(f) in p1 and lfutil.standin(f) not in removes):
435 lfutil.standin(f) in p1 and lfutil.standin(f) not in removes):
434 # Case 2: largefile in the working copy, normal file in
436 # Case 2: largefile in the working copy, normal file in
435 # the second parent
437 # the second parent
436 standin = lfutil.standin(f)
438 standin = lfutil.standin(f)
437 lfile = f
439 lfile = f
438 msg = _('remote turned local largefile %s into a normal file\n'
440 msg = _('remote turned local largefile %s into a normal file\n'
439 'keep (l)argefile or use (n)ormal file?'
441 'keep (l)argefile or use (n)ormal file?'
440 '$$ &Largefile $$ &Normal file') % lfile
442 '$$ &Largefile $$ &Normal file') % lfile
441 if repo.ui.promptchoice(msg, 0) == 0:
443 if repo.ui.promptchoice(msg, 0) == 0:
442 processed.append((lfile, "r", None, msg))
444 processed.append((lfile, "r", None, msg))
443 else:
445 else:
444 processed.append((standin, "r", None, msg))
446 processed.append((standin, "r", None, msg))
445 processed.append((lfile, "g", (p2.flags(lfile),), msg))
447 processed.append((lfile, "g", (p2.flags(lfile),), msg))
446 else:
448 else:
447 processed.append(action)
449 processed.append(action)
448
450
449 return processed
451 return processed
450
452
451 # Override filemerge to prompt the user about how they wish to merge
453 # Override filemerge to prompt the user about how they wish to merge
452 # largefiles. This will handle identical edits without prompting the user.
454 # largefiles. This will handle identical edits without prompting the user.
453 def overridefilemerge(origfn, repo, mynode, orig, fcd, fco, fca):
455 def overridefilemerge(origfn, repo, mynode, orig, fcd, fco, fca):
454 if not lfutil.isstandin(orig):
456 if not lfutil.isstandin(orig):
455 return origfn(repo, mynode, orig, fcd, fco, fca)
457 return origfn(repo, mynode, orig, fcd, fco, fca)
456
458
457 ahash = fca.data().strip().lower()
459 ahash = fca.data().strip().lower()
458 dhash = fcd.data().strip().lower()
460 dhash = fcd.data().strip().lower()
459 ohash = fco.data().strip().lower()
461 ohash = fco.data().strip().lower()
460 if (ohash != ahash and
462 if (ohash != ahash and
461 ohash != dhash and
463 ohash != dhash and
462 (dhash == ahash or
464 (dhash == ahash or
463 repo.ui.promptchoice(
465 repo.ui.promptchoice(
464 _('largefile %s has a merge conflict\nancestor was %s\n'
466 _('largefile %s has a merge conflict\nancestor was %s\n'
465 'keep (l)ocal %s or\ntake (o)ther %s?'
467 'keep (l)ocal %s or\ntake (o)ther %s?'
466 '$$ &Local $$ &Other') %
468 '$$ &Local $$ &Other') %
467 (lfutil.splitstandin(orig), ahash, dhash, ohash),
469 (lfutil.splitstandin(orig), ahash, dhash, ohash),
468 0) == 1)):
470 0) == 1)):
469 repo.wwrite(fcd.path(), fco.data(), fco.flags())
471 repo.wwrite(fcd.path(), fco.data(), fco.flags())
470 return 0
472 return 0
471
473
472 # Copy first changes the matchers to match standins instead of
474 # Copy first changes the matchers to match standins instead of
473 # largefiles. Then it overrides util.copyfile in that function it
475 # largefiles. Then it overrides util.copyfile in that function it
474 # checks if the destination largefile already exists. It also keeps a
476 # checks if the destination largefile already exists. It also keeps a
475 # list of copied files so that the largefiles can be copied and the
477 # list of copied files so that the largefiles can be copied and the
476 # dirstate updated.
478 # dirstate updated.
477 def overridecopy(orig, ui, repo, pats, opts, rename=False):
479 def overridecopy(orig, ui, repo, pats, opts, rename=False):
478 # doesn't remove largefile on rename
480 # doesn't remove largefile on rename
479 if len(pats) < 2:
481 if len(pats) < 2:
480 # this isn't legal, let the original function deal with it
482 # this isn't legal, let the original function deal with it
481 return orig(ui, repo, pats, opts, rename)
483 return orig(ui, repo, pats, opts, rename)
482
484
483 def makestandin(relpath):
485 def makestandin(relpath):
484 path = pathutil.canonpath(repo.root, repo.getcwd(), relpath)
486 path = pathutil.canonpath(repo.root, repo.getcwd(), relpath)
485 return os.path.join(repo.wjoin(lfutil.standin(path)))
487 return os.path.join(repo.wjoin(lfutil.standin(path)))
486
488
487 fullpats = scmutil.expandpats(pats)
489 fullpats = scmutil.expandpats(pats)
488 dest = fullpats[-1]
490 dest = fullpats[-1]
489
491
490 if os.path.isdir(dest):
492 if os.path.isdir(dest):
491 if not os.path.isdir(makestandin(dest)):
493 if not os.path.isdir(makestandin(dest)):
492 os.makedirs(makestandin(dest))
494 os.makedirs(makestandin(dest))
493 # This could copy both lfiles and normal files in one command,
495 # This could copy both lfiles and normal files in one command,
494 # but we don't want to do that. First replace their matcher to
496 # but we don't want to do that. First replace their matcher to
495 # only match normal files and run it, then replace it to just
497 # only match normal files and run it, then replace it to just
496 # match largefiles and run it again.
498 # match largefiles and run it again.
497 nonormalfiles = False
499 nonormalfiles = False
498 nolfiles = False
500 nolfiles = False
499 installnormalfilesmatchfn(repo[None].manifest())
501 installnormalfilesmatchfn(repo[None].manifest())
500 try:
502 try:
501 try:
503 try:
502 result = orig(ui, repo, pats, opts, rename)
504 result = orig(ui, repo, pats, opts, rename)
503 except util.Abort, e:
505 except util.Abort, e:
504 if str(e) != _('no files to copy'):
506 if str(e) != _('no files to copy'):
505 raise e
507 raise e
506 else:
508 else:
507 nonormalfiles = True
509 nonormalfiles = True
508 result = 0
510 result = 0
509 finally:
511 finally:
510 restorematchfn()
512 restorematchfn()
511
513
512 # The first rename can cause our current working directory to be removed.
514 # The first rename can cause our current working directory to be removed.
513 # In that case there is nothing left to copy/rename so just quit.
515 # In that case there is nothing left to copy/rename so just quit.
514 try:
516 try:
515 repo.getcwd()
517 repo.getcwd()
516 except OSError:
518 except OSError:
517 return result
519 return result
518
520
519 try:
521 try:
520 try:
522 try:
521 # When we call orig below it creates the standins but we don't add
523 # When we call orig below it creates the standins but we don't add
522 # them to the dir state until later so lock during that time.
524 # them to the dir state until later so lock during that time.
523 wlock = repo.wlock()
525 wlock = repo.wlock()
524
526
525 manifest = repo[None].manifest()
527 manifest = repo[None].manifest()
526 def overridematch(ctx, pats=[], opts={}, globbed=False,
528 def overridematch(ctx, pats=[], opts={}, globbed=False,
527 default='relpath'):
529 default='relpath'):
528 newpats = []
530 newpats = []
529 # The patterns were previously mangled to add the standin
531 # The patterns were previously mangled to add the standin
530 # directory; we need to remove that now
532 # directory; we need to remove that now
531 for pat in pats:
533 for pat in pats:
532 if match_.patkind(pat) is None and lfutil.shortname in pat:
534 if match_.patkind(pat) is None and lfutil.shortname in pat:
533 newpats.append(pat.replace(lfutil.shortname, ''))
535 newpats.append(pat.replace(lfutil.shortname, ''))
534 else:
536 else:
535 newpats.append(pat)
537 newpats.append(pat)
536 match = oldmatch(ctx, newpats, opts, globbed, default)
538 match = oldmatch(ctx, newpats, opts, globbed, default)
537 m = copy.copy(match)
539 m = copy.copy(match)
538 lfile = lambda f: lfutil.standin(f) in manifest
540 lfile = lambda f: lfutil.standin(f) in manifest
539 m._files = [lfutil.standin(f) for f in m._files if lfile(f)]
541 m._files = [lfutil.standin(f) for f in m._files if lfile(f)]
540 m._fmap = set(m._files)
542 m._fmap = set(m._files)
541 m._always = False
543 m._always = False
542 origmatchfn = m.matchfn
544 origmatchfn = m.matchfn
543 m.matchfn = lambda f: (lfutil.isstandin(f) and
545 m.matchfn = lambda f: (lfutil.isstandin(f) and
544 (f in manifest) and
546 (f in manifest) and
545 origmatchfn(lfutil.splitstandin(f)) or
547 origmatchfn(lfutil.splitstandin(f)) or
546 None)
548 None)
547 return m
549 return m
548 oldmatch = installmatchfn(overridematch)
550 oldmatch = installmatchfn(overridematch)
549 listpats = []
551 listpats = []
550 for pat in pats:
552 for pat in pats:
551 if match_.patkind(pat) is not None:
553 if match_.patkind(pat) is not None:
552 listpats.append(pat)
554 listpats.append(pat)
553 else:
555 else:
554 listpats.append(makestandin(pat))
556 listpats.append(makestandin(pat))
555
557
556 try:
558 try:
557 origcopyfile = util.copyfile
559 origcopyfile = util.copyfile
558 copiedfiles = []
560 copiedfiles = []
559 def overridecopyfile(src, dest):
561 def overridecopyfile(src, dest):
560 if (lfutil.shortname in src and
562 if (lfutil.shortname in src and
561 dest.startswith(repo.wjoin(lfutil.shortname))):
563 dest.startswith(repo.wjoin(lfutil.shortname))):
562 destlfile = dest.replace(lfutil.shortname, '')
564 destlfile = dest.replace(lfutil.shortname, '')
563 if not opts['force'] and os.path.exists(destlfile):
565 if not opts['force'] and os.path.exists(destlfile):
564 raise IOError('',
566 raise IOError('',
565 _('destination largefile already exists'))
567 _('destination largefile already exists'))
566 copiedfiles.append((src, dest))
568 copiedfiles.append((src, dest))
567 origcopyfile(src, dest)
569 origcopyfile(src, dest)
568
570
569 util.copyfile = overridecopyfile
571 util.copyfile = overridecopyfile
570 result += orig(ui, repo, listpats, opts, rename)
572 result += orig(ui, repo, listpats, opts, rename)
571 finally:
573 finally:
572 util.copyfile = origcopyfile
574 util.copyfile = origcopyfile
573
575
574 lfdirstate = lfutil.openlfdirstate(ui, repo)
576 lfdirstate = lfutil.openlfdirstate(ui, repo)
575 for (src, dest) in copiedfiles:
577 for (src, dest) in copiedfiles:
576 if (lfutil.shortname in src and
578 if (lfutil.shortname in src and
577 dest.startswith(repo.wjoin(lfutil.shortname))):
579 dest.startswith(repo.wjoin(lfutil.shortname))):
578 srclfile = src.replace(repo.wjoin(lfutil.standin('')), '')
580 srclfile = src.replace(repo.wjoin(lfutil.standin('')), '')
579 destlfile = dest.replace(repo.wjoin(lfutil.standin('')), '')
581 destlfile = dest.replace(repo.wjoin(lfutil.standin('')), '')
580 destlfiledir = os.path.dirname(repo.wjoin(destlfile)) or '.'
582 destlfiledir = os.path.dirname(repo.wjoin(destlfile)) or '.'
581 if not os.path.isdir(destlfiledir):
583 if not os.path.isdir(destlfiledir):
582 os.makedirs(destlfiledir)
584 os.makedirs(destlfiledir)
583 if rename:
585 if rename:
584 os.rename(repo.wjoin(srclfile), repo.wjoin(destlfile))
586 os.rename(repo.wjoin(srclfile), repo.wjoin(destlfile))
585
587
586 # The file is gone, but this deletes any empty parent
588 # The file is gone, but this deletes any empty parent
587 # directories as a side-effect.
589 # directories as a side-effect.
588 util.unlinkpath(repo.wjoin(srclfile), True)
590 util.unlinkpath(repo.wjoin(srclfile), True)
589 lfdirstate.remove(srclfile)
591 lfdirstate.remove(srclfile)
590 else:
592 else:
591 util.copyfile(repo.wjoin(srclfile),
593 util.copyfile(repo.wjoin(srclfile),
592 repo.wjoin(destlfile))
594 repo.wjoin(destlfile))
593
595
594 lfdirstate.add(destlfile)
596 lfdirstate.add(destlfile)
595 lfdirstate.write()
597 lfdirstate.write()
596 except util.Abort, e:
598 except util.Abort, e:
597 if str(e) != _('no files to copy'):
599 if str(e) != _('no files to copy'):
598 raise e
600 raise e
599 else:
601 else:
600 nolfiles = True
602 nolfiles = True
601 finally:
603 finally:
602 restorematchfn()
604 restorematchfn()
603 wlock.release()
605 wlock.release()
604
606
605 if nolfiles and nonormalfiles:
607 if nolfiles and nonormalfiles:
606 raise util.Abort(_('no files to copy'))
608 raise util.Abort(_('no files to copy'))
607
609
608 return result
610 return result
609
611
610 # When the user calls revert, we have to be careful to not revert any
612 # When the user calls revert, we have to be careful to not revert any
611 # changes to other largefiles accidentally. This means we have to keep
613 # changes to other largefiles accidentally. This means we have to keep
612 # track of the largefiles that are being reverted so we only pull down
614 # track of the largefiles that are being reverted so we only pull down
613 # the necessary largefiles.
615 # the necessary largefiles.
614 #
616 #
615 # Standins are only updated (to match the hash of largefiles) before
617 # Standins are only updated (to match the hash of largefiles) before
616 # commits. Update the standins then run the original revert, changing
618 # commits. Update the standins then run the original revert, changing
617 # the matcher to hit standins instead of largefiles. Based on the
619 # the matcher to hit standins instead of largefiles. Based on the
618 # resulting standins update the largefiles.
620 # resulting standins update the largefiles.
619 def overriderevert(orig, ui, repo, *pats, **opts):
621 def overriderevert(orig, ui, repo, *pats, **opts):
620 # Because we put the standins in a bad state (by updating them)
622 # Because we put the standins in a bad state (by updating them)
621 # and then return them to a correct state we need to lock to
623 # and then return them to a correct state we need to lock to
622 # prevent others from changing them in their incorrect state.
624 # prevent others from changing them in their incorrect state.
623 wlock = repo.wlock()
625 wlock = repo.wlock()
624 try:
626 try:
625 lfdirstate = lfutil.openlfdirstate(ui, repo)
627 lfdirstate = lfutil.openlfdirstate(ui, repo)
626 (modified, added, removed, missing, unknown, ignored, clean) = \
628 (modified, added, removed, missing, unknown, ignored, clean) = \
627 lfutil.lfdirstatestatus(lfdirstate, repo, repo['.'].rev())
629 lfutil.lfdirstatestatus(lfdirstate, repo, repo['.'].rev())
628 lfdirstate.write()
630 lfdirstate.write()
629 for lfile in modified:
631 for lfile in modified:
630 lfutil.updatestandin(repo, lfutil.standin(lfile))
632 lfutil.updatestandin(repo, lfutil.standin(lfile))
631 for lfile in missing:
633 for lfile in missing:
632 if (os.path.exists(repo.wjoin(lfutil.standin(lfile)))):
634 if (os.path.exists(repo.wjoin(lfutil.standin(lfile)))):
633 os.unlink(repo.wjoin(lfutil.standin(lfile)))
635 os.unlink(repo.wjoin(lfutil.standin(lfile)))
634
636
635 oldstandins = lfutil.getstandinsstate(repo)
637 oldstandins = lfutil.getstandinsstate(repo)
636
638
637 def overridematch(ctx, pats=[], opts={}, globbed=False,
639 def overridematch(ctx, pats=[], opts={}, globbed=False,
638 default='relpath'):
640 default='relpath'):
639 match = oldmatch(ctx, pats, opts, globbed, default)
641 match = oldmatch(ctx, pats, opts, globbed, default)
640 m = copy.copy(match)
642 m = copy.copy(match)
641 def tostandin(f):
643 def tostandin(f):
642 if lfutil.standin(f) in ctx:
644 if lfutil.standin(f) in ctx:
643 return lfutil.standin(f)
645 return lfutil.standin(f)
644 elif lfutil.standin(f) in repo[None]:
646 elif lfutil.standin(f) in repo[None]:
645 return None
647 return None
646 return f
648 return f
647 m._files = [tostandin(f) for f in m._files]
649 m._files = [tostandin(f) for f in m._files]
648 m._files = [f for f in m._files if f is not None]
650 m._files = [f for f in m._files if f is not None]
649 m._fmap = set(m._files)
651 m._fmap = set(m._files)
650 m._always = False
652 m._always = False
651 origmatchfn = m.matchfn
653 origmatchfn = m.matchfn
652 def matchfn(f):
654 def matchfn(f):
653 if lfutil.isstandin(f):
655 if lfutil.isstandin(f):
654 return (origmatchfn(lfutil.splitstandin(f)) and
656 return (origmatchfn(lfutil.splitstandin(f)) and
655 (f in repo[None] or f in ctx))
657 (f in repo[None] or f in ctx))
656 return origmatchfn(f)
658 return origmatchfn(f)
657 m.matchfn = matchfn
659 m.matchfn = matchfn
658 return m
660 return m
659 oldmatch = installmatchfn(overridematch)
661 oldmatch = installmatchfn(overridematch)
660 try:
662 try:
661 orig(ui, repo, *pats, **opts)
663 orig(ui, repo, *pats, **opts)
662 finally:
664 finally:
663 restorematchfn()
665 restorematchfn()
664
666
665 newstandins = lfutil.getstandinsstate(repo)
667 newstandins = lfutil.getstandinsstate(repo)
666 filelist = lfutil.getlfilestoupdate(oldstandins, newstandins)
668 filelist = lfutil.getlfilestoupdate(oldstandins, newstandins)
667 lfcommands.updatelfiles(ui, repo, filelist, printmessage=False)
669 lfcommands.updatelfiles(ui, repo, filelist, printmessage=False)
668
670
669 finally:
671 finally:
670 wlock.release()
672 wlock.release()
671
673
672 def hgupdaterepo(orig, repo, node, overwrite):
674 def hgupdaterepo(orig, repo, node, overwrite):
673 if not overwrite:
675 if not overwrite:
674 # Only call updatelfiles on the standins that have changed to save time
676 # Only call updatelfiles on the standins that have changed to save time
675 oldstandins = lfutil.getstandinsstate(repo)
677 oldstandins = lfutil.getstandinsstate(repo)
676
678
677 result = orig(repo, node, overwrite)
679 result = orig(repo, node, overwrite)
678
680
679 filelist = None
681 filelist = None
680 if not overwrite:
682 if not overwrite:
681 newstandins = lfutil.getstandinsstate(repo)
683 newstandins = lfutil.getstandinsstate(repo)
682 filelist = lfutil.getlfilestoupdate(oldstandins, newstandins)
684 filelist = lfutil.getlfilestoupdate(oldstandins, newstandins)
683 lfcommands.updatelfiles(repo.ui, repo, filelist=filelist)
685 lfcommands.updatelfiles(repo.ui, repo, filelist=filelist)
684 return result
686 return result
685
687
686 def hgmerge(orig, repo, node, force=None, remind=True):
688 def hgmerge(orig, repo, node, force=None, remind=True):
687 result = orig(repo, node, force, remind)
689 result = orig(repo, node, force, remind)
688 lfcommands.updatelfiles(repo.ui, repo)
690 lfcommands.updatelfiles(repo.ui, repo)
689 return result
691 return result
690
692
691 # When we rebase a repository with remotely changed largefiles, we need to
693 # When we rebase a repository with remotely changed largefiles, we need to
692 # take some extra care so that the largefiles are correctly updated in the
694 # take some extra care so that the largefiles are correctly updated in the
693 # working copy
695 # working copy
694 def overridepull(orig, ui, repo, source=None, **opts):
696 def overridepull(orig, ui, repo, source=None, **opts):
695 revsprepull = len(repo)
697 revsprepull = len(repo)
696 if not source:
698 if not source:
697 source = 'default'
699 source = 'default'
698 repo.lfpullsource = source
700 repo.lfpullsource = source
699 if opts.get('rebase', False):
701 if opts.get('rebase', False):
700 repo._isrebasing = True
702 repo._isrebasing = True
701 try:
703 try:
702 if opts.get('update'):
704 if opts.get('update'):
703 del opts['update']
705 del opts['update']
704 ui.debug('--update and --rebase are not compatible, ignoring '
706 ui.debug('--update and --rebase are not compatible, ignoring '
705 'the update flag\n')
707 'the update flag\n')
706 del opts['rebase']
708 del opts['rebase']
707 origpostincoming = commands.postincoming
709 origpostincoming = commands.postincoming
708 def _dummy(*args, **kwargs):
710 def _dummy(*args, **kwargs):
709 pass
711 pass
710 commands.postincoming = _dummy
712 commands.postincoming = _dummy
711 try:
713 try:
712 result = commands.pull(ui, repo, source, **opts)
714 result = commands.pull(ui, repo, source, **opts)
713 finally:
715 finally:
714 commands.postincoming = origpostincoming
716 commands.postincoming = origpostincoming
715 revspostpull = len(repo)
717 revspostpull = len(repo)
716 if revspostpull > revsprepull:
718 if revspostpull > revsprepull:
717 result = result or rebase.rebase(ui, repo)
719 result = result or rebase.rebase(ui, repo)
718 finally:
720 finally:
719 repo._isrebasing = False
721 repo._isrebasing = False
720 else:
722 else:
721 result = orig(ui, repo, source, **opts)
723 result = orig(ui, repo, source, **opts)
722 revspostpull = len(repo)
724 revspostpull = len(repo)
723 lfrevs = opts.get('lfrev', [])
725 lfrevs = opts.get('lfrev', [])
724 if opts.get('all_largefiles'):
726 if opts.get('all_largefiles'):
725 lfrevs.append('pulled()')
727 lfrevs.append('pulled()')
726 if lfrevs and revspostpull > revsprepull:
728 if lfrevs and revspostpull > revsprepull:
727 numcached = 0
729 numcached = 0
728 repo.firstpulled = revsprepull # for pulled() revset expression
730 repo.firstpulled = revsprepull # for pulled() revset expression
729 try:
731 try:
730 for rev in scmutil.revrange(repo, lfrevs):
732 for rev in scmutil.revrange(repo, lfrevs):
731 ui.note(_('pulling largefiles for revision %s\n') % rev)
733 ui.note(_('pulling largefiles for revision %s\n') % rev)
732 (cached, missing) = lfcommands.cachelfiles(ui, repo, rev)
734 (cached, missing) = lfcommands.cachelfiles(ui, repo, rev)
733 numcached += len(cached)
735 numcached += len(cached)
734 finally:
736 finally:
735 del repo.firstpulled
737 del repo.firstpulled
736 ui.status(_("%d largefiles cached\n") % numcached)
738 ui.status(_("%d largefiles cached\n") % numcached)
737 return result
739 return result
738
740
739 def pulledrevsetsymbol(repo, subset, x):
741 def pulledrevsetsymbol(repo, subset, x):
740 """``pulled()``
742 """``pulled()``
741 Changesets that just has been pulled.
743 Changesets that just has been pulled.
742
744
743 Only available with largefiles from pull --lfrev expressions.
745 Only available with largefiles from pull --lfrev expressions.
744
746
745 .. container:: verbose
747 .. container:: verbose
746
748
747 Some examples:
749 Some examples:
748
750
749 - pull largefiles for all new changesets::
751 - pull largefiles for all new changesets::
750
752
751 hg pull -lfrev "pulled()"
753 hg pull -lfrev "pulled()"
752
754
753 - pull largefiles for all new branch heads::
755 - pull largefiles for all new branch heads::
754
756
755 hg pull -lfrev "head(pulled()) and not closed()"
757 hg pull -lfrev "head(pulled()) and not closed()"
756
758
757 """
759 """
758
760
759 try:
761 try:
760 firstpulled = repo.firstpulled
762 firstpulled = repo.firstpulled
761 except AttributeError:
763 except AttributeError:
762 raise util.Abort(_("pulled() only available in --lfrev"))
764 raise util.Abort(_("pulled() only available in --lfrev"))
763 return revset.baseset([r for r in subset if r >= firstpulled])
765 return revset.baseset([r for r in subset if r >= firstpulled])
764
766
765 def overrideclone(orig, ui, source, dest=None, **opts):
767 def overrideclone(orig, ui, source, dest=None, **opts):
766 d = dest
768 d = dest
767 if d is None:
769 if d is None:
768 d = hg.defaultdest(source)
770 d = hg.defaultdest(source)
769 if opts.get('all_largefiles') and not hg.islocal(d):
771 if opts.get('all_largefiles') and not hg.islocal(d):
770 raise util.Abort(_(
772 raise util.Abort(_(
771 '--all-largefiles is incompatible with non-local destination %s') %
773 '--all-largefiles is incompatible with non-local destination %s') %
772 d)
774 d)
773
775
774 return orig(ui, source, dest, **opts)
776 return orig(ui, source, dest, **opts)
775
777
776 def hgclone(orig, ui, opts, *args, **kwargs):
778 def hgclone(orig, ui, opts, *args, **kwargs):
777 result = orig(ui, opts, *args, **kwargs)
779 result = orig(ui, opts, *args, **kwargs)
778
780
779 if result is not None:
781 if result is not None:
780 sourcerepo, destrepo = result
782 sourcerepo, destrepo = result
781 repo = destrepo.local()
783 repo = destrepo.local()
782
784
783 # Caching is implicitly limited to 'rev' option, since the dest repo was
785 # Caching is implicitly limited to 'rev' option, since the dest repo was
784 # truncated at that point. The user may expect a download count with
786 # truncated at that point. The user may expect a download count with
785 # this option, so attempt whether or not this is a largefile repo.
787 # this option, so attempt whether or not this is a largefile repo.
786 if opts.get('all_largefiles'):
788 if opts.get('all_largefiles'):
787 success, missing = lfcommands.downloadlfiles(ui, repo, None)
789 success, missing = lfcommands.downloadlfiles(ui, repo, None)
788
790
789 if missing != 0:
791 if missing != 0:
790 return None
792 return None
791
793
792 return result
794 return result
793
795
794 def overriderebase(orig, ui, repo, **opts):
796 def overriderebase(orig, ui, repo, **opts):
795 repo._isrebasing = True
797 repo._isrebasing = True
796 try:
798 try:
797 return orig(ui, repo, **opts)
799 return orig(ui, repo, **opts)
798 finally:
800 finally:
799 repo._isrebasing = False
801 repo._isrebasing = False
800
802
801 def overridearchive(orig, repo, dest, node, kind, decode=True, matchfn=None,
803 def overridearchive(orig, repo, dest, node, kind, decode=True, matchfn=None,
802 prefix=None, mtime=None, subrepos=None):
804 prefix=None, mtime=None, subrepos=None):
803 # No need to lock because we are only reading history and
805 # No need to lock because we are only reading history and
804 # largefile caches, neither of which are modified.
806 # largefile caches, neither of which are modified.
805 lfcommands.cachelfiles(repo.ui, repo, node)
807 lfcommands.cachelfiles(repo.ui, repo, node)
806
808
807 if kind not in archival.archivers:
809 if kind not in archival.archivers:
808 raise util.Abort(_("unknown archive type '%s'") % kind)
810 raise util.Abort(_("unknown archive type '%s'") % kind)
809
811
810 ctx = repo[node]
812 ctx = repo[node]
811
813
812 if kind == 'files':
814 if kind == 'files':
813 if prefix:
815 if prefix:
814 raise util.Abort(
816 raise util.Abort(
815 _('cannot give prefix when archiving to files'))
817 _('cannot give prefix when archiving to files'))
816 else:
818 else:
817 prefix = archival.tidyprefix(dest, kind, prefix)
819 prefix = archival.tidyprefix(dest, kind, prefix)
818
820
819 def write(name, mode, islink, getdata):
821 def write(name, mode, islink, getdata):
820 if matchfn and not matchfn(name):
822 if matchfn and not matchfn(name):
821 return
823 return
822 data = getdata()
824 data = getdata()
823 if decode:
825 if decode:
824 data = repo.wwritedata(name, data)
826 data = repo.wwritedata(name, data)
825 archiver.addfile(prefix + name, mode, islink, data)
827 archiver.addfile(prefix + name, mode, islink, data)
826
828
827 archiver = archival.archivers[kind](dest, mtime or ctx.date()[0])
829 archiver = archival.archivers[kind](dest, mtime or ctx.date()[0])
828
830
829 if repo.ui.configbool("ui", "archivemeta", True):
831 if repo.ui.configbool("ui", "archivemeta", True):
830 def metadata():
832 def metadata():
831 base = 'repo: %s\nnode: %s\nbranch: %s\n' % (
833 base = 'repo: %s\nnode: %s\nbranch: %s\n' % (
832 hex(repo.changelog.node(0)), hex(node), ctx.branch())
834 hex(repo.changelog.node(0)), hex(node), ctx.branch())
833
835
834 tags = ''.join('tag: %s\n' % t for t in ctx.tags()
836 tags = ''.join('tag: %s\n' % t for t in ctx.tags()
835 if repo.tagtype(t) == 'global')
837 if repo.tagtype(t) == 'global')
836 if not tags:
838 if not tags:
837 repo.ui.pushbuffer()
839 repo.ui.pushbuffer()
838 opts = {'template': '{latesttag}\n{latesttagdistance}',
840 opts = {'template': '{latesttag}\n{latesttagdistance}',
839 'style': '', 'patch': None, 'git': None}
841 'style': '', 'patch': None, 'git': None}
840 cmdutil.show_changeset(repo.ui, repo, opts).show(ctx)
842 cmdutil.show_changeset(repo.ui, repo, opts).show(ctx)
841 ltags, dist = repo.ui.popbuffer().split('\n')
843 ltags, dist = repo.ui.popbuffer().split('\n')
842 tags = ''.join('latesttag: %s\n' % t for t in ltags.split(':'))
844 tags = ''.join('latesttag: %s\n' % t for t in ltags.split(':'))
843 tags += 'latesttagdistance: %s\n' % dist
845 tags += 'latesttagdistance: %s\n' % dist
844
846
845 return base + tags
847 return base + tags
846
848
847 write('.hg_archival.txt', 0644, False, metadata)
849 write('.hg_archival.txt', 0644, False, metadata)
848
850
849 for f in ctx:
851 for f in ctx:
850 ff = ctx.flags(f)
852 ff = ctx.flags(f)
851 getdata = ctx[f].data
853 getdata = ctx[f].data
852 if lfutil.isstandin(f):
854 if lfutil.isstandin(f):
853 path = lfutil.findfile(repo, getdata().strip())
855 path = lfutil.findfile(repo, getdata().strip())
854 if path is None:
856 if path is None:
855 raise util.Abort(
857 raise util.Abort(
856 _('largefile %s not found in repo store or system cache')
858 _('largefile %s not found in repo store or system cache')
857 % lfutil.splitstandin(f))
859 % lfutil.splitstandin(f))
858 f = lfutil.splitstandin(f)
860 f = lfutil.splitstandin(f)
859
861
860 def getdatafn():
862 def getdatafn():
861 fd = None
863 fd = None
862 try:
864 try:
863 fd = open(path, 'rb')
865 fd = open(path, 'rb')
864 return fd.read()
866 return fd.read()
865 finally:
867 finally:
866 if fd:
868 if fd:
867 fd.close()
869 fd.close()
868
870
869 getdata = getdatafn
871 getdata = getdatafn
870 write(f, 'x' in ff and 0755 or 0644, 'l' in ff, getdata)
872 write(f, 'x' in ff and 0755 or 0644, 'l' in ff, getdata)
871
873
872 if subrepos:
874 if subrepos:
873 for subpath in sorted(ctx.substate):
875 for subpath in sorted(ctx.substate):
874 sub = ctx.sub(subpath)
876 sub = ctx.sub(subpath)
875 submatch = match_.narrowmatcher(subpath, matchfn)
877 submatch = match_.narrowmatcher(subpath, matchfn)
876 sub.archive(repo.ui, archiver, prefix, submatch)
878 sub.archive(repo.ui, archiver, prefix, submatch)
877
879
878 archiver.done()
880 archiver.done()
879
881
880 def hgsubrepoarchive(orig, repo, ui, archiver, prefix, match=None):
882 def hgsubrepoarchive(orig, repo, ui, archiver, prefix, match=None):
881 repo._get(repo._state + ('hg',))
883 repo._get(repo._state + ('hg',))
882 rev = repo._state[1]
884 rev = repo._state[1]
883 ctx = repo._repo[rev]
885 ctx = repo._repo[rev]
884
886
885 lfcommands.cachelfiles(ui, repo._repo, ctx.node())
887 lfcommands.cachelfiles(ui, repo._repo, ctx.node())
886
888
887 def write(name, mode, islink, getdata):
889 def write(name, mode, islink, getdata):
888 # At this point, the standin has been replaced with the largefile name,
890 # At this point, the standin has been replaced with the largefile name,
889 # so the normal matcher works here without the lfutil variants.
891 # so the normal matcher works here without the lfutil variants.
890 if match and not match(f):
892 if match and not match(f):
891 return
893 return
892 data = getdata()
894 data = getdata()
893
895
894 archiver.addfile(prefix + repo._path + '/' + name, mode, islink, data)
896 archiver.addfile(prefix + repo._path + '/' + name, mode, islink, data)
895
897
896 for f in ctx:
898 for f in ctx:
897 ff = ctx.flags(f)
899 ff = ctx.flags(f)
898 getdata = ctx[f].data
900 getdata = ctx[f].data
899 if lfutil.isstandin(f):
901 if lfutil.isstandin(f):
900 path = lfutil.findfile(repo._repo, getdata().strip())
902 path = lfutil.findfile(repo._repo, getdata().strip())
901 if path is None:
903 if path is None:
902 raise util.Abort(
904 raise util.Abort(
903 _('largefile %s not found in repo store or system cache')
905 _('largefile %s not found in repo store or system cache')
904 % lfutil.splitstandin(f))
906 % lfutil.splitstandin(f))
905 f = lfutil.splitstandin(f)
907 f = lfutil.splitstandin(f)
906
908
907 def getdatafn():
909 def getdatafn():
908 fd = None
910 fd = None
909 try:
911 try:
910 fd = open(os.path.join(prefix, path), 'rb')
912 fd = open(os.path.join(prefix, path), 'rb')
911 return fd.read()
913 return fd.read()
912 finally:
914 finally:
913 if fd:
915 if fd:
914 fd.close()
916 fd.close()
915
917
916 getdata = getdatafn
918 getdata = getdatafn
917
919
918 write(f, 'x' in ff and 0755 or 0644, 'l' in ff, getdata)
920 write(f, 'x' in ff and 0755 or 0644, 'l' in ff, getdata)
919
921
920 for subpath in sorted(ctx.substate):
922 for subpath in sorted(ctx.substate):
921 sub = ctx.sub(subpath)
923 sub = ctx.sub(subpath)
922 submatch = match_.narrowmatcher(subpath, match)
924 submatch = match_.narrowmatcher(subpath, match)
923 sub.archive(ui, archiver, os.path.join(prefix, repo._path) + '/',
925 sub.archive(ui, archiver, os.path.join(prefix, repo._path) + '/',
924 submatch)
926 submatch)
925
927
926 # If a largefile is modified, the change is not reflected in its
928 # If a largefile is modified, the change is not reflected in its
927 # standin until a commit. cmdutil.bailifchanged() raises an exception
929 # standin until a commit. cmdutil.bailifchanged() raises an exception
928 # if the repo has uncommitted changes. Wrap it to also check if
930 # if the repo has uncommitted changes. Wrap it to also check if
929 # largefiles were changed. This is used by bisect and backout.
931 # largefiles were changed. This is used by bisect and backout.
930 def overridebailifchanged(orig, repo):
932 def overridebailifchanged(orig, repo):
931 orig(repo)
933 orig(repo)
932 repo.lfstatus = True
934 repo.lfstatus = True
933 modified, added, removed, deleted = repo.status()[:4]
935 modified, added, removed, deleted = repo.status()[:4]
934 repo.lfstatus = False
936 repo.lfstatus = False
935 if modified or added or removed or deleted:
937 if modified or added or removed or deleted:
936 raise util.Abort(_('uncommitted changes'))
938 raise util.Abort(_('uncommitted changes'))
937
939
938 # Fetch doesn't use cmdutil.bailifchanged so override it to add the check
940 # Fetch doesn't use cmdutil.bailifchanged so override it to add the check
939 def overridefetch(orig, ui, repo, *pats, **opts):
941 def overridefetch(orig, ui, repo, *pats, **opts):
940 repo.lfstatus = True
942 repo.lfstatus = True
941 modified, added, removed, deleted = repo.status()[:4]
943 modified, added, removed, deleted = repo.status()[:4]
942 repo.lfstatus = False
944 repo.lfstatus = False
943 if modified or added or removed or deleted:
945 if modified or added or removed or deleted:
944 raise util.Abort(_('uncommitted changes'))
946 raise util.Abort(_('uncommitted changes'))
945 return orig(ui, repo, *pats, **opts)
947 return orig(ui, repo, *pats, **opts)
946
948
947 def overrideforget(orig, ui, repo, *pats, **opts):
949 def overrideforget(orig, ui, repo, *pats, **opts):
948 installnormalfilesmatchfn(repo[None].manifest())
950 installnormalfilesmatchfn(repo[None].manifest())
949 result = orig(ui, repo, *pats, **opts)
951 result = orig(ui, repo, *pats, **opts)
950 restorematchfn()
952 restorematchfn()
951 m = scmutil.match(repo[None], pats, opts)
953 m = scmutil.match(repo[None], pats, opts)
952
954
953 try:
955 try:
954 repo.lfstatus = True
956 repo.lfstatus = True
955 s = repo.status(match=m, clean=True)
957 s = repo.status(match=m, clean=True)
956 finally:
958 finally:
957 repo.lfstatus = False
959 repo.lfstatus = False
958 forget = sorted(s[0] + s[1] + s[3] + s[6])
960 forget = sorted(s[0] + s[1] + s[3] + s[6])
959 forget = [f for f in forget if lfutil.standin(f) in repo[None].manifest()]
961 forget = [f for f in forget if lfutil.standin(f) in repo[None].manifest()]
960
962
961 for f in forget:
963 for f in forget:
962 if lfutil.standin(f) not in repo.dirstate and not \
964 if lfutil.standin(f) not in repo.dirstate and not \
963 os.path.isdir(m.rel(lfutil.standin(f))):
965 os.path.isdir(m.rel(lfutil.standin(f))):
964 ui.warn(_('not removing %s: file is already untracked\n')
966 ui.warn(_('not removing %s: file is already untracked\n')
965 % m.rel(f))
967 % m.rel(f))
966 result = 1
968 result = 1
967
969
968 for f in forget:
970 for f in forget:
969 if ui.verbose or not m.exact(f):
971 if ui.verbose or not m.exact(f):
970 ui.status(_('removing %s\n') % m.rel(f))
972 ui.status(_('removing %s\n') % m.rel(f))
971
973
972 # Need to lock because standin files are deleted then removed from the
974 # Need to lock because standin files are deleted then removed from the
973 # repository and we could race in-between.
975 # repository and we could race in-between.
974 wlock = repo.wlock()
976 wlock = repo.wlock()
975 try:
977 try:
976 lfdirstate = lfutil.openlfdirstate(ui, repo)
978 lfdirstate = lfutil.openlfdirstate(ui, repo)
977 for f in forget:
979 for f in forget:
978 if lfdirstate[f] == 'a':
980 if lfdirstate[f] == 'a':
979 lfdirstate.drop(f)
981 lfdirstate.drop(f)
980 else:
982 else:
981 lfdirstate.remove(f)
983 lfdirstate.remove(f)
982 lfdirstate.write()
984 lfdirstate.write()
983 standins = [lfutil.standin(f) for f in forget]
985 standins = [lfutil.standin(f) for f in forget]
984 for f in standins:
986 for f in standins:
985 util.unlinkpath(repo.wjoin(f), ignoremissing=True)
987 util.unlinkpath(repo.wjoin(f), ignoremissing=True)
986 repo[None].forget(standins)
988 repo[None].forget(standins)
987 finally:
989 finally:
988 wlock.release()
990 wlock.release()
989
991
990 return result
992 return result
991
993
992 def outgoinghook(ui, repo, other, opts, missing):
994 def outgoinghook(ui, repo, other, opts, missing):
993 if opts.pop('large', None):
995 if opts.pop('large', None):
994 toupload = set()
996 toupload = set()
995 lfutil.getlfilestoupload(repo, missing,
997 lfutil.getlfilestoupload(repo, missing,
996 lambda fn, lfhash: toupload.add(fn))
998 lambda fn, lfhash: toupload.add(fn))
997 if not toupload:
999 if not toupload:
998 ui.status(_('largefiles: no files to upload\n'))
1000 ui.status(_('largefiles: no files to upload\n'))
999 else:
1001 else:
1000 ui.status(_('largefiles to upload:\n'))
1002 ui.status(_('largefiles to upload:\n'))
1001 for file in sorted(toupload):
1003 for file in sorted(toupload):
1002 ui.status(lfutil.splitstandin(file) + '\n')
1004 ui.status(lfutil.splitstandin(file) + '\n')
1003 ui.status('\n')
1005 ui.status('\n')
1004
1006
1005 def summaryremotehook(ui, repo, opts, changes):
1007 def summaryremotehook(ui, repo, opts, changes):
1006 largeopt = opts.get('large', False)
1008 largeopt = opts.get('large', False)
1007 if changes is None:
1009 if changes is None:
1008 if largeopt:
1010 if largeopt:
1009 return (False, True) # only outgoing check is needed
1011 return (False, True) # only outgoing check is needed
1010 else:
1012 else:
1011 return (False, False)
1013 return (False, False)
1012 elif largeopt:
1014 elif largeopt:
1013 url, branch, peer, outgoing = changes[1]
1015 url, branch, peer, outgoing = changes[1]
1014 if peer is None:
1016 if peer is None:
1015 # i18n: column positioning for "hg summary"
1017 # i18n: column positioning for "hg summary"
1016 ui.status(_('largefiles: (no remote repo)\n'))
1018 ui.status(_('largefiles: (no remote repo)\n'))
1017 return
1019 return
1018
1020
1019 toupload = set()
1021 toupload = set()
1020 lfutil.getlfilestoupload(repo, outgoing.missing,
1022 lfutil.getlfilestoupload(repo, outgoing.missing,
1021 lambda fn, lfhash: toupload.add(fn))
1023 lambda fn, lfhash: toupload.add(fn))
1022 if not toupload:
1024 if not toupload:
1023 # i18n: column positioning for "hg summary"
1025 # i18n: column positioning for "hg summary"
1024 ui.status(_('largefiles: (no files to upload)\n'))
1026 ui.status(_('largefiles: (no files to upload)\n'))
1025 else:
1027 else:
1026 # i18n: column positioning for "hg summary"
1028 # i18n: column positioning for "hg summary"
1027 ui.status(_('largefiles: %d to upload\n') % len(toupload))
1029 ui.status(_('largefiles: %d to upload\n') % len(toupload))
1028
1030
1029 def overridesummary(orig, ui, repo, *pats, **opts):
1031 def overridesummary(orig, ui, repo, *pats, **opts):
1030 try:
1032 try:
1031 repo.lfstatus = True
1033 repo.lfstatus = True
1032 orig(ui, repo, *pats, **opts)
1034 orig(ui, repo, *pats, **opts)
1033 finally:
1035 finally:
1034 repo.lfstatus = False
1036 repo.lfstatus = False
1035
1037
1036 def scmutiladdremove(orig, repo, pats=[], opts={}, dry_run=None,
1038 def scmutiladdremove(orig, repo, pats=[], opts={}, dry_run=None,
1037 similarity=None):
1039 similarity=None):
1038 if not lfutil.islfilesrepo(repo):
1040 if not lfutil.islfilesrepo(repo):
1039 return orig(repo, pats, opts, dry_run, similarity)
1041 return orig(repo, pats, opts, dry_run, similarity)
1040 # Get the list of missing largefiles so we can remove them
1042 # Get the list of missing largefiles so we can remove them
1041 lfdirstate = lfutil.openlfdirstate(repo.ui, repo)
1043 lfdirstate = lfutil.openlfdirstate(repo.ui, repo)
1042 s = lfdirstate.status(match_.always(repo.root, repo.getcwd()), [], False,
1044 s = lfdirstate.status(match_.always(repo.root, repo.getcwd()), [], False,
1043 False, False)
1045 False, False)
1044 (unsure, modified, added, removed, missing, unknown, ignored, clean) = s
1046 (unsure, modified, added, removed, missing, unknown, ignored, clean) = s
1045
1047
1046 # Call into the normal remove code, but the removing of the standin, we want
1048 # Call into the normal remove code, but the removing of the standin, we want
1047 # to have handled by original addremove. Monkey patching here makes sure
1049 # to have handled by original addremove. Monkey patching here makes sure
1048 # we don't remove the standin in the largefiles code, preventing a very
1050 # we don't remove the standin in the largefiles code, preventing a very
1049 # confused state later.
1051 # confused state later.
1050 if missing:
1052 if missing:
1051 m = [repo.wjoin(f) for f in missing]
1053 m = [repo.wjoin(f) for f in missing]
1052 repo._isaddremove = True
1054 repo._isaddremove = True
1053 removelargefiles(repo.ui, repo, *m, **opts)
1055 removelargefiles(repo.ui, repo, *m, **opts)
1054 repo._isaddremove = False
1056 repo._isaddremove = False
1055 # Call into the normal add code, and any files that *should* be added as
1057 # Call into the normal add code, and any files that *should* be added as
1056 # largefiles will be
1058 # largefiles will be
1057 addlargefiles(repo.ui, repo, *pats, **opts)
1059 addlargefiles(repo.ui, repo, *pats, **opts)
1058 # Now that we've handled largefiles, hand off to the original addremove
1060 # Now that we've handled largefiles, hand off to the original addremove
1059 # function to take care of the rest. Make sure it doesn't do anything with
1061 # function to take care of the rest. Make sure it doesn't do anything with
1060 # largefiles by installing a matcher that will ignore them.
1062 # largefiles by installing a matcher that will ignore them.
1061 installnormalfilesmatchfn(repo[None].manifest())
1063 installnormalfilesmatchfn(repo[None].manifest())
1062 result = orig(repo, pats, opts, dry_run, similarity)
1064 result = orig(repo, pats, opts, dry_run, similarity)
1063 restorematchfn()
1065 restorematchfn()
1064 return result
1066 return result
1065
1067
1066 # Calling purge with --all will cause the largefiles to be deleted.
1068 # Calling purge with --all will cause the largefiles to be deleted.
1067 # Override repo.status to prevent this from happening.
1069 # Override repo.status to prevent this from happening.
1068 def overridepurge(orig, ui, repo, *dirs, **opts):
1070 def overridepurge(orig, ui, repo, *dirs, **opts):
1069 # XXX large file status is buggy when used on repo proxy.
1071 # XXX large file status is buggy when used on repo proxy.
1070 # XXX this needs to be investigate.
1072 # XXX this needs to be investigate.
1071 repo = repo.unfiltered()
1073 repo = repo.unfiltered()
1072 oldstatus = repo.status
1074 oldstatus = repo.status
1073 def overridestatus(node1='.', node2=None, match=None, ignored=False,
1075 def overridestatus(node1='.', node2=None, match=None, ignored=False,
1074 clean=False, unknown=False, listsubrepos=False):
1076 clean=False, unknown=False, listsubrepos=False):
1075 r = oldstatus(node1, node2, match, ignored, clean, unknown,
1077 r = oldstatus(node1, node2, match, ignored, clean, unknown,
1076 listsubrepos)
1078 listsubrepos)
1077 lfdirstate = lfutil.openlfdirstate(ui, repo)
1079 lfdirstate = lfutil.openlfdirstate(ui, repo)
1078 modified, added, removed, deleted, unknown, ignored, clean = r
1080 modified, added, removed, deleted, unknown, ignored, clean = r
1079 unknown = [f for f in unknown if lfdirstate[f] == '?']
1081 unknown = [f for f in unknown if lfdirstate[f] == '?']
1080 ignored = [f for f in ignored if lfdirstate[f] == '?']
1082 ignored = [f for f in ignored if lfdirstate[f] == '?']
1081 return modified, added, removed, deleted, unknown, ignored, clean
1083 return modified, added, removed, deleted, unknown, ignored, clean
1082 repo.status = overridestatus
1084 repo.status = overridestatus
1083 orig(ui, repo, *dirs, **opts)
1085 orig(ui, repo, *dirs, **opts)
1084 repo.status = oldstatus
1086 repo.status = oldstatus
1085
1087
1086 def overriderollback(orig, ui, repo, **opts):
1088 def overriderollback(orig, ui, repo, **opts):
1087 result = orig(ui, repo, **opts)
1089 result = orig(ui, repo, **opts)
1088 merge.update(repo, node=None, branchmerge=False, force=True,
1090 merge.update(repo, node=None, branchmerge=False, force=True,
1089 partial=lfutil.isstandin)
1091 partial=lfutil.isstandin)
1090 wlock = repo.wlock()
1092 wlock = repo.wlock()
1091 try:
1093 try:
1092 lfdirstate = lfutil.openlfdirstate(ui, repo)
1094 lfdirstate = lfutil.openlfdirstate(ui, repo)
1093 lfiles = lfutil.listlfiles(repo)
1095 lfiles = lfutil.listlfiles(repo)
1094 oldlfiles = lfutil.listlfiles(repo, repo[None].parents()[0].rev())
1096 oldlfiles = lfutil.listlfiles(repo, repo[None].parents()[0].rev())
1095 for file in lfiles:
1097 for file in lfiles:
1096 if file in oldlfiles:
1098 if file in oldlfiles:
1097 lfdirstate.normallookup(file)
1099 lfdirstate.normallookup(file)
1098 else:
1100 else:
1099 lfdirstate.add(file)
1101 lfdirstate.add(file)
1100 lfdirstate.write()
1102 lfdirstate.write()
1101 finally:
1103 finally:
1102 wlock.release()
1104 wlock.release()
1103 return result
1105 return result
1104
1106
1105 def overridetransplant(orig, ui, repo, *revs, **opts):
1107 def overridetransplant(orig, ui, repo, *revs, **opts):
1106 try:
1108 try:
1107 oldstandins = lfutil.getstandinsstate(repo)
1109 oldstandins = lfutil.getstandinsstate(repo)
1108 repo._istransplanting = True
1110 repo._istransplanting = True
1109 result = orig(ui, repo, *revs, **opts)
1111 result = orig(ui, repo, *revs, **opts)
1110 newstandins = lfutil.getstandinsstate(repo)
1112 newstandins = lfutil.getstandinsstate(repo)
1111 filelist = lfutil.getlfilestoupdate(oldstandins, newstandins)
1113 filelist = lfutil.getlfilestoupdate(oldstandins, newstandins)
1112 lfcommands.updatelfiles(repo.ui, repo, filelist=filelist,
1114 lfcommands.updatelfiles(repo.ui, repo, filelist=filelist,
1113 printmessage=True)
1115 printmessage=True)
1114 finally:
1116 finally:
1115 repo._istransplanting = False
1117 repo._istransplanting = False
1116 return result
1118 return result
1117
1119
1118 def overridecat(orig, ui, repo, file1, *pats, **opts):
1120 def overridecat(orig, ui, repo, file1, *pats, **opts):
1119 ctx = scmutil.revsingle(repo, opts.get('rev'))
1121 ctx = scmutil.revsingle(repo, opts.get('rev'))
1120 err = 1
1122 err = 1
1121 notbad = set()
1123 notbad = set()
1122 m = scmutil.match(ctx, (file1,) + pats, opts)
1124 m = scmutil.match(ctx, (file1,) + pats, opts)
1123 origmatchfn = m.matchfn
1125 origmatchfn = m.matchfn
1124 def lfmatchfn(f):
1126 def lfmatchfn(f):
1125 if origmatchfn(f):
1127 if origmatchfn(f):
1126 return True
1128 return True
1127 lf = lfutil.splitstandin(f)
1129 lf = lfutil.splitstandin(f)
1128 if lf is None:
1130 if lf is None:
1129 return False
1131 return False
1130 notbad.add(lf)
1132 notbad.add(lf)
1131 return origmatchfn(lf)
1133 return origmatchfn(lf)
1132 m.matchfn = lfmatchfn
1134 m.matchfn = lfmatchfn
1133 origbadfn = m.bad
1135 origbadfn = m.bad
1134 def lfbadfn(f, msg):
1136 def lfbadfn(f, msg):
1135 if not f in notbad:
1137 if not f in notbad:
1136 origbadfn(f, msg)
1138 origbadfn(f, msg)
1137 m.bad = lfbadfn
1139 m.bad = lfbadfn
1138 for f in ctx.walk(m):
1140 for f in ctx.walk(m):
1139 fp = cmdutil.makefileobj(repo, opts.get('output'), ctx.node(),
1141 fp = cmdutil.makefileobj(repo, opts.get('output'), ctx.node(),
1140 pathname=f)
1142 pathname=f)
1141 lf = lfutil.splitstandin(f)
1143 lf = lfutil.splitstandin(f)
1142 if lf is None or origmatchfn(f):
1144 if lf is None or origmatchfn(f):
1143 # duplicating unreachable code from commands.cat
1145 # duplicating unreachable code from commands.cat
1144 data = ctx[f].data()
1146 data = ctx[f].data()
1145 if opts.get('decode'):
1147 if opts.get('decode'):
1146 data = repo.wwritedata(f, data)
1148 data = repo.wwritedata(f, data)
1147 fp.write(data)
1149 fp.write(data)
1148 else:
1150 else:
1149 hash = lfutil.readstandin(repo, lf, ctx.rev())
1151 hash = lfutil.readstandin(repo, lf, ctx.rev())
1150 if not lfutil.inusercache(repo.ui, hash):
1152 if not lfutil.inusercache(repo.ui, hash):
1151 store = basestore._openstore(repo)
1153 store = basestore._openstore(repo)
1152 success, missing = store.get([(lf, hash)])
1154 success, missing = store.get([(lf, hash)])
1153 if len(success) != 1:
1155 if len(success) != 1:
1154 raise util.Abort(
1156 raise util.Abort(
1155 _('largefile %s is not in cache and could not be '
1157 _('largefile %s is not in cache and could not be '
1156 'downloaded') % lf)
1158 'downloaded') % lf)
1157 path = lfutil.usercachepath(repo.ui, hash)
1159 path = lfutil.usercachepath(repo.ui, hash)
1158 fpin = open(path, "rb")
1160 fpin = open(path, "rb")
1159 for chunk in util.filechunkiter(fpin, 128 * 1024):
1161 for chunk in util.filechunkiter(fpin, 128 * 1024):
1160 fp.write(chunk)
1162 fp.write(chunk)
1161 fpin.close()
1163 fpin.close()
1162 fp.close()
1164 fp.close()
1163 err = 0
1165 err = 0
1164 return err
1166 return err
1165
1167
1166 def mercurialsinkbefore(orig, sink):
1168 def mercurialsinkbefore(orig, sink):
1167 sink.repo._isconverting = True
1169 sink.repo._isconverting = True
1168 orig(sink)
1170 orig(sink)
1169
1171
1170 def mercurialsinkafter(orig, sink):
1172 def mercurialsinkafter(orig, sink):
1171 sink.repo._isconverting = False
1173 sink.repo._isconverting = False
1172 orig(sink)
1174 orig(sink)
@@ -1,2537 +1,2545 b''
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.
20 files.
21 Test status and dirstate of largefiles and that summary output is correct.
21 Test status and dirstate of largefiles and that summary output 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 $ touch large1 sub/large2
38 $ touch large1 sub/large2
39 $ sleep 1
39 $ sleep 1
40 $ hg st
40 $ hg st
41 $ hg debugstate --nodates
41 $ hg debugstate --nodates
42 n 644 41 .hglf/large1
42 n 644 41 .hglf/large1
43 n 644 41 .hglf/sub/large2
43 n 644 41 .hglf/sub/large2
44 n 644 8 normal1
44 n 644 8 normal1
45 n 644 8 sub/normal2
45 n 644 8 sub/normal2
46 $ hg debugstate --large --nodates
46 $ hg debugstate --large --nodates
47 n 644 7 large1
47 n 644 7 large1
48 n 644 7 sub/large2
48 n 644 7 sub/large2
49 $ echo normal11 > normal1
49 $ echo normal11 > normal1
50 $ echo normal22 > sub/normal2
50 $ echo normal22 > sub/normal2
51 $ echo large11 > large1
51 $ echo large11 > large1
52 $ echo large22 > sub/large2
52 $ echo large22 > sub/large2
53 $ hg commit -m "edit files"
53 $ hg commit -m "edit files"
54 Invoking status precommit hook
54 Invoking status precommit hook
55 M large1
55 M large1
56 M normal1
56 M normal1
57 M sub/large2
57 M sub/large2
58 M sub/normal2
58 M sub/normal2
59 $ hg sum --large
59 $ hg sum --large
60 parent: 1:ce8896473775 tip
60 parent: 1:ce8896473775 tip
61 edit files
61 edit files
62 branch: default
62 branch: default
63 commit: (clean)
63 commit: (clean)
64 update: (current)
64 update: (current)
65 largefiles: (no remote repo)
65 largefiles: (no remote repo)
66
66
67 Commit preserved largefile contents.
67 Commit preserved largefile contents.
68
68
69 $ cat normal1
69 $ cat normal1
70 normal11
70 normal11
71 $ cat large1
71 $ cat large1
72 large11
72 large11
73 $ cat sub/normal2
73 $ cat sub/normal2
74 normal22
74 normal22
75 $ cat sub/large2
75 $ cat sub/large2
76 large22
76 large22
77
77
78 Test status, subdir and unknown files
78 Test status, subdir and unknown files
79
79
80 $ echo unknown > sub/unknown
80 $ echo unknown > sub/unknown
81 $ hg st --all
81 $ hg st --all
82 ? sub/unknown
82 ? sub/unknown
83 C large1
83 C large1
84 C normal1
84 C normal1
85 C sub/large2
85 C sub/large2
86 C sub/normal2
86 C sub/normal2
87 $ hg st --all sub
87 $ hg st --all sub
88 ? sub/unknown
88 ? sub/unknown
89 C sub/large2
89 C sub/large2
90 C sub/normal2
90 C sub/normal2
91 $ rm sub/unknown
91 $ rm sub/unknown
92
92
93 Test messages and exit codes for remove warning cases
93 Test messages and exit codes for remove warning cases
94
94
95 $ hg remove -A large1
95 $ hg remove -A large1
96 not removing large1: file still exists
96 not removing large1: file still exists
97 [1]
97 [1]
98 $ echo 'modified' > large1
98 $ echo 'modified' > large1
99 $ hg remove large1
99 $ hg remove large1
100 not removing large1: file is modified (use -f to force removal)
100 not removing large1: file is modified (use -f to force removal)
101 [1]
101 [1]
102 $ echo 'new' > normalnew
102 $ echo 'new' > normalnew
103 $ hg add normalnew
103 $ hg add normalnew
104 $ echo 'new' > largenew
104 $ echo 'new' > largenew
105 $ hg add --large normalnew
105 $ hg add --large normalnew
106 normalnew already tracked!
106 normalnew already tracked!
107 $ hg remove normalnew largenew
107 $ hg remove normalnew largenew
108 not removing largenew: file is untracked
108 not removing largenew: file is untracked
109 not removing normalnew: file has been marked for add (use forget to undo)
109 not removing normalnew: file has been marked for add (use forget to undo)
110 [1]
110 [1]
111 $ rm normalnew largenew
111 $ rm normalnew largenew
112 $ hg up -Cq
112 $ hg up -Cq
113
113
114 Remove both largefiles and normal files.
114 Remove both largefiles and normal files.
115
115
116 $ hg remove normal1 large1
116 $ hg remove normal1 large1
117 $ hg status large1
117 $ hg status large1
118 R large1
118 R large1
119 $ hg commit -m "remove files"
119 $ hg commit -m "remove files"
120 Invoking status precommit hook
120 Invoking status precommit hook
121 R large1
121 R large1
122 R normal1
122 R normal1
123 $ ls
123 $ ls
124 sub
124 sub
125 $ echo "testlargefile" > large1-test
125 $ echo "testlargefile" > large1-test
126 $ hg add --large large1-test
126 $ hg add --large large1-test
127 $ hg st
127 $ hg st
128 A large1-test
128 A large1-test
129 $ hg rm large1-test
129 $ hg rm large1-test
130 not removing large1-test: file has been marked for add (use forget to undo)
130 not removing large1-test: file has been marked for add (use forget to undo)
131 [1]
131 [1]
132 $ hg st
132 $ hg st
133 A large1-test
133 A large1-test
134 $ hg forget large1-test
134 $ hg forget large1-test
135 $ hg st
135 $ hg st
136 ? large1-test
136 ? large1-test
137 $ hg remove large1-test
137 $ hg remove large1-test
138 not removing large1-test: file is untracked
138 not removing large1-test: file is untracked
139 [1]
139 [1]
140 $ hg forget large1-test
140 $ hg forget large1-test
141 not removing large1-test: file is already untracked
141 not removing large1-test: file is already untracked
142 [1]
142 [1]
143 $ rm large1-test
143 $ rm large1-test
144
144
145 Copy both largefiles and normal files (testing that status output is correct).
145 Copy both largefiles and normal files (testing that status output is correct).
146
146
147 $ hg cp sub/normal2 normal1
147 $ hg cp sub/normal2 normal1
148 $ hg cp sub/large2 large1
148 $ hg cp sub/large2 large1
149 $ hg commit -m "copy files"
149 $ hg commit -m "copy files"
150 Invoking status precommit hook
150 Invoking status precommit hook
151 A large1
151 A large1
152 A normal1
152 A normal1
153 $ cat normal1
153 $ cat normal1
154 normal22
154 normal22
155 $ cat large1
155 $ cat large1
156 large22
156 large22
157
157
158 Test moving largefiles and verify that normal files are also unaffected.
158 Test moving largefiles and verify that normal files are also unaffected.
159
159
160 $ hg mv normal1 normal3
160 $ hg mv normal1 normal3
161 $ hg mv large1 large3
161 $ hg mv large1 large3
162 $ hg mv sub/normal2 sub/normal4
162 $ hg mv sub/normal2 sub/normal4
163 $ hg mv sub/large2 sub/large4
163 $ hg mv sub/large2 sub/large4
164 $ hg commit -m "move files"
164 $ hg commit -m "move files"
165 Invoking status precommit hook
165 Invoking status precommit hook
166 A large3
166 A large3
167 A normal3
167 A normal3
168 A sub/large4
168 A sub/large4
169 A sub/normal4
169 A sub/normal4
170 R large1
170 R large1
171 R normal1
171 R normal1
172 R sub/large2
172 R sub/large2
173 R sub/normal2
173 R sub/normal2
174 $ cat normal3
174 $ cat normal3
175 normal22
175 normal22
176 $ cat large3
176 $ cat large3
177 large22
177 large22
178 $ cat sub/normal4
178 $ cat sub/normal4
179 normal22
179 normal22
180 $ cat sub/large4
180 $ cat sub/large4
181 large22
181 large22
182
182
183 Test copies and moves from a directory other than root (issue3516)
183 Test copies and moves from a directory other than root (issue3516)
184
184
185 $ cd ..
185 $ cd ..
186 $ hg init lf_cpmv
186 $ hg init lf_cpmv
187 $ cd lf_cpmv
187 $ cd lf_cpmv
188 $ mkdir dira
188 $ mkdir dira
189 $ mkdir dira/dirb
189 $ mkdir dira/dirb
190 $ touch dira/dirb/largefile
190 $ touch dira/dirb/largefile
191 $ hg add --large dira/dirb/largefile
191 $ hg add --large dira/dirb/largefile
192 $ hg commit -m "added"
192 $ hg commit -m "added"
193 Invoking status precommit hook
193 Invoking status precommit hook
194 A dira/dirb/largefile
194 A dira/dirb/largefile
195 $ cd dira
195 $ cd dira
196 $ hg cp dirb/largefile foo/largefile
196 $ hg cp dirb/largefile foo/largefile
197 $ hg ci -m "deep copy"
197 $ hg ci -m "deep copy"
198 Invoking status precommit hook
198 Invoking status precommit hook
199 A dira/foo/largefile
199 A dira/foo/largefile
200 $ find . | sort
200 $ find . | sort
201 .
201 .
202 ./dirb
202 ./dirb
203 ./dirb/largefile
203 ./dirb/largefile
204 ./foo
204 ./foo
205 ./foo/largefile
205 ./foo/largefile
206 $ hg mv foo/largefile baz/largefile
206 $ hg mv foo/largefile baz/largefile
207 $ hg ci -m "moved"
207 $ hg ci -m "moved"
208 Invoking status precommit hook
208 Invoking status precommit hook
209 A dira/baz/largefile
209 A dira/baz/largefile
210 R dira/foo/largefile
210 R dira/foo/largefile
211 $ find . | sort
211 $ find . | sort
212 .
212 .
213 ./baz
213 ./baz
214 ./baz/largefile
214 ./baz/largefile
215 ./dirb
215 ./dirb
216 ./dirb/largefile
216 ./dirb/largefile
217 $ cd ..
217 $ cd ..
218 $ hg mv dira dirc
218 $ hg mv dira dirc
219 moving .hglf/dira/baz/largefile to .hglf/dirc/baz/largefile (glob)
219 moving .hglf/dira/baz/largefile to .hglf/dirc/baz/largefile (glob)
220 moving .hglf/dira/dirb/largefile to .hglf/dirc/dirb/largefile (glob)
220 moving .hglf/dira/dirb/largefile to .hglf/dirc/dirb/largefile (glob)
221 $ find * | sort
221 $ find * | sort
222 dirc
222 dirc
223 dirc/baz
223 dirc/baz
224 dirc/baz/largefile
224 dirc/baz/largefile
225 dirc/dirb
225 dirc/dirb
226 dirc/dirb/largefile
226 dirc/dirb/largefile
227 $ hg up -qC
227 $ hg up -qC
228 $ cd ../a
228 $ cd ../a
229
229
230 #if serve
230 #if serve
231 Test display of largefiles in hgweb
231 Test display of largefiles in hgweb
232
232
233 $ hg serve -d -p $HGPORT --pid-file ../hg.pid
233 $ hg serve -d -p $HGPORT --pid-file ../hg.pid
234 $ cat ../hg.pid >> $DAEMON_PIDS
234 $ cat ../hg.pid >> $DAEMON_PIDS
235 $ "$TESTDIR/get-with-headers.py" 127.0.0.1:$HGPORT 'file/tip/?style=raw'
235 $ "$TESTDIR/get-with-headers.py" 127.0.0.1:$HGPORT 'file/tip/?style=raw'
236 200 Script output follows
236 200 Script output follows
237
237
238
238
239 drwxr-xr-x sub
239 drwxr-xr-x sub
240 -rw-r--r-- 41 large3
240 -rw-r--r-- 41 large3
241 -rw-r--r-- 9 normal3
241 -rw-r--r-- 9 normal3
242
242
243
243
244 $ "$TESTDIR/get-with-headers.py" 127.0.0.1:$HGPORT 'file/tip/sub/?style=raw'
244 $ "$TESTDIR/get-with-headers.py" 127.0.0.1:$HGPORT 'file/tip/sub/?style=raw'
245 200 Script output follows
245 200 Script output follows
246
246
247
247
248 -rw-r--r-- 41 large4
248 -rw-r--r-- 41 large4
249 -rw-r--r-- 9 normal4
249 -rw-r--r-- 9 normal4
250
250
251
251
252 $ "$TESTDIR/killdaemons.py" $DAEMON_PIDS
252 $ "$TESTDIR/killdaemons.py" $DAEMON_PIDS
253 #endif
253 #endif
254
254
255 Test archiving the various revisions. These hit corner cases known with
255 Test archiving the various revisions. These hit corner cases known with
256 archiving.
256 archiving.
257
257
258 $ hg archive -r 0 ../archive0
258 $ hg archive -r 0 ../archive0
259 $ hg archive -r 1 ../archive1
259 $ hg archive -r 1 ../archive1
260 $ hg archive -r 2 ../archive2
260 $ hg archive -r 2 ../archive2
261 $ hg archive -r 3 ../archive3
261 $ hg archive -r 3 ../archive3
262 $ hg archive -r 4 ../archive4
262 $ hg archive -r 4 ../archive4
263 $ cd ../archive0
263 $ cd ../archive0
264 $ cat normal1
264 $ cat normal1
265 normal1
265 normal1
266 $ cat large1
266 $ cat large1
267 large1
267 large1
268 $ cat sub/normal2
268 $ cat sub/normal2
269 normal2
269 normal2
270 $ cat sub/large2
270 $ cat sub/large2
271 large2
271 large2
272 $ cd ../archive1
272 $ cd ../archive1
273 $ cat normal1
273 $ cat normal1
274 normal11
274 normal11
275 $ cat large1
275 $ cat large1
276 large11
276 large11
277 $ cat sub/normal2
277 $ cat sub/normal2
278 normal22
278 normal22
279 $ cat sub/large2
279 $ cat sub/large2
280 large22
280 large22
281 $ cd ../archive2
281 $ cd ../archive2
282 $ ls
282 $ ls
283 sub
283 sub
284 $ cat sub/normal2
284 $ cat sub/normal2
285 normal22
285 normal22
286 $ cat sub/large2
286 $ cat sub/large2
287 large22
287 large22
288 $ cd ../archive3
288 $ cd ../archive3
289 $ cat normal1
289 $ cat normal1
290 normal22
290 normal22
291 $ cat large1
291 $ cat large1
292 large22
292 large22
293 $ cat sub/normal2
293 $ cat sub/normal2
294 normal22
294 normal22
295 $ cat sub/large2
295 $ cat sub/large2
296 large22
296 large22
297 $ cd ../archive4
297 $ cd ../archive4
298 $ cat normal3
298 $ cat normal3
299 normal22
299 normal22
300 $ cat large3
300 $ cat large3
301 large22
301 large22
302 $ cat sub/normal4
302 $ cat sub/normal4
303 normal22
303 normal22
304 $ cat sub/large4
304 $ cat sub/large4
305 large22
305 large22
306
306
307 Commit corner case: specify files to commit.
307 Commit corner case: specify files to commit.
308
308
309 $ cd ../a
309 $ cd ../a
310 $ echo normal3 > normal3
310 $ echo normal3 > normal3
311 $ echo large3 > large3
311 $ echo large3 > large3
312 $ echo normal4 > sub/normal4
312 $ echo normal4 > sub/normal4
313 $ echo large4 > sub/large4
313 $ echo large4 > sub/large4
314 $ hg commit normal3 large3 sub/normal4 sub/large4 -m "edit files again"
314 $ hg commit normal3 large3 sub/normal4 sub/large4 -m "edit files again"
315 Invoking status precommit hook
315 Invoking status precommit hook
316 M large3
316 M large3
317 M normal3
317 M normal3
318 M sub/large4
318 M sub/large4
319 M sub/normal4
319 M sub/normal4
320 $ cat normal3
320 $ cat normal3
321 normal3
321 normal3
322 $ cat large3
322 $ cat large3
323 large3
323 large3
324 $ cat sub/normal4
324 $ cat sub/normal4
325 normal4
325 normal4
326 $ cat sub/large4
326 $ cat sub/large4
327 large4
327 large4
328
328
329 One more commit corner case: commit from a subdirectory.
329 One more commit corner case: commit from a subdirectory.
330
330
331 $ cd ../a
331 $ cd ../a
332 $ echo normal33 > normal3
332 $ echo normal33 > normal3
333 $ echo large33 > large3
333 $ echo large33 > large3
334 $ echo normal44 > sub/normal4
334 $ echo normal44 > sub/normal4
335 $ echo large44 > sub/large4
335 $ echo large44 > sub/large4
336 $ cd sub
336 $ cd sub
337 $ hg commit -m "edit files yet again"
337 $ hg commit -m "edit files yet again"
338 Invoking status precommit hook
338 Invoking status precommit hook
339 M large3
339 M large3
340 M normal3
340 M normal3
341 M sub/large4
341 M sub/large4
342 M sub/normal4
342 M sub/normal4
343 $ cat ../normal3
343 $ cat ../normal3
344 normal33
344 normal33
345 $ cat ../large3
345 $ cat ../large3
346 large33
346 large33
347 $ cat normal4
347 $ cat normal4
348 normal44
348 normal44
349 $ cat large4
349 $ cat large4
350 large44
350 large44
351
351
352 Committing standins is not allowed.
352 Committing standins is not allowed.
353
353
354 $ cd ..
354 $ cd ..
355 $ echo large3 > large3
355 $ echo large3 > large3
356 $ hg commit .hglf/large3 -m "try to commit standin"
356 $ hg commit .hglf/large3 -m "try to commit standin"
357 abort: file ".hglf/large3" is a largefile standin
357 abort: file ".hglf/large3" is a largefile standin
358 (commit the largefile itself instead)
358 (commit the largefile itself instead)
359 [255]
359 [255]
360
360
361 Corner cases for adding largefiles.
361 Corner cases for adding largefiles.
362
362
363 $ echo large5 > large5
363 $ echo large5 > large5
364 $ hg add --large large5
364 $ hg add --large large5
365 $ hg add --large large5
365 $ hg add --large large5
366 large5 already a largefile
366 large5 already a largefile
367 $ mkdir sub2
367 $ mkdir sub2
368 $ echo large6 > sub2/large6
368 $ echo large6 > sub2/large6
369 $ echo large7 > sub2/large7
369 $ echo large7 > sub2/large7
370 $ hg add --large sub2
370 $ hg add --large sub2
371 adding sub2/large6 as a largefile (glob)
371 adding sub2/large6 as a largefile (glob)
372 adding sub2/large7 as a largefile (glob)
372 adding sub2/large7 as a largefile (glob)
373 $ hg st
373 $ hg st
374 M large3
374 M large3
375 A large5
375 A large5
376 A sub2/large6
376 A sub2/large6
377 A sub2/large7
377 A sub2/large7
378
378
379 Committing directories containing only largefiles.
379 Committing directories containing only largefiles.
380
380
381 $ mkdir -p z/y/x/m
381 $ mkdir -p z/y/x/m
382 $ touch z/y/x/m/large1
382 $ touch z/y/x/m/large1
383 $ touch z/y/x/large2
383 $ touch z/y/x/large2
384 $ hg add --large z/y/x/m/large1 z/y/x/large2
384 $ hg add --large z/y/x/m/large1 z/y/x/large2
385 $ hg commit -m "Subdir with directory only containing largefiles" z
385 $ hg commit -m "Subdir with directory only containing largefiles" z
386 Invoking status precommit hook
386 Invoking status precommit hook
387 M large3
387 M large3
388 A large5
388 A large5
389 A sub2/large6
389 A sub2/large6
390 A sub2/large7
390 A sub2/large7
391 A z/y/x/large2
391 A z/y/x/large2
392 A z/y/x/m/large1
392 A z/y/x/m/large1
393
394 (and a bit of log testing)
395
396 $ hg log -T '{rev}\n' z/y/x/m/large1
397 7
398 $ hg log -T '{rev}\n' z/y/x/m # with only a largefile
399 7
400
393 $ hg rollback --quiet
401 $ hg rollback --quiet
394 $ touch z/y/x/m/normal
402 $ touch z/y/x/m/normal
395 $ hg add z/y/x/m/normal
403 $ hg add z/y/x/m/normal
396 $ hg commit -m "Subdir with mixed contents" z
404 $ hg commit -m "Subdir with mixed contents" z
397 Invoking status precommit hook
405 Invoking status precommit hook
398 M large3
406 M large3
399 A large5
407 A large5
400 A sub2/large6
408 A sub2/large6
401 A sub2/large7
409 A sub2/large7
402 A z/y/x/large2
410 A z/y/x/large2
403 A z/y/x/m/large1
411 A z/y/x/m/large1
404 A z/y/x/m/normal
412 A z/y/x/m/normal
405 $ hg st
413 $ hg st
406 M large3
414 M large3
407 A large5
415 A large5
408 A sub2/large6
416 A sub2/large6
409 A sub2/large7
417 A sub2/large7
410 $ hg rollback --quiet
418 $ hg rollback --quiet
411 $ hg revert z/y/x/large2 z/y/x/m/large1
419 $ hg revert z/y/x/large2 z/y/x/m/large1
412 $ rm z/y/x/large2 z/y/x/m/large1
420 $ rm z/y/x/large2 z/y/x/m/large1
413 $ hg commit -m "Subdir with normal contents" z
421 $ hg commit -m "Subdir with normal contents" z
414 Invoking status precommit hook
422 Invoking status precommit hook
415 M large3
423 M large3
416 A large5
424 A large5
417 A sub2/large6
425 A sub2/large6
418 A sub2/large7
426 A sub2/large7
419 A z/y/x/m/normal
427 A z/y/x/m/normal
420 $ hg st
428 $ hg st
421 M large3
429 M large3
422 A large5
430 A large5
423 A sub2/large6
431 A sub2/large6
424 A sub2/large7
432 A sub2/large7
425 $ hg rollback --quiet
433 $ hg rollback --quiet
426 $ hg revert --quiet z
434 $ hg revert --quiet z
427 $ hg commit -m "Empty subdir" z
435 $ hg commit -m "Empty subdir" z
428 abort: z: no match under directory!
436 abort: z: no match under directory!
429 [255]
437 [255]
430 $ rm -rf z
438 $ rm -rf z
431 $ hg ci -m "standin" .hglf
439 $ hg ci -m "standin" .hglf
432 abort: file ".hglf" is a largefile standin
440 abort: file ".hglf" is a largefile standin
433 (commit the largefile itself instead)
441 (commit the largefile itself instead)
434 [255]
442 [255]
435
443
436 Test "hg status" with combination of 'file pattern' and 'directory
444 Test "hg status" with combination of 'file pattern' and 'directory
437 pattern' for largefiles:
445 pattern' for largefiles:
438
446
439 $ hg status sub2/large6 sub2
447 $ hg status sub2/large6 sub2
440 A sub2/large6
448 A sub2/large6
441 A sub2/large7
449 A sub2/large7
442
450
443 Config settings (pattern **.dat, minsize 2 MB) are respected.
451 Config settings (pattern **.dat, minsize 2 MB) are respected.
444
452
445 $ echo testdata > test.dat
453 $ echo testdata > test.dat
446 $ dd bs=1k count=2k if=/dev/zero of=reallylarge > /dev/null 2> /dev/null
454 $ dd bs=1k count=2k if=/dev/zero of=reallylarge > /dev/null 2> /dev/null
447 $ hg add
455 $ hg add
448 adding reallylarge as a largefile
456 adding reallylarge as a largefile
449 adding test.dat as a largefile
457 adding test.dat as a largefile
450
458
451 Test that minsize and --lfsize handle float values;
459 Test that minsize and --lfsize handle float values;
452 also tests that --lfsize overrides largefiles.minsize.
460 also tests that --lfsize overrides largefiles.minsize.
453 (0.250 MB = 256 kB = 262144 B)
461 (0.250 MB = 256 kB = 262144 B)
454
462
455 $ dd if=/dev/zero of=ratherlarge bs=1024 count=256 > /dev/null 2> /dev/null
463 $ dd if=/dev/zero of=ratherlarge bs=1024 count=256 > /dev/null 2> /dev/null
456 $ dd if=/dev/zero of=medium bs=1024 count=128 > /dev/null 2> /dev/null
464 $ dd if=/dev/zero of=medium bs=1024 count=128 > /dev/null 2> /dev/null
457 $ hg --config largefiles.minsize=.25 add
465 $ hg --config largefiles.minsize=.25 add
458 adding ratherlarge as a largefile
466 adding ratherlarge as a largefile
459 adding medium
467 adding medium
460 $ hg forget medium
468 $ hg forget medium
461 $ hg --config largefiles.minsize=.25 add --lfsize=.125
469 $ hg --config largefiles.minsize=.25 add --lfsize=.125
462 adding medium as a largefile
470 adding medium as a largefile
463 $ dd if=/dev/zero of=notlarge bs=1024 count=127 > /dev/null 2> /dev/null
471 $ dd if=/dev/zero of=notlarge bs=1024 count=127 > /dev/null 2> /dev/null
464 $ hg --config largefiles.minsize=.25 add --lfsize=.125
472 $ hg --config largefiles.minsize=.25 add --lfsize=.125
465 adding notlarge
473 adding notlarge
466 $ hg forget notlarge
474 $ hg forget notlarge
467
475
468 Test forget on largefiles.
476 Test forget on largefiles.
469
477
470 $ hg forget large3 large5 test.dat reallylarge ratherlarge medium
478 $ hg forget large3 large5 test.dat reallylarge ratherlarge medium
471 $ hg commit -m "add/edit more largefiles"
479 $ hg commit -m "add/edit more largefiles"
472 Invoking status precommit hook
480 Invoking status precommit hook
473 A sub2/large6
481 A sub2/large6
474 A sub2/large7
482 A sub2/large7
475 R large3
483 R large3
476 ? large5
484 ? large5
477 ? medium
485 ? medium
478 ? notlarge
486 ? notlarge
479 ? ratherlarge
487 ? ratherlarge
480 ? reallylarge
488 ? reallylarge
481 ? test.dat
489 ? test.dat
482 $ hg st
490 $ hg st
483 ? large3
491 ? large3
484 ? large5
492 ? large5
485 ? medium
493 ? medium
486 ? notlarge
494 ? notlarge
487 ? ratherlarge
495 ? ratherlarge
488 ? reallylarge
496 ? reallylarge
489 ? test.dat
497 ? test.dat
490
498
491 Purge with largefiles: verify that largefiles are still in the working
499 Purge with largefiles: verify that largefiles are still in the working
492 dir after a purge.
500 dir after a purge.
493
501
494 $ hg purge --all
502 $ hg purge --all
495 $ cat sub/large4
503 $ cat sub/large4
496 large44
504 large44
497 $ cat sub2/large6
505 $ cat sub2/large6
498 large6
506 large6
499 $ cat sub2/large7
507 $ cat sub2/large7
500 large7
508 large7
501
509
502 Test addremove: verify that files that should be added as largefiles are added as
510 Test addremove: verify that files that should be added as largefiles are added as
503 such and that already-existing largefiles are not added as normal files by
511 such and that already-existing largefiles are not added as normal files by
504 accident.
512 accident.
505
513
506 $ rm normal3
514 $ rm normal3
507 $ rm sub/large4
515 $ rm sub/large4
508 $ echo "testing addremove with patterns" > testaddremove.dat
516 $ echo "testing addremove with patterns" > testaddremove.dat
509 $ echo "normaladdremove" > normaladdremove
517 $ echo "normaladdremove" > normaladdremove
510 $ hg addremove
518 $ hg addremove
511 removing sub/large4
519 removing sub/large4
512 adding testaddremove.dat as a largefile
520 adding testaddremove.dat as a largefile
513 removing normal3
521 removing normal3
514 adding normaladdremove
522 adding normaladdremove
515
523
516 Test addremove with -R
524 Test addremove with -R
517
525
518 $ hg up -C
526 $ hg up -C
519 getting changed largefiles
527 getting changed largefiles
520 1 largefiles updated, 0 removed
528 1 largefiles updated, 0 removed
521 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
529 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
522 $ rm normal3
530 $ rm normal3
523 $ rm sub/large4
531 $ rm sub/large4
524 $ echo "testing addremove with patterns" > testaddremove.dat
532 $ echo "testing addremove with patterns" > testaddremove.dat
525 $ echo "normaladdremove" > normaladdremove
533 $ echo "normaladdremove" > normaladdremove
526 $ cd ..
534 $ cd ..
527 $ hg -R a addremove
535 $ hg -R a addremove
528 removing sub/large4
536 removing sub/large4
529 adding a/testaddremove.dat as a largefile (glob)
537 adding a/testaddremove.dat as a largefile (glob)
530 removing normal3
538 removing normal3
531 adding normaladdremove
539 adding normaladdremove
532 $ cd a
540 $ cd a
533
541
534 Test 3364
542 Test 3364
535 $ hg clone . ../addrm
543 $ hg clone . ../addrm
536 updating to branch default
544 updating to branch default
537 getting changed largefiles
545 getting changed largefiles
538 3 largefiles updated, 0 removed
546 3 largefiles updated, 0 removed
539 5 files updated, 0 files merged, 0 files removed, 0 files unresolved
547 5 files updated, 0 files merged, 0 files removed, 0 files unresolved
540 $ cd ../addrm
548 $ cd ../addrm
541 $ cat >> .hg/hgrc <<EOF
549 $ cat >> .hg/hgrc <<EOF
542 > [hooks]
550 > [hooks]
543 > post-commit.stat=sh -c "echo \\"Invoking status postcommit hook\\"; hg status -A"
551 > post-commit.stat=sh -c "echo \\"Invoking status postcommit hook\\"; hg status -A"
544 > EOF
552 > EOF
545 $ touch foo
553 $ touch foo
546 $ hg add --large foo
554 $ hg add --large foo
547 $ hg ci -m "add foo"
555 $ hg ci -m "add foo"
548 Invoking status precommit hook
556 Invoking status precommit hook
549 A foo
557 A foo
550 Invoking status postcommit hook
558 Invoking status postcommit hook
551 C foo
559 C foo
552 C normal3
560 C normal3
553 C sub/large4
561 C sub/large4
554 C sub/normal4
562 C sub/normal4
555 C sub2/large6
563 C sub2/large6
556 C sub2/large7
564 C sub2/large7
557 $ rm foo
565 $ rm foo
558 $ hg st
566 $ hg st
559 ! foo
567 ! foo
560 hmm.. no precommit invoked, but there is a postcommit??
568 hmm.. no precommit invoked, but there is a postcommit??
561 $ hg ci -m "will not checkin"
569 $ hg ci -m "will not checkin"
562 nothing changed
570 nothing changed
563 Invoking status postcommit hook
571 Invoking status postcommit hook
564 ! foo
572 ! foo
565 C normal3
573 C normal3
566 C sub/large4
574 C sub/large4
567 C sub/normal4
575 C sub/normal4
568 C sub2/large6
576 C sub2/large6
569 C sub2/large7
577 C sub2/large7
570 [1]
578 [1]
571 $ hg addremove
579 $ hg addremove
572 removing foo
580 removing foo
573 $ hg st
581 $ hg st
574 R foo
582 R foo
575 $ hg ci -m "used to say nothing changed"
583 $ hg ci -m "used to say nothing changed"
576 Invoking status precommit hook
584 Invoking status precommit hook
577 R foo
585 R foo
578 Invoking status postcommit hook
586 Invoking status postcommit hook
579 C normal3
587 C normal3
580 C sub/large4
588 C sub/large4
581 C sub/normal4
589 C sub/normal4
582 C sub2/large6
590 C sub2/large6
583 C sub2/large7
591 C sub2/large7
584 $ hg st
592 $ hg st
585
593
586 Test 3507 (both normal files and largefiles were a problem)
594 Test 3507 (both normal files and largefiles were a problem)
587
595
588 $ touch normal
596 $ touch normal
589 $ touch large
597 $ touch large
590 $ hg add normal
598 $ hg add normal
591 $ hg add --large large
599 $ hg add --large large
592 $ hg ci -m "added"
600 $ hg ci -m "added"
593 Invoking status precommit hook
601 Invoking status precommit hook
594 A large
602 A large
595 A normal
603 A normal
596 Invoking status postcommit hook
604 Invoking status postcommit hook
597 C large
605 C large
598 C normal
606 C normal
599 C normal3
607 C normal3
600 C sub/large4
608 C sub/large4
601 C sub/normal4
609 C sub/normal4
602 C sub2/large6
610 C sub2/large6
603 C sub2/large7
611 C sub2/large7
604 $ hg remove normal
612 $ hg remove normal
605 $ hg addremove --traceback
613 $ hg addremove --traceback
606 $ hg ci -m "addremoved normal"
614 $ hg ci -m "addremoved normal"
607 Invoking status precommit hook
615 Invoking status precommit hook
608 R normal
616 R normal
609 Invoking status postcommit hook
617 Invoking status postcommit hook
610 C large
618 C large
611 C normal3
619 C normal3
612 C sub/large4
620 C sub/large4
613 C sub/normal4
621 C sub/normal4
614 C sub2/large6
622 C sub2/large6
615 C sub2/large7
623 C sub2/large7
616 $ hg up -C '.^'
624 $ hg up -C '.^'
617 getting changed largefiles
625 getting changed largefiles
618 0 largefiles updated, 0 removed
626 0 largefiles updated, 0 removed
619 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
627 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
620 $ hg remove large
628 $ hg remove large
621 $ hg addremove --traceback
629 $ hg addremove --traceback
622 $ hg ci -m "removed large"
630 $ hg ci -m "removed large"
623 Invoking status precommit hook
631 Invoking status precommit hook
624 R large
632 R large
625 created new head
633 created new head
626 Invoking status postcommit hook
634 Invoking status postcommit hook
627 C normal
635 C normal
628 C normal3
636 C normal3
629 C sub/large4
637 C sub/large4
630 C sub/normal4
638 C sub/normal4
631 C sub2/large6
639 C sub2/large6
632 C sub2/large7
640 C sub2/large7
633
641
634 Test commit -A (issue 3542)
642 Test commit -A (issue 3542)
635 $ echo large8 > large8
643 $ echo large8 > large8
636 $ hg add --large large8
644 $ hg add --large large8
637 $ hg ci -Am 'this used to add large8 as normal and commit both'
645 $ hg ci -Am 'this used to add large8 as normal and commit both'
638 Invoking status precommit hook
646 Invoking status precommit hook
639 A large8
647 A large8
640 Invoking status postcommit hook
648 Invoking status postcommit hook
641 C large8
649 C large8
642 C normal
650 C normal
643 C normal3
651 C normal3
644 C sub/large4
652 C sub/large4
645 C sub/normal4
653 C sub/normal4
646 C sub2/large6
654 C sub2/large6
647 C sub2/large7
655 C sub2/large7
648 $ rm large8
656 $ rm large8
649 $ hg ci -Am 'this used to not notice the rm'
657 $ hg ci -Am 'this used to not notice the rm'
650 removing large8
658 removing large8
651 Invoking status precommit hook
659 Invoking status precommit hook
652 R large8
660 R large8
653 Invoking status postcommit hook
661 Invoking status postcommit hook
654 C normal
662 C normal
655 C normal3
663 C normal3
656 C sub/large4
664 C sub/large4
657 C sub/normal4
665 C sub/normal4
658 C sub2/large6
666 C sub2/large6
659 C sub2/large7
667 C sub2/large7
660
668
661 Test that a standin can't be added as a large file
669 Test that a standin can't be added as a large file
662
670
663 $ touch large
671 $ touch large
664 $ hg add --large large
672 $ hg add --large large
665 $ hg ci -m "add"
673 $ hg ci -m "add"
666 Invoking status precommit hook
674 Invoking status precommit hook
667 A large
675 A large
668 Invoking status postcommit hook
676 Invoking status postcommit hook
669 C large
677 C large
670 C normal
678 C normal
671 C normal3
679 C normal3
672 C sub/large4
680 C sub/large4
673 C sub/normal4
681 C sub/normal4
674 C sub2/large6
682 C sub2/large6
675 C sub2/large7
683 C sub2/large7
676 $ hg remove large
684 $ hg remove large
677 $ touch large
685 $ touch large
678 $ hg addremove --config largefiles.patterns=**large --traceback
686 $ hg addremove --config largefiles.patterns=**large --traceback
679 adding large as a largefile
687 adding large as a largefile
680
688
681 Test that outgoing --large works (with revsets too)
689 Test that outgoing --large works (with revsets too)
682 $ hg outgoing --rev '.^' --large
690 $ hg outgoing --rev '.^' --large
683 comparing with $TESTTMP/a (glob)
691 comparing with $TESTTMP/a (glob)
684 searching for changes
692 searching for changes
685 changeset: 8:c02fd3b77ec4
693 changeset: 8:c02fd3b77ec4
686 user: test
694 user: test
687 date: Thu Jan 01 00:00:00 1970 +0000
695 date: Thu Jan 01 00:00:00 1970 +0000
688 summary: add foo
696 summary: add foo
689
697
690 changeset: 9:289dd08c9bbb
698 changeset: 9:289dd08c9bbb
691 user: test
699 user: test
692 date: Thu Jan 01 00:00:00 1970 +0000
700 date: Thu Jan 01 00:00:00 1970 +0000
693 summary: used to say nothing changed
701 summary: used to say nothing changed
694
702
695 changeset: 10:34f23ac6ac12
703 changeset: 10:34f23ac6ac12
696 user: test
704 user: test
697 date: Thu Jan 01 00:00:00 1970 +0000
705 date: Thu Jan 01 00:00:00 1970 +0000
698 summary: added
706 summary: added
699
707
700 changeset: 12:710c1b2f523c
708 changeset: 12:710c1b2f523c
701 parent: 10:34f23ac6ac12
709 parent: 10:34f23ac6ac12
702 user: test
710 user: test
703 date: Thu Jan 01 00:00:00 1970 +0000
711 date: Thu Jan 01 00:00:00 1970 +0000
704 summary: removed large
712 summary: removed large
705
713
706 changeset: 13:0a3e75774479
714 changeset: 13:0a3e75774479
707 user: test
715 user: test
708 date: Thu Jan 01 00:00:00 1970 +0000
716 date: Thu Jan 01 00:00:00 1970 +0000
709 summary: this used to add large8 as normal and commit both
717 summary: this used to add large8 as normal and commit both
710
718
711 changeset: 14:84f3d378175c
719 changeset: 14:84f3d378175c
712 user: test
720 user: test
713 date: Thu Jan 01 00:00:00 1970 +0000
721 date: Thu Jan 01 00:00:00 1970 +0000
714 summary: this used to not notice the rm
722 summary: this used to not notice the rm
715
723
716 largefiles to upload:
724 largefiles to upload:
717 foo
725 foo
718 large
726 large
719 large8
727 large8
720
728
721 $ cd ../a
729 $ cd ../a
722
730
723 Clone a largefiles repo.
731 Clone a largefiles repo.
724
732
725 $ hg clone . ../b
733 $ hg clone . ../b
726 updating to branch default
734 updating to branch default
727 getting changed largefiles
735 getting changed largefiles
728 3 largefiles updated, 0 removed
736 3 largefiles updated, 0 removed
729 5 files updated, 0 files merged, 0 files removed, 0 files unresolved
737 5 files updated, 0 files merged, 0 files removed, 0 files unresolved
730 $ cd ../b
738 $ cd ../b
731 $ hg log --template '{rev}:{node|short} {desc|firstline}\n'
739 $ hg log --template '{rev}:{node|short} {desc|firstline}\n'
732 7:daea875e9014 add/edit more largefiles
740 7:daea875e9014 add/edit more largefiles
733 6:4355d653f84f edit files yet again
741 6:4355d653f84f edit files yet again
734 5:9d5af5072dbd edit files again
742 5:9d5af5072dbd edit files again
735 4:74c02385b94c move files
743 4:74c02385b94c move files
736 3:9e8fbc4bce62 copy files
744 3:9e8fbc4bce62 copy files
737 2:51a0ae4d5864 remove files
745 2:51a0ae4d5864 remove files
738 1:ce8896473775 edit files
746 1:ce8896473775 edit files
739 0:30d30fe6a5be add files
747 0:30d30fe6a5be add files
740 $ cat normal3
748 $ cat normal3
741 normal33
749 normal33
742
750
743 Test graph log
751 Test graph log
744
752
745 $ hg log -G --template '{rev}:{node|short} {desc|firstline}\n'
753 $ hg log -G --template '{rev}:{node|short} {desc|firstline}\n'
746 @ 7:daea875e9014 add/edit more largefiles
754 @ 7:daea875e9014 add/edit more largefiles
747 |
755 |
748 o 6:4355d653f84f edit files yet again
756 o 6:4355d653f84f edit files yet again
749 |
757 |
750 o 5:9d5af5072dbd edit files again
758 o 5:9d5af5072dbd edit files again
751 |
759 |
752 o 4:74c02385b94c move files
760 o 4:74c02385b94c move files
753 |
761 |
754 o 3:9e8fbc4bce62 copy files
762 o 3:9e8fbc4bce62 copy files
755 |
763 |
756 o 2:51a0ae4d5864 remove files
764 o 2:51a0ae4d5864 remove files
757 |
765 |
758 o 1:ce8896473775 edit files
766 o 1:ce8896473775 edit files
759 |
767 |
760 o 0:30d30fe6a5be add files
768 o 0:30d30fe6a5be add files
761
769
762 $ cat sub/normal4
770 $ cat sub/normal4
763 normal44
771 normal44
764 $ cat sub/large4
772 $ cat sub/large4
765 large44
773 large44
766 $ cat sub2/large6
774 $ cat sub2/large6
767 large6
775 large6
768 $ cat sub2/large7
776 $ cat sub2/large7
769 large7
777 large7
770 $ hg log -qf sub2/large7
778 $ hg log -qf sub2/large7
771 7:daea875e9014
779 7:daea875e9014
772 $ hg log -Gqf sub2/large7
780 $ hg log -Gqf sub2/large7
773 @ 7:daea875e9014
781 @ 7:daea875e9014
774 |
782 |
775 $ cd ..
783 $ cd ..
776
784
777 Test log from outside repo
785 Test log from outside repo
778
786
779 $ hg log b/sub -T '{rev}:{node|short} {desc|firstline}\n'
787 $ hg log b/sub -T '{rev}:{node|short} {desc|firstline}\n'
780 6:4355d653f84f edit files yet again
788 6:4355d653f84f edit files yet again
781 5:9d5af5072dbd edit files again
789 5:9d5af5072dbd edit files again
782 4:74c02385b94c move files
790 4:74c02385b94c move files
783 1:ce8896473775 edit files
791 1:ce8896473775 edit files
784 0:30d30fe6a5be add files
792 0:30d30fe6a5be add files
785
793
786 Test clone at revision
794 Test clone at revision
787
795
788 $ hg clone a -r 3 c
796 $ hg clone a -r 3 c
789 adding changesets
797 adding changesets
790 adding manifests
798 adding manifests
791 adding file changes
799 adding file changes
792 added 4 changesets with 10 changes to 4 files
800 added 4 changesets with 10 changes to 4 files
793 updating to branch default
801 updating to branch default
794 getting changed largefiles
802 getting changed largefiles
795 2 largefiles updated, 0 removed
803 2 largefiles updated, 0 removed
796 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
804 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
797 $ cd c
805 $ cd c
798 $ hg log --template '{rev}:{node|short} {desc|firstline}\n'
806 $ hg log --template '{rev}:{node|short} {desc|firstline}\n'
799 3:9e8fbc4bce62 copy files
807 3:9e8fbc4bce62 copy files
800 2:51a0ae4d5864 remove files
808 2:51a0ae4d5864 remove files
801 1:ce8896473775 edit files
809 1:ce8896473775 edit files
802 0:30d30fe6a5be add files
810 0:30d30fe6a5be add files
803 $ cat normal1
811 $ cat normal1
804 normal22
812 normal22
805 $ cat large1
813 $ cat large1
806 large22
814 large22
807 $ cat sub/normal2
815 $ cat sub/normal2
808 normal22
816 normal22
809 $ cat sub/large2
817 $ cat sub/large2
810 large22
818 large22
811
819
812 Old revisions of a clone have correct largefiles content (this also
820 Old revisions of a clone have correct largefiles content (this also
813 tests update).
821 tests update).
814
822
815 $ hg update -r 1
823 $ hg update -r 1
816 getting changed largefiles
824 getting changed largefiles
817 1 largefiles updated, 0 removed
825 1 largefiles updated, 0 removed
818 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
826 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
819 $ cat large1
827 $ cat large1
820 large11
828 large11
821 $ cat sub/large2
829 $ cat sub/large2
822 large22
830 large22
823 $ cd ..
831 $ cd ..
824
832
825 Test cloning with --all-largefiles flag
833 Test cloning with --all-largefiles flag
826
834
827 $ rm "${USERCACHE}"/*
835 $ rm "${USERCACHE}"/*
828 $ hg clone --all-largefiles a a-backup
836 $ hg clone --all-largefiles a a-backup
829 updating to branch default
837 updating to branch default
830 getting changed largefiles
838 getting changed largefiles
831 3 largefiles updated, 0 removed
839 3 largefiles updated, 0 removed
832 5 files updated, 0 files merged, 0 files removed, 0 files unresolved
840 5 files updated, 0 files merged, 0 files removed, 0 files unresolved
833 8 additional largefiles cached
841 8 additional largefiles cached
834
842
835 $ rm "${USERCACHE}"/*
843 $ rm "${USERCACHE}"/*
836 $ hg clone --all-largefiles -u 0 a a-clone0
844 $ hg clone --all-largefiles -u 0 a a-clone0
837 updating to branch default
845 updating to branch default
838 getting changed largefiles
846 getting changed largefiles
839 2 largefiles updated, 0 removed
847 2 largefiles updated, 0 removed
840 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
848 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
841 9 additional largefiles cached
849 9 additional largefiles cached
842 $ hg -R a-clone0 sum
850 $ hg -R a-clone0 sum
843 parent: 0:30d30fe6a5be
851 parent: 0:30d30fe6a5be
844 add files
852 add files
845 branch: default
853 branch: default
846 commit: (clean)
854 commit: (clean)
847 update: 7 new changesets (update)
855 update: 7 new changesets (update)
848
856
849 $ rm "${USERCACHE}"/*
857 $ rm "${USERCACHE}"/*
850 $ hg clone --all-largefiles -u 1 a a-clone1
858 $ hg clone --all-largefiles -u 1 a a-clone1
851 updating to branch default
859 updating to branch default
852 getting changed largefiles
860 getting changed largefiles
853 2 largefiles updated, 0 removed
861 2 largefiles updated, 0 removed
854 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
862 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
855 8 additional largefiles cached
863 8 additional largefiles cached
856 $ hg -R a-clone1 verify --large --lfa --lfc
864 $ hg -R a-clone1 verify --large --lfa --lfc
857 checking changesets
865 checking changesets
858 checking manifests
866 checking manifests
859 crosschecking files in changesets and manifests
867 crosschecking files in changesets and manifests
860 checking files
868 checking files
861 10 files, 8 changesets, 24 total revisions
869 10 files, 8 changesets, 24 total revisions
862 searching 8 changesets for largefiles
870 searching 8 changesets for largefiles
863 verified contents of 13 revisions of 6 largefiles
871 verified contents of 13 revisions of 6 largefiles
864 $ hg -R a-clone1 sum
872 $ hg -R a-clone1 sum
865 parent: 1:ce8896473775
873 parent: 1:ce8896473775
866 edit files
874 edit files
867 branch: default
875 branch: default
868 commit: (clean)
876 commit: (clean)
869 update: 6 new changesets (update)
877 update: 6 new changesets (update)
870
878
871 $ rm "${USERCACHE}"/*
879 $ rm "${USERCACHE}"/*
872 $ hg clone --all-largefiles -U a a-clone-u
880 $ hg clone --all-largefiles -U a a-clone-u
873 11 additional largefiles cached
881 11 additional largefiles cached
874 $ hg -R a-clone-u sum
882 $ hg -R a-clone-u sum
875 parent: -1:000000000000 (no revision checked out)
883 parent: -1:000000000000 (no revision checked out)
876 branch: default
884 branch: default
877 commit: (clean)
885 commit: (clean)
878 update: 8 new changesets (update)
886 update: 8 new changesets (update)
879
887
880 Show computed destination directory:
888 Show computed destination directory:
881
889
882 $ mkdir xyz
890 $ mkdir xyz
883 $ cd xyz
891 $ cd xyz
884 $ hg clone ../a
892 $ hg clone ../a
885 destination directory: a
893 destination directory: a
886 updating to branch default
894 updating to branch default
887 getting changed largefiles
895 getting changed largefiles
888 3 largefiles updated, 0 removed
896 3 largefiles updated, 0 removed
889 5 files updated, 0 files merged, 0 files removed, 0 files unresolved
897 5 files updated, 0 files merged, 0 files removed, 0 files unresolved
890 $ cd ..
898 $ cd ..
891
899
892 Clone URL without path:
900 Clone URL without path:
893
901
894 $ hg clone file://
902 $ hg clone file://
895 abort: repository / not found!
903 abort: repository / not found!
896 [255]
904 [255]
897
905
898 Ensure base clone command argument validation
906 Ensure base clone command argument validation
899
907
900 $ hg clone -U -u 0 a a-clone-failure
908 $ hg clone -U -u 0 a a-clone-failure
901 abort: cannot specify both --noupdate and --updaterev
909 abort: cannot specify both --noupdate and --updaterev
902 [255]
910 [255]
903
911
904 $ hg clone --all-largefiles a ssh://localhost/a
912 $ hg clone --all-largefiles a ssh://localhost/a
905 abort: --all-largefiles is incompatible with non-local destination ssh://localhost/a
913 abort: --all-largefiles is incompatible with non-local destination ssh://localhost/a
906 [255]
914 [255]
907
915
908 Test pulling with --all-largefiles flag. Also test that the largefiles are
916 Test pulling with --all-largefiles flag. Also test that the largefiles are
909 downloaded from 'default' instead of 'default-push' when no source is specified
917 downloaded from 'default' instead of 'default-push' when no source is specified
910 (issue3584)
918 (issue3584)
911
919
912 $ rm -Rf a-backup
920 $ rm -Rf a-backup
913 $ hg clone -r 1 a a-backup
921 $ hg clone -r 1 a a-backup
914 adding changesets
922 adding changesets
915 adding manifests
923 adding manifests
916 adding file changes
924 adding file changes
917 added 2 changesets with 8 changes to 4 files
925 added 2 changesets with 8 changes to 4 files
918 updating to branch default
926 updating to branch default
919 getting changed largefiles
927 getting changed largefiles
920 2 largefiles updated, 0 removed
928 2 largefiles updated, 0 removed
921 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
929 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
922 $ rm "${USERCACHE}"/*
930 $ rm "${USERCACHE}"/*
923 $ cd a-backup
931 $ cd a-backup
924 $ hg pull --all-largefiles --config paths.default-push=bogus/path
932 $ hg pull --all-largefiles --config paths.default-push=bogus/path
925 pulling from $TESTTMP/a (glob)
933 pulling from $TESTTMP/a (glob)
926 searching for changes
934 searching for changes
927 adding changesets
935 adding changesets
928 adding manifests
936 adding manifests
929 adding file changes
937 adding file changes
930 added 6 changesets with 16 changes to 8 files
938 added 6 changesets with 16 changes to 8 files
931 (run 'hg update' to get a working copy)
939 (run 'hg update' to get a working copy)
932 6 largefiles cached
940 6 largefiles cached
933
941
934 redo pull with --lfrev and check it pulls largefiles for the right revs
942 redo pull with --lfrev and check it pulls largefiles for the right revs
935
943
936 $ hg rollback
944 $ hg rollback
937 repository tip rolled back to revision 1 (undo pull)
945 repository tip rolled back to revision 1 (undo pull)
938 $ hg pull -v --lfrev 'heads(pulled())+min(pulled())'
946 $ hg pull -v --lfrev 'heads(pulled())+min(pulled())'
939 pulling from $TESTTMP/a (glob)
947 pulling from $TESTTMP/a (glob)
940 searching for changes
948 searching for changes
941 all local heads known remotely
949 all local heads known remotely
942 6 changesets found
950 6 changesets found
943 adding changesets
951 adding changesets
944 adding manifests
952 adding manifests
945 adding file changes
953 adding file changes
946 added 6 changesets with 16 changes to 8 files
954 added 6 changesets with 16 changes to 8 files
947 calling hook changegroup.lfiles: hgext.largefiles.reposetup.checkrequireslfiles
955 calling hook changegroup.lfiles: hgext.largefiles.reposetup.checkrequireslfiles
948 (run 'hg update' to get a working copy)
956 (run 'hg update' to get a working copy)
949 pulling largefiles for revision 7
957 pulling largefiles for revision 7
950 found 971fb41e78fea4f8e0ba5244784239371cb00591 in store
958 found 971fb41e78fea4f8e0ba5244784239371cb00591 in store
951 found 0d6d75887db61b2c7e6c74b5dd8fc6ad50c0cc30 in store
959 found 0d6d75887db61b2c7e6c74b5dd8fc6ad50c0cc30 in store
952 found bb3151689acb10f0c3125c560d5e63df914bc1af in store
960 found bb3151689acb10f0c3125c560d5e63df914bc1af in store
953 pulling largefiles for revision 2
961 pulling largefiles for revision 2
954 found eb7338044dc27f9bc59b8dd5a246b065ead7a9c4 in store
962 found eb7338044dc27f9bc59b8dd5a246b065ead7a9c4 in store
955 0 largefiles cached
963 0 largefiles cached
956
964
957 lfpull
965 lfpull
958
966
959 $ hg lfpull -r : --config largefiles.usercache=usercache-lfpull
967 $ hg lfpull -r : --config largefiles.usercache=usercache-lfpull
960 2 largefiles cached
968 2 largefiles cached
961 $ hg lfpull -v -r 4+2 --config largefiles.usercache=usercache-lfpull
969 $ hg lfpull -v -r 4+2 --config largefiles.usercache=usercache-lfpull
962 pulling largefiles for revision 4
970 pulling largefiles for revision 4
963 found eb7338044dc27f9bc59b8dd5a246b065ead7a9c4 in store
971 found eb7338044dc27f9bc59b8dd5a246b065ead7a9c4 in store
964 found eb7338044dc27f9bc59b8dd5a246b065ead7a9c4 in store
972 found eb7338044dc27f9bc59b8dd5a246b065ead7a9c4 in store
965 pulling largefiles for revision 2
973 pulling largefiles for revision 2
966 found eb7338044dc27f9bc59b8dd5a246b065ead7a9c4 in store
974 found eb7338044dc27f9bc59b8dd5a246b065ead7a9c4 in store
967 0 largefiles cached
975 0 largefiles cached
968
976
969 $ ls usercache-lfpull/* | sort
977 $ ls usercache-lfpull/* | sort
970 usercache-lfpull/1deebade43c8c498a3c8daddac0244dc55d1331d
978 usercache-lfpull/1deebade43c8c498a3c8daddac0244dc55d1331d
971 usercache-lfpull/4669e532d5b2c093a78eca010077e708a071bb64
979 usercache-lfpull/4669e532d5b2c093a78eca010077e708a071bb64
972
980
973 $ cd ..
981 $ cd ..
974
982
975 Rebasing between two repositories does not revert largefiles to old
983 Rebasing between two repositories does not revert largefiles to old
976 revisions (this was a very bad bug that took a lot of work to fix).
984 revisions (this was a very bad bug that took a lot of work to fix).
977
985
978 $ hg clone a d
986 $ hg clone a d
979 updating to branch default
987 updating to branch default
980 getting changed largefiles
988 getting changed largefiles
981 3 largefiles updated, 0 removed
989 3 largefiles updated, 0 removed
982 5 files updated, 0 files merged, 0 files removed, 0 files unresolved
990 5 files updated, 0 files merged, 0 files removed, 0 files unresolved
983 $ cd b
991 $ cd b
984 $ echo large4-modified > sub/large4
992 $ echo large4-modified > sub/large4
985 $ echo normal3-modified > normal3
993 $ echo normal3-modified > normal3
986 $ hg commit -m "modify normal file and largefile in repo b"
994 $ hg commit -m "modify normal file and largefile in repo b"
987 Invoking status precommit hook
995 Invoking status precommit hook
988 M normal3
996 M normal3
989 M sub/large4
997 M sub/large4
990 $ cd ../d
998 $ cd ../d
991 $ echo large6-modified > sub2/large6
999 $ echo large6-modified > sub2/large6
992 $ echo normal4-modified > sub/normal4
1000 $ echo normal4-modified > sub/normal4
993 $ hg commit -m "modify normal file largefile in repo d"
1001 $ hg commit -m "modify normal file largefile in repo d"
994 Invoking status precommit hook
1002 Invoking status precommit hook
995 M sub/normal4
1003 M sub/normal4
996 M sub2/large6
1004 M sub2/large6
997 $ cd ..
1005 $ cd ..
998 $ hg clone d e
1006 $ hg clone d e
999 updating to branch default
1007 updating to branch default
1000 getting changed largefiles
1008 getting changed largefiles
1001 3 largefiles updated, 0 removed
1009 3 largefiles updated, 0 removed
1002 5 files updated, 0 files merged, 0 files removed, 0 files unresolved
1010 5 files updated, 0 files merged, 0 files removed, 0 files unresolved
1003 $ cd d
1011 $ cd d
1004
1012
1005 More rebase testing, but also test that the largefiles are downloaded from
1013 More rebase testing, but also test that the largefiles are downloaded from
1006 'default-push' when no source is specified (issue3584). (The largefile from the
1014 'default-push' when no source is specified (issue3584). (The largefile from the
1007 pulled revision is however not downloaded but found in the local cache.)
1015 pulled revision is however not downloaded but found in the local cache.)
1008 Largefiles are fetched for the new pulled revision, not for existing revisions,
1016 Largefiles are fetched for the new pulled revision, not for existing revisions,
1009 rebased or not.
1017 rebased or not.
1010
1018
1011 $ [ ! -f .hg/largefiles/e166e74c7303192238d60af5a9c4ce9bef0b7928 ]
1019 $ [ ! -f .hg/largefiles/e166e74c7303192238d60af5a9c4ce9bef0b7928 ]
1012 $ hg pull --rebase --all-largefiles --config paths.default-push=bogus/path --config paths.default=../b
1020 $ hg pull --rebase --all-largefiles --config paths.default-push=bogus/path --config paths.default=../b
1013 pulling from $TESTTMP/b (glob)
1021 pulling from $TESTTMP/b (glob)
1014 searching for changes
1022 searching for changes
1015 adding changesets
1023 adding changesets
1016 adding manifests
1024 adding manifests
1017 adding file changes
1025 adding file changes
1018 added 1 changesets with 2 changes to 2 files (+1 heads)
1026 added 1 changesets with 2 changes to 2 files (+1 heads)
1019 Invoking status precommit hook
1027 Invoking status precommit hook
1020 M sub/normal4
1028 M sub/normal4
1021 M sub2/large6
1029 M sub2/large6
1022 saved backup bundle to $TESTTMP/d/.hg/strip-backup/f574fb32bb45-backup.hg (glob)
1030 saved backup bundle to $TESTTMP/d/.hg/strip-backup/f574fb32bb45-backup.hg (glob)
1023 0 largefiles cached
1031 0 largefiles cached
1024 nothing to rebase - working directory parent is also destination
1032 nothing to rebase - working directory parent is also destination
1025 $ [ -f .hg/largefiles/e166e74c7303192238d60af5a9c4ce9bef0b7928 ]
1033 $ [ -f .hg/largefiles/e166e74c7303192238d60af5a9c4ce9bef0b7928 ]
1026 $ hg log --template '{rev}:{node|short} {desc|firstline}\n'
1034 $ hg log --template '{rev}:{node|short} {desc|firstline}\n'
1027 9:598410d3eb9a modify normal file largefile in repo d
1035 9:598410d3eb9a modify normal file largefile in repo d
1028 8:a381d2c8c80e modify normal file and largefile in repo b
1036 8:a381d2c8c80e modify normal file and largefile in repo b
1029 7:daea875e9014 add/edit more largefiles
1037 7:daea875e9014 add/edit more largefiles
1030 6:4355d653f84f edit files yet again
1038 6:4355d653f84f edit files yet again
1031 5:9d5af5072dbd edit files again
1039 5:9d5af5072dbd edit files again
1032 4:74c02385b94c move files
1040 4:74c02385b94c move files
1033 3:9e8fbc4bce62 copy files
1041 3:9e8fbc4bce62 copy files
1034 2:51a0ae4d5864 remove files
1042 2:51a0ae4d5864 remove files
1035 1:ce8896473775 edit files
1043 1:ce8896473775 edit files
1036 0:30d30fe6a5be add files
1044 0:30d30fe6a5be add files
1037 $ hg log -G --template '{rev}:{node|short} {desc|firstline}\n'
1045 $ hg log -G --template '{rev}:{node|short} {desc|firstline}\n'
1038 @ 9:598410d3eb9a modify normal file largefile in repo d
1046 @ 9:598410d3eb9a modify normal file largefile in repo d
1039 |
1047 |
1040 o 8:a381d2c8c80e modify normal file and largefile in repo b
1048 o 8:a381d2c8c80e modify normal file and largefile in repo b
1041 |
1049 |
1042 o 7:daea875e9014 add/edit more largefiles
1050 o 7:daea875e9014 add/edit more largefiles
1043 |
1051 |
1044 o 6:4355d653f84f edit files yet again
1052 o 6:4355d653f84f edit files yet again
1045 |
1053 |
1046 o 5:9d5af5072dbd edit files again
1054 o 5:9d5af5072dbd edit files again
1047 |
1055 |
1048 o 4:74c02385b94c move files
1056 o 4:74c02385b94c move files
1049 |
1057 |
1050 o 3:9e8fbc4bce62 copy files
1058 o 3:9e8fbc4bce62 copy files
1051 |
1059 |
1052 o 2:51a0ae4d5864 remove files
1060 o 2:51a0ae4d5864 remove files
1053 |
1061 |
1054 o 1:ce8896473775 edit files
1062 o 1:ce8896473775 edit files
1055 |
1063 |
1056 o 0:30d30fe6a5be add files
1064 o 0:30d30fe6a5be add files
1057
1065
1058 $ cat normal3
1066 $ cat normal3
1059 normal3-modified
1067 normal3-modified
1060 $ cat sub/normal4
1068 $ cat sub/normal4
1061 normal4-modified
1069 normal4-modified
1062 $ cat sub/large4
1070 $ cat sub/large4
1063 large4-modified
1071 large4-modified
1064 $ cat sub2/large6
1072 $ cat sub2/large6
1065 large6-modified
1073 large6-modified
1066 $ cat sub2/large7
1074 $ cat sub2/large7
1067 large7
1075 large7
1068 $ cd ../e
1076 $ cd ../e
1069 $ hg pull ../b
1077 $ hg pull ../b
1070 pulling from ../b
1078 pulling from ../b
1071 searching for changes
1079 searching for changes
1072 adding changesets
1080 adding changesets
1073 adding manifests
1081 adding manifests
1074 adding file changes
1082 adding file changes
1075 added 1 changesets with 2 changes to 2 files (+1 heads)
1083 added 1 changesets with 2 changes to 2 files (+1 heads)
1076 (run 'hg heads' to see heads, 'hg merge' to merge)
1084 (run 'hg heads' to see heads, 'hg merge' to merge)
1077 $ hg rebase
1085 $ hg rebase
1078 Invoking status precommit hook
1086 Invoking status precommit hook
1079 M sub/normal4
1087 M sub/normal4
1080 M sub2/large6
1088 M sub2/large6
1081 saved backup bundle to $TESTTMP/e/.hg/strip-backup/f574fb32bb45-backup.hg (glob)
1089 saved backup bundle to $TESTTMP/e/.hg/strip-backup/f574fb32bb45-backup.hg (glob)
1082 $ hg log --template '{rev}:{node|short} {desc|firstline}\n'
1090 $ hg log --template '{rev}:{node|short} {desc|firstline}\n'
1083 9:598410d3eb9a modify normal file largefile in repo d
1091 9:598410d3eb9a modify normal file largefile in repo d
1084 8:a381d2c8c80e modify normal file and largefile in repo b
1092 8:a381d2c8c80e modify normal file and largefile in repo b
1085 7:daea875e9014 add/edit more largefiles
1093 7:daea875e9014 add/edit more largefiles
1086 6:4355d653f84f edit files yet again
1094 6:4355d653f84f edit files yet again
1087 5:9d5af5072dbd edit files again
1095 5:9d5af5072dbd edit files again
1088 4:74c02385b94c move files
1096 4:74c02385b94c move files
1089 3:9e8fbc4bce62 copy files
1097 3:9e8fbc4bce62 copy files
1090 2:51a0ae4d5864 remove files
1098 2:51a0ae4d5864 remove files
1091 1:ce8896473775 edit files
1099 1:ce8896473775 edit files
1092 0:30d30fe6a5be add files
1100 0:30d30fe6a5be add files
1093 $ cat normal3
1101 $ cat normal3
1094 normal3-modified
1102 normal3-modified
1095 $ cat sub/normal4
1103 $ cat sub/normal4
1096 normal4-modified
1104 normal4-modified
1097 $ cat sub/large4
1105 $ cat sub/large4
1098 large4-modified
1106 large4-modified
1099 $ cat sub2/large6
1107 $ cat sub2/large6
1100 large6-modified
1108 large6-modified
1101 $ cat sub2/large7
1109 $ cat sub2/large7
1102 large7
1110 large7
1103
1111
1104 Log on largefiles
1112 Log on largefiles
1105
1113
1106 - same output
1114 - same output
1107 $ hg log --template '{rev}:{node|short} {desc|firstline}\n' .hglf/sub/large4
1115 $ hg log --template '{rev}:{node|short} {desc|firstline}\n' .hglf/sub/large4
1108 8:a381d2c8c80e modify normal file and largefile in repo b
1116 8:a381d2c8c80e modify normal file and largefile in repo b
1109 6:4355d653f84f edit files yet again
1117 6:4355d653f84f edit files yet again
1110 5:9d5af5072dbd edit files again
1118 5:9d5af5072dbd edit files again
1111 4:74c02385b94c move files
1119 4:74c02385b94c move files
1112 $ hg log -G --template '{rev}:{node|short} {desc|firstline}\n' .hglf/sub/large4
1120 $ hg log -G --template '{rev}:{node|short} {desc|firstline}\n' .hglf/sub/large4
1113 o 8:a381d2c8c80e modify normal file and largefile in repo b
1121 o 8:a381d2c8c80e modify normal file and largefile in repo b
1114 |
1122 |
1115 o 6:4355d653f84f edit files yet again
1123 o 6:4355d653f84f edit files yet again
1116 |
1124 |
1117 o 5:9d5af5072dbd edit files again
1125 o 5:9d5af5072dbd edit files again
1118 |
1126 |
1119 o 4:74c02385b94c move files
1127 o 4:74c02385b94c move files
1120 |
1128 |
1121 $ hg log --template '{rev}:{node|short} {desc|firstline}\n' sub/large4
1129 $ hg log --template '{rev}:{node|short} {desc|firstline}\n' sub/large4
1122 8:a381d2c8c80e modify normal file and largefile in repo b
1130 8:a381d2c8c80e modify normal file and largefile in repo b
1123 6:4355d653f84f edit files yet again
1131 6:4355d653f84f edit files yet again
1124 5:9d5af5072dbd edit files again
1132 5:9d5af5072dbd edit files again
1125 4:74c02385b94c move files
1133 4:74c02385b94c move files
1126 $ hg log -G --template '{rev}:{node|short} {desc|firstline}\n' .hglf/sub/large4
1134 $ hg log -G --template '{rev}:{node|short} {desc|firstline}\n' .hglf/sub/large4
1127 o 8:a381d2c8c80e modify normal file and largefile in repo b
1135 o 8:a381d2c8c80e modify normal file and largefile in repo b
1128 |
1136 |
1129 o 6:4355d653f84f edit files yet again
1137 o 6:4355d653f84f edit files yet again
1130 |
1138 |
1131 o 5:9d5af5072dbd edit files again
1139 o 5:9d5af5072dbd edit files again
1132 |
1140 |
1133 o 4:74c02385b94c move files
1141 o 4:74c02385b94c move files
1134 |
1142 |
1135
1143
1136 - .hglf only matches largefiles, without .hglf it matches 9 bco sub/normal
1144 - .hglf only matches largefiles, without .hglf it matches 9 bco sub/normal
1137 $ hg log --template '{rev}:{node|short} {desc|firstline}\n' .hglf/sub
1145 $ hg log --template '{rev}:{node|short} {desc|firstline}\n' .hglf/sub
1138 8:a381d2c8c80e modify normal file and largefile in repo b
1146 8:a381d2c8c80e modify normal file and largefile in repo b
1139 6:4355d653f84f edit files yet again
1147 6:4355d653f84f edit files yet again
1140 5:9d5af5072dbd edit files again
1148 5:9d5af5072dbd edit files again
1141 4:74c02385b94c move files
1149 4:74c02385b94c move files
1142 1:ce8896473775 edit files
1150 1:ce8896473775 edit files
1143 0:30d30fe6a5be add files
1151 0:30d30fe6a5be add files
1144 $ hg log -G --template '{rev}:{node|short} {desc|firstline}\n' .hglf/sub
1152 $ hg log -G --template '{rev}:{node|short} {desc|firstline}\n' .hglf/sub
1145 o 8:a381d2c8c80e modify normal file and largefile in repo b
1153 o 8:a381d2c8c80e modify normal file and largefile in repo b
1146 |
1154 |
1147 o 6:4355d653f84f edit files yet again
1155 o 6:4355d653f84f edit files yet again
1148 |
1156 |
1149 o 5:9d5af5072dbd edit files again
1157 o 5:9d5af5072dbd edit files again
1150 |
1158 |
1151 o 4:74c02385b94c move files
1159 o 4:74c02385b94c move files
1152 |
1160 |
1153 o 1:ce8896473775 edit files
1161 o 1:ce8896473775 edit files
1154 |
1162 |
1155 o 0:30d30fe6a5be add files
1163 o 0:30d30fe6a5be add files
1156
1164
1157 $ hg log --template '{rev}:{node|short} {desc|firstline}\n' sub
1165 $ hg log --template '{rev}:{node|short} {desc|firstline}\n' sub
1158 9:598410d3eb9a modify normal file largefile in repo d
1166 9:598410d3eb9a modify normal file largefile in repo d
1159 8:a381d2c8c80e modify normal file and largefile in repo b
1167 8:a381d2c8c80e modify normal file and largefile in repo b
1160 6:4355d653f84f edit files yet again
1168 6:4355d653f84f edit files yet again
1161 5:9d5af5072dbd edit files again
1169 5:9d5af5072dbd edit files again
1162 4:74c02385b94c move files
1170 4:74c02385b94c move files
1163 1:ce8896473775 edit files
1171 1:ce8896473775 edit files
1164 0:30d30fe6a5be add files
1172 0:30d30fe6a5be add files
1165 $ hg log -G --template '{rev}:{node|short} {desc|firstline}\n' sub
1173 $ hg log -G --template '{rev}:{node|short} {desc|firstline}\n' sub
1166 @ 9:598410d3eb9a modify normal file largefile in repo d
1174 @ 9:598410d3eb9a modify normal file largefile in repo d
1167 |
1175 |
1168 o 8:a381d2c8c80e modify normal file and largefile in repo b
1176 o 8:a381d2c8c80e modify normal file and largefile in repo b
1169 |
1177 |
1170 o 6:4355d653f84f edit files yet again
1178 o 6:4355d653f84f edit files yet again
1171 |
1179 |
1172 o 5:9d5af5072dbd edit files again
1180 o 5:9d5af5072dbd edit files again
1173 |
1181 |
1174 o 4:74c02385b94c move files
1182 o 4:74c02385b94c move files
1175 |
1183 |
1176 o 1:ce8896473775 edit files
1184 o 1:ce8896473775 edit files
1177 |
1185 |
1178 o 0:30d30fe6a5be add files
1186 o 0:30d30fe6a5be add files
1179
1187
1180 - globbing gives same result
1188 - globbing gives same result
1181 $ hg log --template '{rev}:{node|short} {desc|firstline}\n' 'glob:sub/*'
1189 $ hg log --template '{rev}:{node|short} {desc|firstline}\n' 'glob:sub/*'
1182 9:598410d3eb9a modify normal file largefile in repo d
1190 9:598410d3eb9a modify normal file largefile in repo d
1183 8:a381d2c8c80e modify normal file and largefile in repo b
1191 8:a381d2c8c80e modify normal file and largefile in repo b
1184 6:4355d653f84f edit files yet again
1192 6:4355d653f84f edit files yet again
1185 5:9d5af5072dbd edit files again
1193 5:9d5af5072dbd edit files again
1186 4:74c02385b94c move files
1194 4:74c02385b94c move files
1187 1:ce8896473775 edit files
1195 1:ce8896473775 edit files
1188 0:30d30fe6a5be add files
1196 0:30d30fe6a5be add files
1189 $ hg log -G --template '{rev}:{node|short} {desc|firstline}\n' 'glob:sub/*'
1197 $ hg log -G --template '{rev}:{node|short} {desc|firstline}\n' 'glob:sub/*'
1190 @ 9:598410d3eb9a modify normal file largefile in repo d
1198 @ 9:598410d3eb9a modify normal file largefile in repo d
1191 |
1199 |
1192 o 8:a381d2c8c80e modify normal file and largefile in repo b
1200 o 8:a381d2c8c80e modify normal file and largefile in repo b
1193 |
1201 |
1194 o 6:4355d653f84f edit files yet again
1202 o 6:4355d653f84f edit files yet again
1195 |
1203 |
1196 o 5:9d5af5072dbd edit files again
1204 o 5:9d5af5072dbd edit files again
1197 |
1205 |
1198 o 4:74c02385b94c move files
1206 o 4:74c02385b94c move files
1199 |
1207 |
1200 o 1:ce8896473775 edit files
1208 o 1:ce8896473775 edit files
1201 |
1209 |
1202 o 0:30d30fe6a5be add files
1210 o 0:30d30fe6a5be add files
1203
1211
1204 Rollback on largefiles.
1212 Rollback on largefiles.
1205
1213
1206 $ echo large4-modified-again > sub/large4
1214 $ echo large4-modified-again > sub/large4
1207 $ hg commit -m "Modify large4 again"
1215 $ hg commit -m "Modify large4 again"
1208 Invoking status precommit hook
1216 Invoking status precommit hook
1209 M sub/large4
1217 M sub/large4
1210 $ hg rollback
1218 $ hg rollback
1211 repository tip rolled back to revision 9 (undo commit)
1219 repository tip rolled back to revision 9 (undo commit)
1212 working directory now based on revision 9
1220 working directory now based on revision 9
1213 $ hg st
1221 $ hg st
1214 M sub/large4
1222 M sub/large4
1215 $ hg log --template '{rev}:{node|short} {desc|firstline}\n'
1223 $ hg log --template '{rev}:{node|short} {desc|firstline}\n'
1216 9:598410d3eb9a modify normal file largefile in repo d
1224 9:598410d3eb9a modify normal file largefile in repo d
1217 8:a381d2c8c80e modify normal file and largefile in repo b
1225 8:a381d2c8c80e modify normal file and largefile in repo b
1218 7:daea875e9014 add/edit more largefiles
1226 7:daea875e9014 add/edit more largefiles
1219 6:4355d653f84f edit files yet again
1227 6:4355d653f84f edit files yet again
1220 5:9d5af5072dbd edit files again
1228 5:9d5af5072dbd edit files again
1221 4:74c02385b94c move files
1229 4:74c02385b94c move files
1222 3:9e8fbc4bce62 copy files
1230 3:9e8fbc4bce62 copy files
1223 2:51a0ae4d5864 remove files
1231 2:51a0ae4d5864 remove files
1224 1:ce8896473775 edit files
1232 1:ce8896473775 edit files
1225 0:30d30fe6a5be add files
1233 0:30d30fe6a5be add files
1226 $ cat sub/large4
1234 $ cat sub/large4
1227 large4-modified-again
1235 large4-modified-again
1228
1236
1229 "update --check" refuses to update with uncommitted changes.
1237 "update --check" refuses to update with uncommitted changes.
1230 $ hg update --check 8
1238 $ hg update --check 8
1231 abort: uncommitted changes
1239 abort: uncommitted changes
1232 [255]
1240 [255]
1233
1241
1234 "update --clean" leaves correct largefiles in working copy, even when there is
1242 "update --clean" leaves correct largefiles in working copy, even when there is
1235 .orig files from revert in .hglf.
1243 .orig files from revert in .hglf.
1236
1244
1237 $ echo mistake > sub2/large7
1245 $ echo mistake > sub2/large7
1238 $ hg revert sub2/large7
1246 $ hg revert sub2/large7
1239 $ cat sub2/large7
1247 $ cat sub2/large7
1240 large7
1248 large7
1241 $ cat sub2/large7.orig
1249 $ cat sub2/large7.orig
1242 mistake
1250 mistake
1243 $ test ! -f .hglf/sub2/large7.orig
1251 $ test ! -f .hglf/sub2/large7.orig
1244
1252
1245 $ hg -q update --clean -r null
1253 $ hg -q update --clean -r null
1246 $ hg update --clean
1254 $ hg update --clean
1247 getting changed largefiles
1255 getting changed largefiles
1248 3 largefiles updated, 0 removed
1256 3 largefiles updated, 0 removed
1249 5 files updated, 0 files merged, 0 files removed, 0 files unresolved
1257 5 files updated, 0 files merged, 0 files removed, 0 files unresolved
1250 $ cat normal3
1258 $ cat normal3
1251 normal3-modified
1259 normal3-modified
1252 $ cat sub/normal4
1260 $ cat sub/normal4
1253 normal4-modified
1261 normal4-modified
1254 $ cat sub/large4
1262 $ cat sub/large4
1255 large4-modified
1263 large4-modified
1256 $ cat sub2/large6
1264 $ cat sub2/large6
1257 large6-modified
1265 large6-modified
1258 $ cat sub2/large7
1266 $ cat sub2/large7
1259 large7
1267 large7
1260 $ cat sub2/large7.orig
1268 $ cat sub2/large7.orig
1261 mistake
1269 mistake
1262 $ test ! -f .hglf/sub2/large7.orig
1270 $ test ! -f .hglf/sub2/large7.orig
1263
1271
1264 verify that largefile .orig file no longer is overwritten on every update -C:
1272 verify that largefile .orig file no longer is overwritten on every update -C:
1265 $ hg update --clean
1273 $ hg update --clean
1266 getting changed largefiles
1274 getting changed largefiles
1267 0 largefiles updated, 0 removed
1275 0 largefiles updated, 0 removed
1268 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
1276 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
1269 $ cat sub2/large7.orig
1277 $ cat sub2/large7.orig
1270 mistake
1278 mistake
1271 $ rm sub2/large7.orig
1279 $ rm sub2/large7.orig
1272
1280
1273 Now "update check" is happy.
1281 Now "update check" is happy.
1274 $ hg update --check 8
1282 $ hg update --check 8
1275 getting changed largefiles
1283 getting changed largefiles
1276 1 largefiles updated, 0 removed
1284 1 largefiles updated, 0 removed
1277 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
1285 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
1278 $ hg update --check
1286 $ hg update --check
1279 getting changed largefiles
1287 getting changed largefiles
1280 1 largefiles updated, 0 removed
1288 1 largefiles updated, 0 removed
1281 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
1289 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
1282
1290
1283 Test removing empty largefiles directories on update
1291 Test removing empty largefiles directories on update
1284 $ test -d sub2 && echo "sub2 exists"
1292 $ test -d sub2 && echo "sub2 exists"
1285 sub2 exists
1293 sub2 exists
1286 $ hg update -q null
1294 $ hg update -q null
1287 $ test -d sub2 && echo "error: sub2 should not exist anymore"
1295 $ test -d sub2 && echo "error: sub2 should not exist anymore"
1288 [1]
1296 [1]
1289 $ hg update -q
1297 $ hg update -q
1290
1298
1291 Test hg remove removes empty largefiles directories
1299 Test hg remove removes empty largefiles directories
1292 $ test -d sub2 && echo "sub2 exists"
1300 $ test -d sub2 && echo "sub2 exists"
1293 sub2 exists
1301 sub2 exists
1294 $ hg remove sub2/*
1302 $ hg remove sub2/*
1295 $ test -d sub2 && echo "error: sub2 should not exist anymore"
1303 $ test -d sub2 && echo "error: sub2 should not exist anymore"
1296 [1]
1304 [1]
1297 $ hg revert sub2/large6 sub2/large7
1305 $ hg revert sub2/large6 sub2/large7
1298
1306
1299 "revert" works on largefiles (and normal files too).
1307 "revert" works on largefiles (and normal files too).
1300 $ echo hack3 >> normal3
1308 $ echo hack3 >> normal3
1301 $ echo hack4 >> sub/normal4
1309 $ echo hack4 >> sub/normal4
1302 $ echo hack4 >> sub/large4
1310 $ echo hack4 >> sub/large4
1303 $ rm sub2/large6
1311 $ rm sub2/large6
1304 $ hg revert sub2/large6
1312 $ hg revert sub2/large6
1305 $ hg rm sub2/large6
1313 $ hg rm sub2/large6
1306 $ echo new >> sub2/large8
1314 $ echo new >> sub2/large8
1307 $ hg add --large sub2/large8
1315 $ hg add --large sub2/large8
1308 # XXX we don't really want to report that we're reverting the standin;
1316 # XXX we don't really want to report that we're reverting the standin;
1309 # that's just an implementation detail. But I don't see an obvious fix. ;-(
1317 # that's just an implementation detail. But I don't see an obvious fix. ;-(
1310 $ hg revert sub
1318 $ hg revert sub
1311 reverting .hglf/sub/large4 (glob)
1319 reverting .hglf/sub/large4 (glob)
1312 reverting sub/normal4 (glob)
1320 reverting sub/normal4 (glob)
1313 $ hg status
1321 $ hg status
1314 M normal3
1322 M normal3
1315 A sub2/large8
1323 A sub2/large8
1316 R sub2/large6
1324 R sub2/large6
1317 ? sub/large4.orig
1325 ? sub/large4.orig
1318 ? sub/normal4.orig
1326 ? sub/normal4.orig
1319 $ cat sub/normal4
1327 $ cat sub/normal4
1320 normal4-modified
1328 normal4-modified
1321 $ cat sub/large4
1329 $ cat sub/large4
1322 large4-modified
1330 large4-modified
1323 $ hg revert -a --no-backup
1331 $ hg revert -a --no-backup
1324 undeleting .hglf/sub2/large6 (glob)
1332 undeleting .hglf/sub2/large6 (glob)
1325 forgetting .hglf/sub2/large8 (glob)
1333 forgetting .hglf/sub2/large8 (glob)
1326 reverting normal3
1334 reverting normal3
1327 $ hg status
1335 $ hg status
1328 ? sub/large4.orig
1336 ? sub/large4.orig
1329 ? sub/normal4.orig
1337 ? sub/normal4.orig
1330 ? sub2/large8
1338 ? sub2/large8
1331 $ cat normal3
1339 $ cat normal3
1332 normal3-modified
1340 normal3-modified
1333 $ cat sub2/large6
1341 $ cat sub2/large6
1334 large6-modified
1342 large6-modified
1335 $ rm sub/*.orig sub2/large8
1343 $ rm sub/*.orig sub2/large8
1336
1344
1337 revert some files to an older revision
1345 revert some files to an older revision
1338 $ hg revert --no-backup -r 8 sub2
1346 $ hg revert --no-backup -r 8 sub2
1339 reverting .hglf/sub2/large6 (glob)
1347 reverting .hglf/sub2/large6 (glob)
1340 $ cat sub2/large6
1348 $ cat sub2/large6
1341 large6
1349 large6
1342 $ hg revert --no-backup -C -r '.^' sub2
1350 $ hg revert --no-backup -C -r '.^' sub2
1343 reverting .hglf/sub2/large6 (glob)
1351 reverting .hglf/sub2/large6 (glob)
1344 $ hg revert --no-backup sub2
1352 $ hg revert --no-backup sub2
1345 reverting .hglf/sub2/large6 (glob)
1353 reverting .hglf/sub2/large6 (glob)
1346 $ hg status
1354 $ hg status
1347
1355
1348 "verify --large" actually verifies largefiles
1356 "verify --large" actually verifies largefiles
1349
1357
1350 - Where Do We Come From? What Are We? Where Are We Going?
1358 - Where Do We Come From? What Are We? Where Are We Going?
1351 $ pwd
1359 $ pwd
1352 $TESTTMP/e
1360 $TESTTMP/e
1353 $ hg paths
1361 $ hg paths
1354 default = $TESTTMP/d (glob)
1362 default = $TESTTMP/d (glob)
1355
1363
1356 $ hg verify --large
1364 $ hg verify --large
1357 checking changesets
1365 checking changesets
1358 checking manifests
1366 checking manifests
1359 crosschecking files in changesets and manifests
1367 crosschecking files in changesets and manifests
1360 checking files
1368 checking files
1361 10 files, 10 changesets, 28 total revisions
1369 10 files, 10 changesets, 28 total revisions
1362 searching 1 changesets for largefiles
1370 searching 1 changesets for largefiles
1363 verified existence of 3 revisions of 3 largefiles
1371 verified existence of 3 revisions of 3 largefiles
1364
1372
1365 - introduce missing blob in local store repo and make sure that this is caught:
1373 - introduce missing blob in local store repo and make sure that this is caught:
1366 $ mv $TESTTMP/d/.hg/largefiles/e166e74c7303192238d60af5a9c4ce9bef0b7928 .
1374 $ mv $TESTTMP/d/.hg/largefiles/e166e74c7303192238d60af5a9c4ce9bef0b7928 .
1367 $ hg verify --large
1375 $ hg verify --large
1368 checking changesets
1376 checking changesets
1369 checking manifests
1377 checking manifests
1370 crosschecking files in changesets and manifests
1378 crosschecking files in changesets and manifests
1371 checking files
1379 checking files
1372 10 files, 10 changesets, 28 total revisions
1380 10 files, 10 changesets, 28 total revisions
1373 searching 1 changesets for largefiles
1381 searching 1 changesets for largefiles
1374 changeset 9:598410d3eb9a: sub/large4 references missing $TESTTMP/d/.hg/largefiles/e166e74c7303192238d60af5a9c4ce9bef0b7928 (glob)
1382 changeset 9:598410d3eb9a: sub/large4 references missing $TESTTMP/d/.hg/largefiles/e166e74c7303192238d60af5a9c4ce9bef0b7928 (glob)
1375 verified existence of 3 revisions of 3 largefiles
1383 verified existence of 3 revisions of 3 largefiles
1376 [1]
1384 [1]
1377
1385
1378 - introduce corruption and make sure that it is caught when checking content:
1386 - introduce corruption and make sure that it is caught when checking content:
1379 $ echo '5 cents' > $TESTTMP/d/.hg/largefiles/e166e74c7303192238d60af5a9c4ce9bef0b7928
1387 $ echo '5 cents' > $TESTTMP/d/.hg/largefiles/e166e74c7303192238d60af5a9c4ce9bef0b7928
1380 $ hg verify -q --large --lfc
1388 $ hg verify -q --large --lfc
1381 changeset 9:598410d3eb9a: sub/large4 references corrupted $TESTTMP/d/.hg/largefiles/e166e74c7303192238d60af5a9c4ce9bef0b7928 (glob)
1389 changeset 9:598410d3eb9a: sub/large4 references corrupted $TESTTMP/d/.hg/largefiles/e166e74c7303192238d60af5a9c4ce9bef0b7928 (glob)
1382 [1]
1390 [1]
1383
1391
1384 - cleanup
1392 - cleanup
1385 $ mv e166e74c7303192238d60af5a9c4ce9bef0b7928 $TESTTMP/d/.hg/largefiles/
1393 $ mv e166e74c7303192238d60af5a9c4ce9bef0b7928 $TESTTMP/d/.hg/largefiles/
1386
1394
1387 - verifying all revisions will fail because we didn't clone all largefiles to d:
1395 - verifying all revisions will fail because we didn't clone all largefiles to d:
1388 $ echo 'T-shirt' > $TESTTMP/d/.hg/largefiles/eb7338044dc27f9bc59b8dd5a246b065ead7a9c4
1396 $ echo 'T-shirt' > $TESTTMP/d/.hg/largefiles/eb7338044dc27f9bc59b8dd5a246b065ead7a9c4
1389 $ hg verify -q --lfa --lfc
1397 $ hg verify -q --lfa --lfc
1390 changeset 0:30d30fe6a5be: large1 references missing $TESTTMP/d/.hg/largefiles/4669e532d5b2c093a78eca010077e708a071bb64 (glob)
1398 changeset 0:30d30fe6a5be: large1 references missing $TESTTMP/d/.hg/largefiles/4669e532d5b2c093a78eca010077e708a071bb64 (glob)
1391 changeset 0:30d30fe6a5be: sub/large2 references missing $TESTTMP/d/.hg/largefiles/1deebade43c8c498a3c8daddac0244dc55d1331d (glob)
1399 changeset 0:30d30fe6a5be: sub/large2 references missing $TESTTMP/d/.hg/largefiles/1deebade43c8c498a3c8daddac0244dc55d1331d (glob)
1392 changeset 1:ce8896473775: large1 references missing $TESTTMP/d/.hg/largefiles/5f78770c0e77ba4287ad6ef3071c9bf9c379742f (glob)
1400 changeset 1:ce8896473775: large1 references missing $TESTTMP/d/.hg/largefiles/5f78770c0e77ba4287ad6ef3071c9bf9c379742f (glob)
1393 changeset 1:ce8896473775: sub/large2 references corrupted $TESTTMP/d/.hg/largefiles/eb7338044dc27f9bc59b8dd5a246b065ead7a9c4 (glob)
1401 changeset 1:ce8896473775: sub/large2 references corrupted $TESTTMP/d/.hg/largefiles/eb7338044dc27f9bc59b8dd5a246b065ead7a9c4 (glob)
1394 changeset 3:9e8fbc4bce62: large1 references corrupted $TESTTMP/d/.hg/largefiles/eb7338044dc27f9bc59b8dd5a246b065ead7a9c4 (glob)
1402 changeset 3:9e8fbc4bce62: large1 references corrupted $TESTTMP/d/.hg/largefiles/eb7338044dc27f9bc59b8dd5a246b065ead7a9c4 (glob)
1395 changeset 4:74c02385b94c: large3 references corrupted $TESTTMP/d/.hg/largefiles/eb7338044dc27f9bc59b8dd5a246b065ead7a9c4 (glob)
1403 changeset 4:74c02385b94c: large3 references corrupted $TESTTMP/d/.hg/largefiles/eb7338044dc27f9bc59b8dd5a246b065ead7a9c4 (glob)
1396 changeset 4:74c02385b94c: sub/large4 references corrupted $TESTTMP/d/.hg/largefiles/eb7338044dc27f9bc59b8dd5a246b065ead7a9c4 (glob)
1404 changeset 4:74c02385b94c: sub/large4 references corrupted $TESTTMP/d/.hg/largefiles/eb7338044dc27f9bc59b8dd5a246b065ead7a9c4 (glob)
1397 changeset 5:9d5af5072dbd: large3 references missing $TESTTMP/d/.hg/largefiles/baaf12afde9d8d67f25dab6dced0d2bf77dba47c (glob)
1405 changeset 5:9d5af5072dbd: large3 references missing $TESTTMP/d/.hg/largefiles/baaf12afde9d8d67f25dab6dced0d2bf77dba47c (glob)
1398 changeset 5:9d5af5072dbd: sub/large4 references missing $TESTTMP/d/.hg/largefiles/aeb2210d19f02886dde00dac279729a48471e2f9 (glob)
1406 changeset 5:9d5af5072dbd: sub/large4 references missing $TESTTMP/d/.hg/largefiles/aeb2210d19f02886dde00dac279729a48471e2f9 (glob)
1399 changeset 6:4355d653f84f: large3 references missing $TESTTMP/d/.hg/largefiles/7838695e10da2bb75ac1156565f40a2595fa2fa0 (glob)
1407 changeset 6:4355d653f84f: large3 references missing $TESTTMP/d/.hg/largefiles/7838695e10da2bb75ac1156565f40a2595fa2fa0 (glob)
1400 [1]
1408 [1]
1401
1409
1402 - cleanup
1410 - cleanup
1403 $ rm $TESTTMP/d/.hg/largefiles/eb7338044dc27f9bc59b8dd5a246b065ead7a9c4
1411 $ rm $TESTTMP/d/.hg/largefiles/eb7338044dc27f9bc59b8dd5a246b065ead7a9c4
1404 $ rm -f .hglf/sub/*.orig
1412 $ rm -f .hglf/sub/*.orig
1405
1413
1406 Update to revision with missing largefile - and make sure it really is missing
1414 Update to revision with missing largefile - and make sure it really is missing
1407
1415
1408 $ rm ${USERCACHE}/7838695e10da2bb75ac1156565f40a2595fa2fa0
1416 $ rm ${USERCACHE}/7838695e10da2bb75ac1156565f40a2595fa2fa0
1409 $ hg up -r 6
1417 $ hg up -r 6
1410 getting changed largefiles
1418 getting changed largefiles
1411 large3: largefile 7838695e10da2bb75ac1156565f40a2595fa2fa0 not available from file:/*/$TESTTMP/d (glob)
1419 large3: largefile 7838695e10da2bb75ac1156565f40a2595fa2fa0 not available from file:/*/$TESTTMP/d (glob)
1412 1 largefiles updated, 2 removed
1420 1 largefiles updated, 2 removed
1413 4 files updated, 0 files merged, 2 files removed, 0 files unresolved
1421 4 files updated, 0 files merged, 2 files removed, 0 files unresolved
1414 $ rm normal3
1422 $ rm normal3
1415 $ echo >> sub/normal4
1423 $ echo >> sub/normal4
1416 $ hg ci -m 'commit with missing files'
1424 $ hg ci -m 'commit with missing files'
1417 Invoking status precommit hook
1425 Invoking status precommit hook
1418 M sub/normal4
1426 M sub/normal4
1419 ! large3
1427 ! large3
1420 ! normal3
1428 ! normal3
1421 created new head
1429 created new head
1422 $ hg st
1430 $ hg st
1423 ! large3
1431 ! large3
1424 ! normal3
1432 ! normal3
1425 $ hg up -r.
1433 $ hg up -r.
1426 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
1434 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
1427 $ hg st
1435 $ hg st
1428 ! large3
1436 ! large3
1429 ! normal3
1437 ! normal3
1430 $ hg up -Cr.
1438 $ hg up -Cr.
1431 getting changed largefiles
1439 getting changed largefiles
1432 large3: largefile 7838695e10da2bb75ac1156565f40a2595fa2fa0 not available from file:/*/$TESTTMP/d (glob)
1440 large3: largefile 7838695e10da2bb75ac1156565f40a2595fa2fa0 not available from file:/*/$TESTTMP/d (glob)
1433 0 largefiles updated, 0 removed
1441 0 largefiles updated, 0 removed
1434 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1442 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1435 $ hg st
1443 $ hg st
1436 ! large3
1444 ! large3
1437 $ hg rollback
1445 $ hg rollback
1438 repository tip rolled back to revision 9 (undo commit)
1446 repository tip rolled back to revision 9 (undo commit)
1439 working directory now based on revision 6
1447 working directory now based on revision 6
1440
1448
1441 Merge with revision with missing largefile - and make sure it tries to fetch it.
1449 Merge with revision with missing largefile - and make sure it tries to fetch it.
1442
1450
1443 $ hg up -Cqr null
1451 $ hg up -Cqr null
1444 $ echo f > f
1452 $ echo f > f
1445 $ hg ci -Am branch
1453 $ hg ci -Am branch
1446 adding f
1454 adding f
1447 Invoking status precommit hook
1455 Invoking status precommit hook
1448 A f
1456 A f
1449 created new head
1457 created new head
1450 $ hg merge -r 6
1458 $ hg merge -r 6
1451 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
1459 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
1452 (branch merge, don't forget to commit)
1460 (branch merge, don't forget to commit)
1453 getting changed largefiles
1461 getting changed largefiles
1454 large3: largefile 7838695e10da2bb75ac1156565f40a2595fa2fa0 not available from file:/*/$TESTTMP/d (glob)
1462 large3: largefile 7838695e10da2bb75ac1156565f40a2595fa2fa0 not available from file:/*/$TESTTMP/d (glob)
1455 1 largefiles updated, 0 removed
1463 1 largefiles updated, 0 removed
1456
1464
1457 $ hg rollback -q
1465 $ hg rollback -q
1458 $ hg up -Cq
1466 $ hg up -Cq
1459
1467
1460 Pulling 0 revisions with --all-largefiles should not fetch for all revisions
1468 Pulling 0 revisions with --all-largefiles should not fetch for all revisions
1461
1469
1462 $ hg pull --all-largefiles
1470 $ hg pull --all-largefiles
1463 pulling from $TESTTMP/d (glob)
1471 pulling from $TESTTMP/d (glob)
1464 searching for changes
1472 searching for changes
1465 no changes found
1473 no changes found
1466
1474
1467 Merging does not revert to old versions of largefiles and also check
1475 Merging does not revert to old versions of largefiles and also check
1468 that merging after having pulled from a non-default remote works
1476 that merging after having pulled from a non-default remote works
1469 correctly.
1477 correctly.
1470
1478
1471 $ cd ..
1479 $ cd ..
1472 $ hg clone -r 7 e temp
1480 $ hg clone -r 7 e temp
1473 adding changesets
1481 adding changesets
1474 adding manifests
1482 adding manifests
1475 adding file changes
1483 adding file changes
1476 added 8 changesets with 24 changes to 10 files
1484 added 8 changesets with 24 changes to 10 files
1477 updating to branch default
1485 updating to branch default
1478 getting changed largefiles
1486 getting changed largefiles
1479 3 largefiles updated, 0 removed
1487 3 largefiles updated, 0 removed
1480 5 files updated, 0 files merged, 0 files removed, 0 files unresolved
1488 5 files updated, 0 files merged, 0 files removed, 0 files unresolved
1481 $ hg clone temp f
1489 $ hg clone temp f
1482 updating to branch default
1490 updating to branch default
1483 getting changed largefiles
1491 getting changed largefiles
1484 3 largefiles updated, 0 removed
1492 3 largefiles updated, 0 removed
1485 5 files updated, 0 files merged, 0 files removed, 0 files unresolved
1493 5 files updated, 0 files merged, 0 files removed, 0 files unresolved
1486 # Delete the largefiles in the largefiles system cache so that we have an
1494 # Delete the largefiles in the largefiles system cache so that we have an
1487 # opportunity to test that caching after a pull works.
1495 # opportunity to test that caching after a pull works.
1488 $ rm "${USERCACHE}"/*
1496 $ rm "${USERCACHE}"/*
1489 $ cd f
1497 $ cd f
1490 $ echo "large4-merge-test" > sub/large4
1498 $ echo "large4-merge-test" > sub/large4
1491 $ hg commit -m "Modify large4 to test merge"
1499 $ hg commit -m "Modify large4 to test merge"
1492 Invoking status precommit hook
1500 Invoking status precommit hook
1493 M sub/large4
1501 M sub/large4
1494 # Test --cache-largefiles flag
1502 # Test --cache-largefiles flag
1495 $ hg pull --lfrev 'heads(pulled())' ../e
1503 $ hg pull --lfrev 'heads(pulled())' ../e
1496 pulling from ../e
1504 pulling from ../e
1497 searching for changes
1505 searching for changes
1498 adding changesets
1506 adding changesets
1499 adding manifests
1507 adding manifests
1500 adding file changes
1508 adding file changes
1501 added 2 changesets with 4 changes to 4 files (+1 heads)
1509 added 2 changesets with 4 changes to 4 files (+1 heads)
1502 (run 'hg heads' to see heads, 'hg merge' to merge)
1510 (run 'hg heads' to see heads, 'hg merge' to merge)
1503 2 largefiles cached
1511 2 largefiles cached
1504 $ hg merge
1512 $ hg merge
1505 largefile sub/large4 has a merge conflict
1513 largefile sub/large4 has a merge conflict
1506 ancestor was 971fb41e78fea4f8e0ba5244784239371cb00591
1514 ancestor was 971fb41e78fea4f8e0ba5244784239371cb00591
1507 keep (l)ocal d846f26643bfa8ec210be40cc93cc6b7ff1128ea or
1515 keep (l)ocal d846f26643bfa8ec210be40cc93cc6b7ff1128ea or
1508 take (o)ther e166e74c7303192238d60af5a9c4ce9bef0b7928? l
1516 take (o)ther e166e74c7303192238d60af5a9c4ce9bef0b7928? l
1509 3 files updated, 1 files merged, 0 files removed, 0 files unresolved
1517 3 files updated, 1 files merged, 0 files removed, 0 files unresolved
1510 (branch merge, don't forget to commit)
1518 (branch merge, don't forget to commit)
1511 getting changed largefiles
1519 getting changed largefiles
1512 1 largefiles updated, 0 removed
1520 1 largefiles updated, 0 removed
1513 $ hg commit -m "Merge repos e and f"
1521 $ hg commit -m "Merge repos e and f"
1514 Invoking status precommit hook
1522 Invoking status precommit hook
1515 M normal3
1523 M normal3
1516 M sub/normal4
1524 M sub/normal4
1517 M sub2/large6
1525 M sub2/large6
1518 $ cat normal3
1526 $ cat normal3
1519 normal3-modified
1527 normal3-modified
1520 $ cat sub/normal4
1528 $ cat sub/normal4
1521 normal4-modified
1529 normal4-modified
1522 $ cat sub/large4
1530 $ cat sub/large4
1523 large4-merge-test
1531 large4-merge-test
1524 $ cat sub2/large6
1532 $ cat sub2/large6
1525 large6-modified
1533 large6-modified
1526 $ cat sub2/large7
1534 $ cat sub2/large7
1527 large7
1535 large7
1528
1536
1529 Test status after merging with a branch that introduces a new largefile:
1537 Test status after merging with a branch that introduces a new largefile:
1530
1538
1531 $ echo large > large
1539 $ echo large > large
1532 $ hg add --large large
1540 $ hg add --large large
1533 $ hg commit -m 'add largefile'
1541 $ hg commit -m 'add largefile'
1534 Invoking status precommit hook
1542 Invoking status precommit hook
1535 A large
1543 A large
1536 $ hg update -q ".^"
1544 $ hg update -q ".^"
1537 $ echo change >> normal3
1545 $ echo change >> normal3
1538 $ hg commit -m 'some change'
1546 $ hg commit -m 'some change'
1539 Invoking status precommit hook
1547 Invoking status precommit hook
1540 M normal3
1548 M normal3
1541 created new head
1549 created new head
1542 $ hg merge
1550 $ hg merge
1543 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1551 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1544 (branch merge, don't forget to commit)
1552 (branch merge, don't forget to commit)
1545 getting changed largefiles
1553 getting changed largefiles
1546 1 largefiles updated, 0 removed
1554 1 largefiles updated, 0 removed
1547 $ hg status
1555 $ hg status
1548 M large
1556 M large
1549
1557
1550 - make sure update of merge with removed largefiles fails as expected
1558 - make sure update of merge with removed largefiles fails as expected
1551 $ hg rm sub2/large6
1559 $ hg rm sub2/large6
1552 $ hg up -r.
1560 $ hg up -r.
1553 abort: outstanding uncommitted merges
1561 abort: outstanding uncommitted merges
1554 [255]
1562 [255]
1555
1563
1556 - revert should be able to revert files introduced in a pending merge
1564 - revert should be able to revert files introduced in a pending merge
1557 $ hg revert --all -r .
1565 $ hg revert --all -r .
1558 removing .hglf/large (glob)
1566 removing .hglf/large (glob)
1559 undeleting .hglf/sub2/large6 (glob)
1567 undeleting .hglf/sub2/large6 (glob)
1560
1568
1561 Test that a normal file and a largefile with the same name and path cannot
1569 Test that a normal file and a largefile with the same name and path cannot
1562 coexist.
1570 coexist.
1563
1571
1564 $ rm sub2/large7
1572 $ rm sub2/large7
1565 $ echo "largeasnormal" > sub2/large7
1573 $ echo "largeasnormal" > sub2/large7
1566 $ hg add sub2/large7
1574 $ hg add sub2/large7
1567 sub2/large7 already a largefile
1575 sub2/large7 already a largefile
1568
1576
1569 Test that transplanting a largefile change works correctly.
1577 Test that transplanting a largefile change works correctly.
1570
1578
1571 $ cd ..
1579 $ cd ..
1572 $ hg clone -r 8 d g
1580 $ hg clone -r 8 d g
1573 adding changesets
1581 adding changesets
1574 adding manifests
1582 adding manifests
1575 adding file changes
1583 adding file changes
1576 added 9 changesets with 26 changes to 10 files
1584 added 9 changesets with 26 changes to 10 files
1577 updating to branch default
1585 updating to branch default
1578 getting changed largefiles
1586 getting changed largefiles
1579 3 largefiles updated, 0 removed
1587 3 largefiles updated, 0 removed
1580 5 files updated, 0 files merged, 0 files removed, 0 files unresolved
1588 5 files updated, 0 files merged, 0 files removed, 0 files unresolved
1581 $ cd g
1589 $ cd g
1582 $ hg transplant -s ../d 598410d3eb9a
1590 $ hg transplant -s ../d 598410d3eb9a
1583 searching for changes
1591 searching for changes
1584 searching for changes
1592 searching for changes
1585 adding changesets
1593 adding changesets
1586 adding manifests
1594 adding manifests
1587 adding file changes
1595 adding file changes
1588 added 1 changesets with 2 changes to 2 files
1596 added 1 changesets with 2 changes to 2 files
1589 getting changed largefiles
1597 getting changed largefiles
1590 1 largefiles updated, 0 removed
1598 1 largefiles updated, 0 removed
1591 $ hg log --template '{rev}:{node|short} {desc|firstline}\n'
1599 $ hg log --template '{rev}:{node|short} {desc|firstline}\n'
1592 9:598410d3eb9a modify normal file largefile in repo d
1600 9:598410d3eb9a modify normal file largefile in repo d
1593 8:a381d2c8c80e modify normal file and largefile in repo b
1601 8:a381d2c8c80e modify normal file and largefile in repo b
1594 7:daea875e9014 add/edit more largefiles
1602 7:daea875e9014 add/edit more largefiles
1595 6:4355d653f84f edit files yet again
1603 6:4355d653f84f edit files yet again
1596 5:9d5af5072dbd edit files again
1604 5:9d5af5072dbd edit files again
1597 4:74c02385b94c move files
1605 4:74c02385b94c move files
1598 3:9e8fbc4bce62 copy files
1606 3:9e8fbc4bce62 copy files
1599 2:51a0ae4d5864 remove files
1607 2:51a0ae4d5864 remove files
1600 1:ce8896473775 edit files
1608 1:ce8896473775 edit files
1601 0:30d30fe6a5be add files
1609 0:30d30fe6a5be add files
1602 $ cat normal3
1610 $ cat normal3
1603 normal3-modified
1611 normal3-modified
1604 $ cat sub/normal4
1612 $ cat sub/normal4
1605 normal4-modified
1613 normal4-modified
1606 $ cat sub/large4
1614 $ cat sub/large4
1607 large4-modified
1615 large4-modified
1608 $ cat sub2/large6
1616 $ cat sub2/large6
1609 large6-modified
1617 large6-modified
1610 $ cat sub2/large7
1618 $ cat sub2/large7
1611 large7
1619 large7
1612
1620
1613 Cat a largefile
1621 Cat a largefile
1614 $ hg cat normal3
1622 $ hg cat normal3
1615 normal3-modified
1623 normal3-modified
1616 $ hg cat sub/large4
1624 $ hg cat sub/large4
1617 large4-modified
1625 large4-modified
1618 $ rm "${USERCACHE}"/*
1626 $ rm "${USERCACHE}"/*
1619 $ hg cat -r a381d2c8c80e -o cat.out sub/large4
1627 $ hg cat -r a381d2c8c80e -o cat.out sub/large4
1620 $ cat cat.out
1628 $ cat cat.out
1621 large4-modified
1629 large4-modified
1622 $ rm cat.out
1630 $ rm cat.out
1623 $ hg cat -r a381d2c8c80e normal3
1631 $ hg cat -r a381d2c8c80e normal3
1624 normal3-modified
1632 normal3-modified
1625 $ hg cat -r '.^' normal3
1633 $ hg cat -r '.^' normal3
1626 normal3-modified
1634 normal3-modified
1627 $ hg cat -r '.^' sub/large4 doesntexist
1635 $ hg cat -r '.^' sub/large4 doesntexist
1628 large4-modified
1636 large4-modified
1629 doesntexist: no such file in rev a381d2c8c80e
1637 doesntexist: no such file in rev a381d2c8c80e
1630 $ hg --cwd sub cat -r '.^' large4
1638 $ hg --cwd sub cat -r '.^' large4
1631 large4-modified
1639 large4-modified
1632 $ hg --cwd sub cat -r '.^' ../normal3
1640 $ hg --cwd sub cat -r '.^' ../normal3
1633 normal3-modified
1641 normal3-modified
1634 Cat a standin
1642 Cat a standin
1635 $ hg cat .hglf/sub/large4
1643 $ hg cat .hglf/sub/large4
1636 e166e74c7303192238d60af5a9c4ce9bef0b7928
1644 e166e74c7303192238d60af5a9c4ce9bef0b7928
1637 $ hg cat .hglf/normal3
1645 $ hg cat .hglf/normal3
1638 .hglf/normal3: no such file in rev 598410d3eb9a
1646 .hglf/normal3: no such file in rev 598410d3eb9a
1639 [1]
1647 [1]
1640
1648
1641 Test that renaming a largefile results in correct output for status
1649 Test that renaming a largefile results in correct output for status
1642
1650
1643 $ hg rename sub/large4 large4-renamed
1651 $ hg rename sub/large4 large4-renamed
1644 $ hg commit -m "test rename output"
1652 $ hg commit -m "test rename output"
1645 Invoking status precommit hook
1653 Invoking status precommit hook
1646 A large4-renamed
1654 A large4-renamed
1647 R sub/large4
1655 R sub/large4
1648 $ cat large4-renamed
1656 $ cat large4-renamed
1649 large4-modified
1657 large4-modified
1650 $ cd sub2
1658 $ cd sub2
1651 $ hg rename large6 large6-renamed
1659 $ hg rename large6 large6-renamed
1652 $ hg st
1660 $ hg st
1653 A sub2/large6-renamed
1661 A sub2/large6-renamed
1654 R sub2/large6
1662 R sub2/large6
1655 $ cd ..
1663 $ cd ..
1656
1664
1657 Test --normal flag
1665 Test --normal flag
1658
1666
1659 $ dd if=/dev/zero bs=2k count=11k > new-largefile 2> /dev/null
1667 $ dd if=/dev/zero bs=2k count=11k > new-largefile 2> /dev/null
1660 $ hg add --normal --large new-largefile
1668 $ hg add --normal --large new-largefile
1661 abort: --normal cannot be used with --large
1669 abort: --normal cannot be used with --large
1662 [255]
1670 [255]
1663 $ hg add --normal new-largefile
1671 $ hg add --normal new-largefile
1664 new-largefile: up to 69 MB of RAM may be required to manage this file
1672 new-largefile: up to 69 MB of RAM may be required to manage this file
1665 (use 'hg revert new-largefile' to cancel the pending addition)
1673 (use 'hg revert new-largefile' to cancel the pending addition)
1666 $ cd ..
1674 $ cd ..
1667
1675
1668 #if serve
1676 #if serve
1669 vanilla clients not locked out from largefiles servers on vanilla repos
1677 vanilla clients not locked out from largefiles servers on vanilla repos
1670 $ mkdir r1
1678 $ mkdir r1
1671 $ cd r1
1679 $ cd r1
1672 $ hg init
1680 $ hg init
1673 $ echo c1 > f1
1681 $ echo c1 > f1
1674 $ hg add f1
1682 $ hg add f1
1675 $ hg commit -m "m1"
1683 $ hg commit -m "m1"
1676 Invoking status precommit hook
1684 Invoking status precommit hook
1677 A f1
1685 A f1
1678 $ cd ..
1686 $ cd ..
1679 $ hg serve -R r1 -d -p $HGPORT --pid-file hg.pid
1687 $ hg serve -R r1 -d -p $HGPORT --pid-file hg.pid
1680 $ cat hg.pid >> $DAEMON_PIDS
1688 $ cat hg.pid >> $DAEMON_PIDS
1681 $ hg --config extensions.largefiles=! clone http://localhost:$HGPORT r2
1689 $ hg --config extensions.largefiles=! clone http://localhost:$HGPORT r2
1682 requesting all changes
1690 requesting all changes
1683 adding changesets
1691 adding changesets
1684 adding manifests
1692 adding manifests
1685 adding file changes
1693 adding file changes
1686 added 1 changesets with 1 changes to 1 files
1694 added 1 changesets with 1 changes to 1 files
1687 updating to branch default
1695 updating to branch default
1688 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1696 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1689
1697
1690 largefiles clients still work with vanilla servers
1698 largefiles clients still work with vanilla servers
1691 $ hg --config extensions.largefiles=! serve -R r1 -d -p $HGPORT1 --pid-file hg.pid
1699 $ hg --config extensions.largefiles=! serve -R r1 -d -p $HGPORT1 --pid-file hg.pid
1692 $ cat hg.pid >> $DAEMON_PIDS
1700 $ cat hg.pid >> $DAEMON_PIDS
1693 $ hg clone http://localhost:$HGPORT1 r3
1701 $ hg clone http://localhost:$HGPORT1 r3
1694 requesting all changes
1702 requesting all changes
1695 adding changesets
1703 adding changesets
1696 adding manifests
1704 adding manifests
1697 adding file changes
1705 adding file changes
1698 added 1 changesets with 1 changes to 1 files
1706 added 1 changesets with 1 changes to 1 files
1699 updating to branch default
1707 updating to branch default
1700 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1708 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1701 #endif
1709 #endif
1702
1710
1703
1711
1704 vanilla clients locked out from largefiles http repos
1712 vanilla clients locked out from largefiles http repos
1705 $ mkdir r4
1713 $ mkdir r4
1706 $ cd r4
1714 $ cd r4
1707 $ hg init
1715 $ hg init
1708 $ echo c1 > f1
1716 $ echo c1 > f1
1709 $ hg add --large f1
1717 $ hg add --large f1
1710 $ hg commit -m "m1"
1718 $ hg commit -m "m1"
1711 Invoking status precommit hook
1719 Invoking status precommit hook
1712 A f1
1720 A f1
1713 $ cd ..
1721 $ cd ..
1714
1722
1715 largefiles can be pushed locally (issue3583)
1723 largefiles can be pushed locally (issue3583)
1716 $ hg init dest
1724 $ hg init dest
1717 $ cd r4
1725 $ cd r4
1718 $ hg outgoing ../dest
1726 $ hg outgoing ../dest
1719 comparing with ../dest
1727 comparing with ../dest
1720 searching for changes
1728 searching for changes
1721 changeset: 0:639881c12b4c
1729 changeset: 0:639881c12b4c
1722 tag: tip
1730 tag: tip
1723 user: test
1731 user: test
1724 date: Thu Jan 01 00:00:00 1970 +0000
1732 date: Thu Jan 01 00:00:00 1970 +0000
1725 summary: m1
1733 summary: m1
1726
1734
1727 $ hg push ../dest
1735 $ hg push ../dest
1728 pushing to ../dest
1736 pushing to ../dest
1729 searching for changes
1737 searching for changes
1730 adding changesets
1738 adding changesets
1731 adding manifests
1739 adding manifests
1732 adding file changes
1740 adding file changes
1733 added 1 changesets with 1 changes to 1 files
1741 added 1 changesets with 1 changes to 1 files
1734
1742
1735 exit code with nothing outgoing (issue3611)
1743 exit code with nothing outgoing (issue3611)
1736 $ hg outgoing ../dest
1744 $ hg outgoing ../dest
1737 comparing with ../dest
1745 comparing with ../dest
1738 searching for changes
1746 searching for changes
1739 no changes found
1747 no changes found
1740 [1]
1748 [1]
1741 $ cd ..
1749 $ cd ..
1742
1750
1743 #if serve
1751 #if serve
1744 $ hg serve -R r4 -d -p $HGPORT2 --pid-file hg.pid
1752 $ hg serve -R r4 -d -p $HGPORT2 --pid-file hg.pid
1745 $ cat hg.pid >> $DAEMON_PIDS
1753 $ cat hg.pid >> $DAEMON_PIDS
1746 $ hg --config extensions.largefiles=! clone http://localhost:$HGPORT2 r5
1754 $ hg --config extensions.largefiles=! clone http://localhost:$HGPORT2 r5
1747 abort: remote error:
1755 abort: remote error:
1748
1756
1749 This repository uses the largefiles extension.
1757 This repository uses the largefiles extension.
1750
1758
1751 Please enable it in your Mercurial config file.
1759 Please enable it in your Mercurial config file.
1752 [255]
1760 [255]
1753
1761
1754 used all HGPORTs, kill all daemons
1762 used all HGPORTs, kill all daemons
1755 $ "$TESTDIR/killdaemons.py" $DAEMON_PIDS
1763 $ "$TESTDIR/killdaemons.py" $DAEMON_PIDS
1756 #endif
1764 #endif
1757
1765
1758 vanilla clients locked out from largefiles ssh repos
1766 vanilla clients locked out from largefiles ssh repos
1759 $ hg --config extensions.largefiles=! clone -e "python \"$TESTDIR/dummyssh\"" ssh://user@dummy/r4 r5
1767 $ hg --config extensions.largefiles=! clone -e "python \"$TESTDIR/dummyssh\"" ssh://user@dummy/r4 r5
1760 abort: remote error:
1768 abort: remote error:
1761
1769
1762 This repository uses the largefiles extension.
1770 This repository uses the largefiles extension.
1763
1771
1764 Please enable it in your Mercurial config file.
1772 Please enable it in your Mercurial config file.
1765 [255]
1773 [255]
1766
1774
1767 #if serve
1775 #if serve
1768
1776
1769 largefiles clients refuse to push largefiles repos to vanilla servers
1777 largefiles clients refuse to push largefiles repos to vanilla servers
1770 $ mkdir r6
1778 $ mkdir r6
1771 $ cd r6
1779 $ cd r6
1772 $ hg init
1780 $ hg init
1773 $ echo c1 > f1
1781 $ echo c1 > f1
1774 $ hg add f1
1782 $ hg add f1
1775 $ hg commit -m "m1"
1783 $ hg commit -m "m1"
1776 Invoking status precommit hook
1784 Invoking status precommit hook
1777 A f1
1785 A f1
1778 $ cat >> .hg/hgrc <<!
1786 $ cat >> .hg/hgrc <<!
1779 > [web]
1787 > [web]
1780 > push_ssl = false
1788 > push_ssl = false
1781 > allow_push = *
1789 > allow_push = *
1782 > !
1790 > !
1783 $ cd ..
1791 $ cd ..
1784 $ hg clone r6 r7
1792 $ hg clone r6 r7
1785 updating to branch default
1793 updating to branch default
1786 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1794 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1787 $ cd r7
1795 $ cd r7
1788 $ echo c2 > f2
1796 $ echo c2 > f2
1789 $ hg add --large f2
1797 $ hg add --large f2
1790 $ hg commit -m "m2"
1798 $ hg commit -m "m2"
1791 Invoking status precommit hook
1799 Invoking status precommit hook
1792 A f2
1800 A f2
1793 $ hg --config extensions.largefiles=! -R ../r6 serve -d -p $HGPORT --pid-file ../hg.pid
1801 $ hg --config extensions.largefiles=! -R ../r6 serve -d -p $HGPORT --pid-file ../hg.pid
1794 $ cat ../hg.pid >> $DAEMON_PIDS
1802 $ cat ../hg.pid >> $DAEMON_PIDS
1795 $ hg push http://localhost:$HGPORT
1803 $ hg push http://localhost:$HGPORT
1796 pushing to http://localhost:$HGPORT/
1804 pushing to http://localhost:$HGPORT/
1797 searching for changes
1805 searching for changes
1798 abort: http://localhost:$HGPORT/ does not appear to be a largefile store
1806 abort: http://localhost:$HGPORT/ does not appear to be a largefile store
1799 [255]
1807 [255]
1800 $ cd ..
1808 $ cd ..
1801
1809
1802 putlfile errors are shown (issue3123)
1810 putlfile errors are shown (issue3123)
1803 Corrupt the cached largefile in r7 and move it out of the servers usercache
1811 Corrupt the cached largefile in r7 and move it out of the servers usercache
1804 $ mv r7/.hg/largefiles/4cdac4d8b084d0b599525cf732437fb337d422a8 .
1812 $ mv r7/.hg/largefiles/4cdac4d8b084d0b599525cf732437fb337d422a8 .
1805 $ echo 'client side corruption' > r7/.hg/largefiles/4cdac4d8b084d0b599525cf732437fb337d422a8
1813 $ echo 'client side corruption' > r7/.hg/largefiles/4cdac4d8b084d0b599525cf732437fb337d422a8
1806 $ rm "$USERCACHE/4cdac4d8b084d0b599525cf732437fb337d422a8"
1814 $ rm "$USERCACHE/4cdac4d8b084d0b599525cf732437fb337d422a8"
1807 $ hg init empty
1815 $ hg init empty
1808 $ hg serve -R empty -d -p $HGPORT1 --pid-file hg.pid \
1816 $ hg serve -R empty -d -p $HGPORT1 --pid-file hg.pid \
1809 > --config 'web.allow_push=*' --config web.push_ssl=False
1817 > --config 'web.allow_push=*' --config web.push_ssl=False
1810 $ cat hg.pid >> $DAEMON_PIDS
1818 $ cat hg.pid >> $DAEMON_PIDS
1811 $ hg push -R r7 http://localhost:$HGPORT1
1819 $ hg push -R r7 http://localhost:$HGPORT1
1812 pushing to http://localhost:$HGPORT1/
1820 pushing to http://localhost:$HGPORT1/
1813 searching for changes
1821 searching for changes
1814 remote: largefiles: failed to put 4cdac4d8b084d0b599525cf732437fb337d422a8 into store: largefile contents do not match hash
1822 remote: largefiles: failed to put 4cdac4d8b084d0b599525cf732437fb337d422a8 into store: largefile contents do not match hash
1815 abort: remotestore: could not put $TESTTMP/r7/.hg/largefiles/4cdac4d8b084d0b599525cf732437fb337d422a8 to remote store http://localhost:$HGPORT1/ (glob)
1823 abort: remotestore: could not put $TESTTMP/r7/.hg/largefiles/4cdac4d8b084d0b599525cf732437fb337d422a8 to remote store http://localhost:$HGPORT1/ (glob)
1816 [255]
1824 [255]
1817 $ mv 4cdac4d8b084d0b599525cf732437fb337d422a8 r7/.hg/largefiles/4cdac4d8b084d0b599525cf732437fb337d422a8
1825 $ mv 4cdac4d8b084d0b599525cf732437fb337d422a8 r7/.hg/largefiles/4cdac4d8b084d0b599525cf732437fb337d422a8
1818 Push of file that exists on server but is corrupted - magic healing would be nice ... but too magic
1826 Push of file that exists on server but is corrupted - magic healing would be nice ... but too magic
1819 $ echo "server side corruption" > empty/.hg/largefiles/4cdac4d8b084d0b599525cf732437fb337d422a8
1827 $ echo "server side corruption" > empty/.hg/largefiles/4cdac4d8b084d0b599525cf732437fb337d422a8
1820 $ hg push -R r7 http://localhost:$HGPORT1
1828 $ hg push -R r7 http://localhost:$HGPORT1
1821 pushing to http://localhost:$HGPORT1/
1829 pushing to http://localhost:$HGPORT1/
1822 searching for changes
1830 searching for changes
1823 remote: adding changesets
1831 remote: adding changesets
1824 remote: adding manifests
1832 remote: adding manifests
1825 remote: adding file changes
1833 remote: adding file changes
1826 remote: added 2 changesets with 2 changes to 2 files
1834 remote: added 2 changesets with 2 changes to 2 files
1827 $ cat empty/.hg/largefiles/4cdac4d8b084d0b599525cf732437fb337d422a8
1835 $ cat empty/.hg/largefiles/4cdac4d8b084d0b599525cf732437fb337d422a8
1828 server side corruption
1836 server side corruption
1829 $ rm -rf empty
1837 $ rm -rf empty
1830
1838
1831 Push a largefiles repository to a served empty repository
1839 Push a largefiles repository to a served empty repository
1832 $ hg init r8
1840 $ hg init r8
1833 $ echo c3 > r8/f1
1841 $ echo c3 > r8/f1
1834 $ hg add --large r8/f1 -R r8
1842 $ hg add --large r8/f1 -R r8
1835 $ hg commit -m "m1" -R r8
1843 $ hg commit -m "m1" -R r8
1836 Invoking status precommit hook
1844 Invoking status precommit hook
1837 A f1
1845 A f1
1838 $ hg init empty
1846 $ hg init empty
1839 $ hg serve -R empty -d -p $HGPORT2 --pid-file hg.pid \
1847 $ hg serve -R empty -d -p $HGPORT2 --pid-file hg.pid \
1840 > --config 'web.allow_push=*' --config web.push_ssl=False
1848 > --config 'web.allow_push=*' --config web.push_ssl=False
1841 $ cat hg.pid >> $DAEMON_PIDS
1849 $ cat hg.pid >> $DAEMON_PIDS
1842 $ rm "${USERCACHE}"/*
1850 $ rm "${USERCACHE}"/*
1843 $ hg push -R r8 http://localhost:$HGPORT2/#default
1851 $ hg push -R r8 http://localhost:$HGPORT2/#default
1844 pushing to http://localhost:$HGPORT2/
1852 pushing to http://localhost:$HGPORT2/
1845 searching for changes
1853 searching for changes
1846 remote: adding changesets
1854 remote: adding changesets
1847 remote: adding manifests
1855 remote: adding manifests
1848 remote: adding file changes
1856 remote: adding file changes
1849 remote: added 1 changesets with 1 changes to 1 files
1857 remote: added 1 changesets with 1 changes to 1 files
1850 $ [ -f "${USERCACHE}"/02a439e5c31c526465ab1a0ca1f431f76b827b90 ]
1858 $ [ -f "${USERCACHE}"/02a439e5c31c526465ab1a0ca1f431f76b827b90 ]
1851 $ [ -f empty/.hg/largefiles/02a439e5c31c526465ab1a0ca1f431f76b827b90 ]
1859 $ [ -f empty/.hg/largefiles/02a439e5c31c526465ab1a0ca1f431f76b827b90 ]
1852
1860
1853 Clone over http, no largefiles pulled on clone.
1861 Clone over http, no largefiles pulled on clone.
1854
1862
1855 $ hg clone http://localhost:$HGPORT2/#default http-clone -U
1863 $ hg clone http://localhost:$HGPORT2/#default http-clone -U
1856 adding changesets
1864 adding changesets
1857 adding manifests
1865 adding manifests
1858 adding file changes
1866 adding file changes
1859 added 1 changesets with 1 changes to 1 files
1867 added 1 changesets with 1 changes to 1 files
1860
1868
1861 test 'verify' with remotestore:
1869 test 'verify' with remotestore:
1862
1870
1863 $ rm "${USERCACHE}"/02a439e5c31c526465ab1a0ca1f431f76b827b90
1871 $ rm "${USERCACHE}"/02a439e5c31c526465ab1a0ca1f431f76b827b90
1864 $ mv empty/.hg/largefiles/02a439e5c31c526465ab1a0ca1f431f76b827b90 .
1872 $ mv empty/.hg/largefiles/02a439e5c31c526465ab1a0ca1f431f76b827b90 .
1865 $ hg -R http-clone verify --large --lfa
1873 $ hg -R http-clone verify --large --lfa
1866 checking changesets
1874 checking changesets
1867 checking manifests
1875 checking manifests
1868 crosschecking files in changesets and manifests
1876 crosschecking files in changesets and manifests
1869 checking files
1877 checking files
1870 1 files, 1 changesets, 1 total revisions
1878 1 files, 1 changesets, 1 total revisions
1871 searching 1 changesets for largefiles
1879 searching 1 changesets for largefiles
1872 changeset 0:cf03e5bb9936: f1 missing
1880 changeset 0:cf03e5bb9936: f1 missing
1873 verified existence of 1 revisions of 1 largefiles
1881 verified existence of 1 revisions of 1 largefiles
1874 [1]
1882 [1]
1875 $ mv 02a439e5c31c526465ab1a0ca1f431f76b827b90 empty/.hg/largefiles/
1883 $ mv 02a439e5c31c526465ab1a0ca1f431f76b827b90 empty/.hg/largefiles/
1876 $ hg -R http-clone -q verify --large --lfa
1884 $ hg -R http-clone -q verify --large --lfa
1877
1885
1878 largefiles pulled on update - a largefile missing on the server:
1886 largefiles pulled on update - a largefile missing on the server:
1879 $ mv empty/.hg/largefiles/02a439e5c31c526465ab1a0ca1f431f76b827b90 .
1887 $ mv empty/.hg/largefiles/02a439e5c31c526465ab1a0ca1f431f76b827b90 .
1880 $ hg -R http-clone up --config largefiles.usercache=http-clone-usercache
1888 $ hg -R http-clone up --config largefiles.usercache=http-clone-usercache
1881 getting changed largefiles
1889 getting changed largefiles
1882 f1: largefile 02a439e5c31c526465ab1a0ca1f431f76b827b90 not available from http://localhost:$HGPORT2/
1890 f1: largefile 02a439e5c31c526465ab1a0ca1f431f76b827b90 not available from http://localhost:$HGPORT2/
1883 0 largefiles updated, 0 removed
1891 0 largefiles updated, 0 removed
1884 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1892 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1885 $ hg -R http-clone st
1893 $ hg -R http-clone st
1886 ! f1
1894 ! f1
1887 $ hg -R http-clone up -Cqr null
1895 $ hg -R http-clone up -Cqr null
1888
1896
1889 largefiles pulled on update - a largefile corrupted on the server:
1897 largefiles pulled on update - a largefile corrupted on the server:
1890 $ echo corruption > empty/.hg/largefiles/02a439e5c31c526465ab1a0ca1f431f76b827b90
1898 $ echo corruption > empty/.hg/largefiles/02a439e5c31c526465ab1a0ca1f431f76b827b90
1891 $ hg -R http-clone up --config largefiles.usercache=http-clone-usercache
1899 $ hg -R http-clone up --config largefiles.usercache=http-clone-usercache
1892 getting changed largefiles
1900 getting changed largefiles
1893 f1: data corruption (expected 02a439e5c31c526465ab1a0ca1f431f76b827b90, got 6a7bb2556144babe3899b25e5428123735bb1e27)
1901 f1: data corruption (expected 02a439e5c31c526465ab1a0ca1f431f76b827b90, got 6a7bb2556144babe3899b25e5428123735bb1e27)
1894 0 largefiles updated, 0 removed
1902 0 largefiles updated, 0 removed
1895 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1903 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1896 $ hg -R http-clone st
1904 $ hg -R http-clone st
1897 ! f1
1905 ! f1
1898 $ [ ! -f http-clone/.hg/largefiles/02a439e5c31c526465ab1a0ca1f431f76b827b90 ]
1906 $ [ ! -f http-clone/.hg/largefiles/02a439e5c31c526465ab1a0ca1f431f76b827b90 ]
1899 $ [ ! -f http-clone/f1 ]
1907 $ [ ! -f http-clone/f1 ]
1900 $ [ ! -f http-clone-usercache ]
1908 $ [ ! -f http-clone-usercache ]
1901 $ hg -R http-clone verify --large --lfc
1909 $ hg -R http-clone verify --large --lfc
1902 checking changesets
1910 checking changesets
1903 checking manifests
1911 checking manifests
1904 crosschecking files in changesets and manifests
1912 crosschecking files in changesets and manifests
1905 checking files
1913 checking files
1906 1 files, 1 changesets, 1 total revisions
1914 1 files, 1 changesets, 1 total revisions
1907 searching 1 changesets for largefiles
1915 searching 1 changesets for largefiles
1908 verified contents of 1 revisions of 1 largefiles
1916 verified contents of 1 revisions of 1 largefiles
1909 $ hg -R http-clone up -Cqr null
1917 $ hg -R http-clone up -Cqr null
1910
1918
1911 largefiles pulled on update - no server side problems:
1919 largefiles pulled on update - no server side problems:
1912 $ mv 02a439e5c31c526465ab1a0ca1f431f76b827b90 empty/.hg/largefiles/
1920 $ mv 02a439e5c31c526465ab1a0ca1f431f76b827b90 empty/.hg/largefiles/
1913 $ hg -R http-clone --debug up --config largefiles.usercache=http-clone-usercache
1921 $ hg -R http-clone --debug up --config largefiles.usercache=http-clone-usercache
1914 resolving manifests
1922 resolving manifests
1915 branchmerge: False, force: False, partial: False
1923 branchmerge: False, force: False, partial: False
1916 ancestor: 000000000000, local: 000000000000+, remote: cf03e5bb9936
1924 ancestor: 000000000000, local: 000000000000+, remote: cf03e5bb9936
1917 .hglf/f1: remote created -> g
1925 .hglf/f1: remote created -> g
1918 getting .hglf/f1
1926 getting .hglf/f1
1919 updating: .hglf/f1 1/1 files (100.00%)
1927 updating: .hglf/f1 1/1 files (100.00%)
1920 getting changed largefiles
1928 getting changed largefiles
1921 using http://localhost:$HGPORT2/
1929 using http://localhost:$HGPORT2/
1922 sending capabilities command
1930 sending capabilities command
1923 sending batch command
1931 sending batch command
1924 getting largefiles: 0/1 lfile (0.00%)
1932 getting largefiles: 0/1 lfile (0.00%)
1925 getting f1:02a439e5c31c526465ab1a0ca1f431f76b827b90
1933 getting f1:02a439e5c31c526465ab1a0ca1f431f76b827b90
1926 sending getlfile command
1934 sending getlfile command
1927 found 02a439e5c31c526465ab1a0ca1f431f76b827b90 in store
1935 found 02a439e5c31c526465ab1a0ca1f431f76b827b90 in store
1928 1 largefiles updated, 0 removed
1936 1 largefiles updated, 0 removed
1929 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1937 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1930
1938
1931 $ ls http-clone-usercache/*
1939 $ ls http-clone-usercache/*
1932 http-clone-usercache/02a439e5c31c526465ab1a0ca1f431f76b827b90
1940 http-clone-usercache/02a439e5c31c526465ab1a0ca1f431f76b827b90
1933
1941
1934 $ rm -rf empty http-clone*
1942 $ rm -rf empty http-clone*
1935
1943
1936 used all HGPORTs, kill all daemons
1944 used all HGPORTs, kill all daemons
1937 $ "$TESTDIR/killdaemons.py" $DAEMON_PIDS
1945 $ "$TESTDIR/killdaemons.py" $DAEMON_PIDS
1938
1946
1939 #endif
1947 #endif
1940
1948
1941
1949
1942 #if unix-permissions
1950 #if unix-permissions
1943
1951
1944 Clone a local repository owned by another user
1952 Clone a local repository owned by another user
1945 We have to simulate that here by setting $HOME and removing write permissions
1953 We have to simulate that here by setting $HOME and removing write permissions
1946 $ ORIGHOME="$HOME"
1954 $ ORIGHOME="$HOME"
1947 $ mkdir alice
1955 $ mkdir alice
1948 $ HOME="`pwd`/alice"
1956 $ HOME="`pwd`/alice"
1949 $ cd alice
1957 $ cd alice
1950 $ hg init pubrepo
1958 $ hg init pubrepo
1951 $ cd pubrepo
1959 $ cd pubrepo
1952 $ dd if=/dev/zero bs=1k count=11k > a-large-file 2> /dev/null
1960 $ dd if=/dev/zero bs=1k count=11k > a-large-file 2> /dev/null
1953 $ hg add --large a-large-file
1961 $ hg add --large a-large-file
1954 $ hg commit -m "Add a large file"
1962 $ hg commit -m "Add a large file"
1955 Invoking status precommit hook
1963 Invoking status precommit hook
1956 A a-large-file
1964 A a-large-file
1957 $ cd ..
1965 $ cd ..
1958 $ chmod -R a-w pubrepo
1966 $ chmod -R a-w pubrepo
1959 $ cd ..
1967 $ cd ..
1960 $ mkdir bob
1968 $ mkdir bob
1961 $ HOME="`pwd`/bob"
1969 $ HOME="`pwd`/bob"
1962 $ cd bob
1970 $ cd bob
1963 $ hg clone --pull ../alice/pubrepo pubrepo
1971 $ hg clone --pull ../alice/pubrepo pubrepo
1964 requesting all changes
1972 requesting all changes
1965 adding changesets
1973 adding changesets
1966 adding manifests
1974 adding manifests
1967 adding file changes
1975 adding file changes
1968 added 1 changesets with 1 changes to 1 files
1976 added 1 changesets with 1 changes to 1 files
1969 updating to branch default
1977 updating to branch default
1970 getting changed largefiles
1978 getting changed largefiles
1971 1 largefiles updated, 0 removed
1979 1 largefiles updated, 0 removed
1972 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1980 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1973 $ cd ..
1981 $ cd ..
1974 $ chmod -R u+w alice/pubrepo
1982 $ chmod -R u+w alice/pubrepo
1975 $ HOME="$ORIGHOME"
1983 $ HOME="$ORIGHOME"
1976
1984
1977 #endif
1985 #endif
1978
1986
1979 #if symlink
1987 #if symlink
1980
1988
1981 Symlink to a large largefile should behave the same as a symlink to a normal file
1989 Symlink to a large largefile should behave the same as a symlink to a normal file
1982 $ hg init largesymlink
1990 $ hg init largesymlink
1983 $ cd largesymlink
1991 $ cd largesymlink
1984 $ dd if=/dev/zero bs=1k count=10k of=largefile 2>/dev/null
1992 $ dd if=/dev/zero bs=1k count=10k of=largefile 2>/dev/null
1985 $ hg add --large largefile
1993 $ hg add --large largefile
1986 $ hg commit -m "commit a large file"
1994 $ hg commit -m "commit a large file"
1987 Invoking status precommit hook
1995 Invoking status precommit hook
1988 A largefile
1996 A largefile
1989 $ ln -s largefile largelink
1997 $ ln -s largefile largelink
1990 $ hg add largelink
1998 $ hg add largelink
1991 $ hg commit -m "commit a large symlink"
1999 $ hg commit -m "commit a large symlink"
1992 Invoking status precommit hook
2000 Invoking status precommit hook
1993 A largelink
2001 A largelink
1994 $ rm -f largelink
2002 $ rm -f largelink
1995 $ hg up >/dev/null
2003 $ hg up >/dev/null
1996 $ test -f largelink
2004 $ test -f largelink
1997 [1]
2005 [1]
1998 $ test -L largelink
2006 $ test -L largelink
1999 [1]
2007 [1]
2000 $ rm -f largelink # make next part of the test independent of the previous
2008 $ rm -f largelink # make next part of the test independent of the previous
2001 $ hg up -C >/dev/null
2009 $ hg up -C >/dev/null
2002 $ test -f largelink
2010 $ test -f largelink
2003 $ test -L largelink
2011 $ test -L largelink
2004 $ cd ..
2012 $ cd ..
2005
2013
2006 #endif
2014 #endif
2007
2015
2008 test for pattern matching on 'hg status':
2016 test for pattern matching on 'hg status':
2009 to boost performance, largefiles checks whether specified patterns are
2017 to boost performance, largefiles checks whether specified patterns are
2010 related to largefiles in working directory (NOT to STANDIN) or not.
2018 related to largefiles in working directory (NOT to STANDIN) or not.
2011
2019
2012 $ hg init statusmatch
2020 $ hg init statusmatch
2013 $ cd statusmatch
2021 $ cd statusmatch
2014
2022
2015 $ mkdir -p a/b/c/d
2023 $ mkdir -p a/b/c/d
2016 $ echo normal > a/b/c/d/e.normal.txt
2024 $ echo normal > a/b/c/d/e.normal.txt
2017 $ hg add a/b/c/d/e.normal.txt
2025 $ hg add a/b/c/d/e.normal.txt
2018 $ echo large > a/b/c/d/e.large.txt
2026 $ echo large > a/b/c/d/e.large.txt
2019 $ hg add --large a/b/c/d/e.large.txt
2027 $ hg add --large a/b/c/d/e.large.txt
2020 $ mkdir -p a/b/c/x
2028 $ mkdir -p a/b/c/x
2021 $ echo normal > a/b/c/x/y.normal.txt
2029 $ echo normal > a/b/c/x/y.normal.txt
2022 $ hg add a/b/c/x/y.normal.txt
2030 $ hg add a/b/c/x/y.normal.txt
2023 $ hg commit -m 'add files'
2031 $ hg commit -m 'add files'
2024 Invoking status precommit hook
2032 Invoking status precommit hook
2025 A a/b/c/d/e.large.txt
2033 A a/b/c/d/e.large.txt
2026 A a/b/c/d/e.normal.txt
2034 A a/b/c/d/e.normal.txt
2027 A a/b/c/x/y.normal.txt
2035 A a/b/c/x/y.normal.txt
2028
2036
2029 (1) no pattern: no performance boost
2037 (1) no pattern: no performance boost
2030 $ hg status -A
2038 $ hg status -A
2031 C a/b/c/d/e.large.txt
2039 C a/b/c/d/e.large.txt
2032 C a/b/c/d/e.normal.txt
2040 C a/b/c/d/e.normal.txt
2033 C a/b/c/x/y.normal.txt
2041 C a/b/c/x/y.normal.txt
2034
2042
2035 (2) pattern not related to largefiles: performance boost
2043 (2) pattern not related to largefiles: performance boost
2036 $ hg status -A a/b/c/x
2044 $ hg status -A a/b/c/x
2037 C a/b/c/x/y.normal.txt
2045 C a/b/c/x/y.normal.txt
2038
2046
2039 (3) pattern related to largefiles: no performance boost
2047 (3) pattern related to largefiles: no performance boost
2040 $ hg status -A a/b/c/d
2048 $ hg status -A a/b/c/d
2041 C a/b/c/d/e.large.txt
2049 C a/b/c/d/e.large.txt
2042 C a/b/c/d/e.normal.txt
2050 C a/b/c/d/e.normal.txt
2043
2051
2044 (4) pattern related to STANDIN (not to largefiles): performance boost
2052 (4) pattern related to STANDIN (not to largefiles): performance boost
2045 $ hg status -A .hglf/a
2053 $ hg status -A .hglf/a
2046 C .hglf/a/b/c/d/e.large.txt
2054 C .hglf/a/b/c/d/e.large.txt
2047
2055
2048 (5) mixed case: no performance boost
2056 (5) mixed case: no performance boost
2049 $ hg status -A a/b/c/x a/b/c/d
2057 $ hg status -A a/b/c/x a/b/c/d
2050 C a/b/c/d/e.large.txt
2058 C a/b/c/d/e.large.txt
2051 C a/b/c/d/e.normal.txt
2059 C a/b/c/d/e.normal.txt
2052 C a/b/c/x/y.normal.txt
2060 C a/b/c/x/y.normal.txt
2053
2061
2054 verify that largefiles doesn't break filesets
2062 verify that largefiles doesn't break filesets
2055
2063
2056 $ hg log --rev . --exclude "set:binary()"
2064 $ hg log --rev . --exclude "set:binary()"
2057 changeset: 0:41bd42f10efa
2065 changeset: 0:41bd42f10efa
2058 tag: tip
2066 tag: tip
2059 user: test
2067 user: test
2060 date: Thu Jan 01 00:00:00 1970 +0000
2068 date: Thu Jan 01 00:00:00 1970 +0000
2061 summary: add files
2069 summary: add files
2062
2070
2063 verify that large files in subrepos handled properly
2071 verify that large files in subrepos handled properly
2064 $ hg init subrepo
2072 $ hg init subrepo
2065 $ echo "subrepo = subrepo" > .hgsub
2073 $ echo "subrepo = subrepo" > .hgsub
2066 $ hg add .hgsub
2074 $ hg add .hgsub
2067 $ hg ci -m "add subrepo"
2075 $ hg ci -m "add subrepo"
2068 Invoking status precommit hook
2076 Invoking status precommit hook
2069 A .hgsub
2077 A .hgsub
2070 ? .hgsubstate
2078 ? .hgsubstate
2071 $ echo "rev 1" > subrepo/large.txt
2079 $ echo "rev 1" > subrepo/large.txt
2072 $ hg -R subrepo add --large subrepo/large.txt
2080 $ hg -R subrepo add --large subrepo/large.txt
2073 $ hg sum
2081 $ hg sum
2074 parent: 1:8ee150ea2e9c tip
2082 parent: 1:8ee150ea2e9c tip
2075 add subrepo
2083 add subrepo
2076 branch: default
2084 branch: default
2077 commit: 1 subrepos
2085 commit: 1 subrepos
2078 update: (current)
2086 update: (current)
2079 $ hg st
2087 $ hg st
2080 $ hg st -S
2088 $ hg st -S
2081 A subrepo/large.txt
2089 A subrepo/large.txt
2082 $ hg ci -S -m "commit top repo"
2090 $ hg ci -S -m "commit top repo"
2083 committing subrepository subrepo
2091 committing subrepository subrepo
2084 Invoking status precommit hook
2092 Invoking status precommit hook
2085 A large.txt
2093 A large.txt
2086 Invoking status precommit hook
2094 Invoking status precommit hook
2087 M .hgsubstate
2095 M .hgsubstate
2088 # No differences
2096 # No differences
2089 $ hg st -S
2097 $ hg st -S
2090 $ hg sum
2098 $ hg sum
2091 parent: 2:ce4cd0c527a6 tip
2099 parent: 2:ce4cd0c527a6 tip
2092 commit top repo
2100 commit top repo
2093 branch: default
2101 branch: default
2094 commit: (clean)
2102 commit: (clean)
2095 update: (current)
2103 update: (current)
2096 $ echo "rev 2" > subrepo/large.txt
2104 $ echo "rev 2" > subrepo/large.txt
2097 $ hg st -S
2105 $ hg st -S
2098 M subrepo/large.txt
2106 M subrepo/large.txt
2099 $ hg sum
2107 $ hg sum
2100 parent: 2:ce4cd0c527a6 tip
2108 parent: 2:ce4cd0c527a6 tip
2101 commit top repo
2109 commit top repo
2102 branch: default
2110 branch: default
2103 commit: 1 subrepos
2111 commit: 1 subrepos
2104 update: (current)
2112 update: (current)
2105 $ hg ci -m "this commit should fail without -S"
2113 $ hg ci -m "this commit should fail without -S"
2106 abort: uncommitted changes in subrepo subrepo
2114 abort: uncommitted changes in subrepo subrepo
2107 (use --subrepos for recursive commit)
2115 (use --subrepos for recursive commit)
2108 [255]
2116 [255]
2109
2117
2110 Add a normal file to the subrepo, then test archiving
2118 Add a normal file to the subrepo, then test archiving
2111
2119
2112 $ echo 'normal file' > subrepo/normal.txt
2120 $ echo 'normal file' > subrepo/normal.txt
2113 $ hg -R subrepo add subrepo/normal.txt
2121 $ hg -R subrepo add subrepo/normal.txt
2114
2122
2115 Lock in subrepo, otherwise the change isn't archived
2123 Lock in subrepo, otherwise the change isn't archived
2116
2124
2117 $ hg ci -S -m "add normal file to top level"
2125 $ hg ci -S -m "add normal file to top level"
2118 committing subrepository subrepo
2126 committing subrepository subrepo
2119 Invoking status precommit hook
2127 Invoking status precommit hook
2120 M large.txt
2128 M large.txt
2121 A normal.txt
2129 A normal.txt
2122 Invoking status precommit hook
2130 Invoking status precommit hook
2123 M .hgsubstate
2131 M .hgsubstate
2124 $ hg archive -S ../lf_subrepo_archive
2132 $ hg archive -S ../lf_subrepo_archive
2125 $ find ../lf_subrepo_archive | sort
2133 $ find ../lf_subrepo_archive | sort
2126 ../lf_subrepo_archive
2134 ../lf_subrepo_archive
2127 ../lf_subrepo_archive/.hg_archival.txt
2135 ../lf_subrepo_archive/.hg_archival.txt
2128 ../lf_subrepo_archive/.hgsub
2136 ../lf_subrepo_archive/.hgsub
2129 ../lf_subrepo_archive/.hgsubstate
2137 ../lf_subrepo_archive/.hgsubstate
2130 ../lf_subrepo_archive/a
2138 ../lf_subrepo_archive/a
2131 ../lf_subrepo_archive/a/b
2139 ../lf_subrepo_archive/a/b
2132 ../lf_subrepo_archive/a/b/c
2140 ../lf_subrepo_archive/a/b/c
2133 ../lf_subrepo_archive/a/b/c/d
2141 ../lf_subrepo_archive/a/b/c/d
2134 ../lf_subrepo_archive/a/b/c/d/e.large.txt
2142 ../lf_subrepo_archive/a/b/c/d/e.large.txt
2135 ../lf_subrepo_archive/a/b/c/d/e.normal.txt
2143 ../lf_subrepo_archive/a/b/c/d/e.normal.txt
2136 ../lf_subrepo_archive/a/b/c/x
2144 ../lf_subrepo_archive/a/b/c/x
2137 ../lf_subrepo_archive/a/b/c/x/y.normal.txt
2145 ../lf_subrepo_archive/a/b/c/x/y.normal.txt
2138 ../lf_subrepo_archive/subrepo
2146 ../lf_subrepo_archive/subrepo
2139 ../lf_subrepo_archive/subrepo/large.txt
2147 ../lf_subrepo_archive/subrepo/large.txt
2140 ../lf_subrepo_archive/subrepo/normal.txt
2148 ../lf_subrepo_archive/subrepo/normal.txt
2141
2149
2142 Test update with subrepos.
2150 Test update with subrepos.
2143
2151
2144 $ hg update 0
2152 $ hg update 0
2145 getting changed largefiles
2153 getting changed largefiles
2146 0 largefiles updated, 1 removed
2154 0 largefiles updated, 1 removed
2147 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
2155 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
2148 $ hg status -S
2156 $ hg status -S
2149 $ hg update tip
2157 $ hg update tip
2150 getting changed largefiles
2158 getting changed largefiles
2151 1 largefiles updated, 0 removed
2159 1 largefiles updated, 0 removed
2152 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
2160 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
2153 $ hg status -S
2161 $ hg status -S
2154 # modify a large file
2162 # modify a large file
2155 $ echo "modified" > subrepo/large.txt
2163 $ echo "modified" > subrepo/large.txt
2156 $ hg st -S
2164 $ hg st -S
2157 M subrepo/large.txt
2165 M subrepo/large.txt
2158 # update -C should revert the change.
2166 # update -C should revert the change.
2159 $ hg update -C
2167 $ hg update -C
2160 getting changed largefiles
2168 getting changed largefiles
2161 1 largefiles updated, 0 removed
2169 1 largefiles updated, 0 removed
2162 getting changed largefiles
2170 getting changed largefiles
2163 0 largefiles updated, 0 removed
2171 0 largefiles updated, 0 removed
2164 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
2172 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
2165 $ hg status -S
2173 $ hg status -S
2166
2174
2167 Test archiving a revision that references a subrepo that is not yet
2175 Test archiving a revision that references a subrepo that is not yet
2168 cloned (see test-subrepo-recursion.t):
2176 cloned (see test-subrepo-recursion.t):
2169
2177
2170 $ hg clone -U . ../empty
2178 $ hg clone -U . ../empty
2171 $ cd ../empty
2179 $ cd ../empty
2172 $ hg archive --subrepos -r tip ../archive.tar.gz
2180 $ hg archive --subrepos -r tip ../archive.tar.gz
2173 cloning subrepo subrepo from $TESTTMP/statusmatch/subrepo
2181 cloning subrepo subrepo from $TESTTMP/statusmatch/subrepo
2174 $ cd ..
2182 $ cd ..
2175
2183
2176 Test that addremove picks up largefiles prior to the initial commit (issue3541)
2184 Test that addremove picks up largefiles prior to the initial commit (issue3541)
2177
2185
2178 $ hg init addrm2
2186 $ hg init addrm2
2179 $ cd addrm2
2187 $ cd addrm2
2180 $ touch large.dat
2188 $ touch large.dat
2181 $ touch large2.dat
2189 $ touch large2.dat
2182 $ touch normal
2190 $ touch normal
2183 $ hg add --large large.dat
2191 $ hg add --large large.dat
2184 $ hg addremove -v
2192 $ hg addremove -v
2185 adding large2.dat as a largefile
2193 adding large2.dat as a largefile
2186 adding normal
2194 adding normal
2187
2195
2188 Test that forgetting all largefiles reverts to islfilesrepo() == False
2196 Test that forgetting all largefiles reverts to islfilesrepo() == False
2189 (addremove will add *.dat as normal files now)
2197 (addremove will add *.dat as normal files now)
2190 $ hg forget large.dat
2198 $ hg forget large.dat
2191 $ hg forget large2.dat
2199 $ hg forget large2.dat
2192 $ hg addremove -v
2200 $ hg addremove -v
2193 adding large.dat
2201 adding large.dat
2194 adding large2.dat
2202 adding large2.dat
2195
2203
2196 Test commit's addremove option prior to the first commit
2204 Test commit's addremove option prior to the first commit
2197 $ hg forget large.dat
2205 $ hg forget large.dat
2198 $ hg forget large2.dat
2206 $ hg forget large2.dat
2199 $ hg add --large large.dat
2207 $ hg add --large large.dat
2200 $ hg ci -Am "commit"
2208 $ hg ci -Am "commit"
2201 adding large2.dat as a largefile
2209 adding large2.dat as a largefile
2202 Invoking status precommit hook
2210 Invoking status precommit hook
2203 A large.dat
2211 A large.dat
2204 A large2.dat
2212 A large2.dat
2205 A normal
2213 A normal
2206 $ find .hglf | sort
2214 $ find .hglf | sort
2207 .hglf
2215 .hglf
2208 .hglf/large.dat
2216 .hglf/large.dat
2209 .hglf/large2.dat
2217 .hglf/large2.dat
2210
2218
2211 Test actions on largefiles using relative paths from subdir
2219 Test actions on largefiles using relative paths from subdir
2212
2220
2213 $ mkdir sub
2221 $ mkdir sub
2214 $ cd sub
2222 $ cd sub
2215 $ echo anotherlarge > anotherlarge
2223 $ echo anotherlarge > anotherlarge
2216 $ hg add --large anotherlarge
2224 $ hg add --large anotherlarge
2217 $ hg st
2225 $ hg st
2218 A sub/anotherlarge
2226 A sub/anotherlarge
2219 $ hg st anotherlarge
2227 $ hg st anotherlarge
2220 A anotherlarge
2228 A anotherlarge
2221 $ hg commit -m anotherlarge anotherlarge
2229 $ hg commit -m anotherlarge anotherlarge
2222 Invoking status precommit hook
2230 Invoking status precommit hook
2223 A sub/anotherlarge
2231 A sub/anotherlarge
2224 $ hg log anotherlarge
2232 $ hg log anotherlarge
2225 changeset: 1:9627a577c5e9
2233 changeset: 1:9627a577c5e9
2226 tag: tip
2234 tag: tip
2227 user: test
2235 user: test
2228 date: Thu Jan 01 00:00:00 1970 +0000
2236 date: Thu Jan 01 00:00:00 1970 +0000
2229 summary: anotherlarge
2237 summary: anotherlarge
2230
2238
2231 $ hg log -G anotherlarge
2239 $ hg log -G anotherlarge
2232 @ changeset: 1:9627a577c5e9
2240 @ changeset: 1:9627a577c5e9
2233 | tag: tip
2241 | tag: tip
2234 | user: test
2242 | user: test
2235 | date: Thu Jan 01 00:00:00 1970 +0000
2243 | date: Thu Jan 01 00:00:00 1970 +0000
2236 | summary: anotherlarge
2244 | summary: anotherlarge
2237 |
2245 |
2238 $ echo more >> anotherlarge
2246 $ echo more >> anotherlarge
2239 $ hg st .
2247 $ hg st .
2240 M anotherlarge
2248 M anotherlarge
2241 $ hg cat anotherlarge
2249 $ hg cat anotherlarge
2242 anotherlarge
2250 anotherlarge
2243 $ hg revert anotherlarge
2251 $ hg revert anotherlarge
2244 $ hg st
2252 $ hg st
2245 ? sub/anotherlarge.orig
2253 ? sub/anotherlarge.orig
2246 $ cd ..
2254 $ cd ..
2247
2255
2248 $ cd ..
2256 $ cd ..
2249
2257
2250 issue3651: summary/outgoing with largefiles shows "no remote repo"
2258 issue3651: summary/outgoing with largefiles shows "no remote repo"
2251 unexpectedly
2259 unexpectedly
2252
2260
2253 $ mkdir issue3651
2261 $ mkdir issue3651
2254 $ cd issue3651
2262 $ cd issue3651
2255
2263
2256 $ hg init src
2264 $ hg init src
2257 $ echo a > src/a
2265 $ echo a > src/a
2258 $ hg -R src add --large src/a
2266 $ hg -R src add --large src/a
2259 $ hg -R src commit -m '#0'
2267 $ hg -R src commit -m '#0'
2260 Invoking status precommit hook
2268 Invoking status precommit hook
2261 A a
2269 A a
2262
2270
2263 check messages when no remote repository is specified:
2271 check messages when no remote repository is specified:
2264 "no remote repo" route for "hg outgoing --large" is not tested here,
2272 "no remote repo" route for "hg outgoing --large" is not tested here,
2265 because it can't be reproduced easily.
2273 because it can't be reproduced easily.
2266
2274
2267 $ hg init clone1
2275 $ hg init clone1
2268 $ hg -R clone1 -q pull src
2276 $ hg -R clone1 -q pull src
2269 $ hg -R clone1 -q update
2277 $ hg -R clone1 -q update
2270 $ hg -R clone1 paths | grep default
2278 $ hg -R clone1 paths | grep default
2271 [1]
2279 [1]
2272
2280
2273 $ hg -R clone1 summary --large
2281 $ hg -R clone1 summary --large
2274 parent: 0:fc0bd45326d3 tip
2282 parent: 0:fc0bd45326d3 tip
2275 #0
2283 #0
2276 branch: default
2284 branch: default
2277 commit: (clean)
2285 commit: (clean)
2278 update: (current)
2286 update: (current)
2279 largefiles: (no remote repo)
2287 largefiles: (no remote repo)
2280
2288
2281 check messages when there is no files to upload:
2289 check messages when there is no files to upload:
2282
2290
2283 $ hg -q clone src clone2
2291 $ hg -q clone src clone2
2284 $ hg -R clone2 paths | grep default
2292 $ hg -R clone2 paths | grep default
2285 default = $TESTTMP/issue3651/src (glob)
2293 default = $TESTTMP/issue3651/src (glob)
2286
2294
2287 $ hg -R clone2 summary --large
2295 $ hg -R clone2 summary --large
2288 parent: 0:fc0bd45326d3 tip
2296 parent: 0:fc0bd45326d3 tip
2289 #0
2297 #0
2290 branch: default
2298 branch: default
2291 commit: (clean)
2299 commit: (clean)
2292 update: (current)
2300 update: (current)
2293 largefiles: (no files to upload)
2301 largefiles: (no files to upload)
2294 $ hg -R clone2 outgoing --large
2302 $ hg -R clone2 outgoing --large
2295 comparing with $TESTTMP/issue3651/src (glob)
2303 comparing with $TESTTMP/issue3651/src (glob)
2296 searching for changes
2304 searching for changes
2297 no changes found
2305 no changes found
2298 largefiles: no files to upload
2306 largefiles: no files to upload
2299 [1]
2307 [1]
2300
2308
2301 $ hg -R clone2 outgoing --large --graph --template "{rev}"
2309 $ hg -R clone2 outgoing --large --graph --template "{rev}"
2302 comparing with $TESTTMP/issue3651/src (glob)
2310 comparing with $TESTTMP/issue3651/src (glob)
2303 searching for changes
2311 searching for changes
2304 no changes found
2312 no changes found
2305 largefiles: no files to upload
2313 largefiles: no files to upload
2306
2314
2307 check messages when there are files to upload:
2315 check messages when there are files to upload:
2308
2316
2309 $ echo b > clone2/b
2317 $ echo b > clone2/b
2310 $ hg -R clone2 add --large clone2/b
2318 $ hg -R clone2 add --large clone2/b
2311 $ hg -R clone2 commit -m '#1'
2319 $ hg -R clone2 commit -m '#1'
2312 Invoking status precommit hook
2320 Invoking status precommit hook
2313 A b
2321 A b
2314 $ hg -R clone2 summary --large
2322 $ hg -R clone2 summary --large
2315 parent: 1:1acbe71ce432 tip
2323 parent: 1:1acbe71ce432 tip
2316 #1
2324 #1
2317 branch: default
2325 branch: default
2318 commit: (clean)
2326 commit: (clean)
2319 update: (current)
2327 update: (current)
2320 largefiles: 1 to upload
2328 largefiles: 1 to upload
2321 $ hg -R clone2 outgoing --large
2329 $ hg -R clone2 outgoing --large
2322 comparing with $TESTTMP/issue3651/src (glob)
2330 comparing with $TESTTMP/issue3651/src (glob)
2323 searching for changes
2331 searching for changes
2324 changeset: 1:1acbe71ce432
2332 changeset: 1:1acbe71ce432
2325 tag: tip
2333 tag: tip
2326 user: test
2334 user: test
2327 date: Thu Jan 01 00:00:00 1970 +0000
2335 date: Thu Jan 01 00:00:00 1970 +0000
2328 summary: #1
2336 summary: #1
2329
2337
2330 largefiles to upload:
2338 largefiles to upload:
2331 b
2339 b
2332
2340
2333 $ hg -R clone2 outgoing --large --graph --template "{rev}"
2341 $ hg -R clone2 outgoing --large --graph --template "{rev}"
2334 comparing with $TESTTMP/issue3651/src
2342 comparing with $TESTTMP/issue3651/src
2335 searching for changes
2343 searching for changes
2336 @ 1
2344 @ 1
2337
2345
2338 largefiles to upload:
2346 largefiles to upload:
2339 b
2347 b
2340
2348
2341
2349
2342 $ cd ..
2350 $ cd ..
2343
2351
2344 merge action 'd' for 'local renamed directory to d2/g' which has no filename
2352 merge action 'd' for 'local renamed directory to d2/g' which has no filename
2345
2353
2346 $ hg init merge-action
2354 $ hg init merge-action
2347 $ cd merge-action
2355 $ cd merge-action
2348 $ touch l
2356 $ touch l
2349 $ hg add --large l
2357 $ hg add --large l
2350 $ mkdir d1
2358 $ mkdir d1
2351 $ touch d1/f
2359 $ touch d1/f
2352 $ hg ci -Aqm0
2360 $ hg ci -Aqm0
2353 Invoking status precommit hook
2361 Invoking status precommit hook
2354 A d1/f
2362 A d1/f
2355 A l
2363 A l
2356 $ echo > d1/f
2364 $ echo > d1/f
2357 $ touch d1/g
2365 $ touch d1/g
2358 $ hg ci -Aqm1
2366 $ hg ci -Aqm1
2359 Invoking status precommit hook
2367 Invoking status precommit hook
2360 M d1/f
2368 M d1/f
2361 A d1/g
2369 A d1/g
2362 $ hg up -qr0
2370 $ hg up -qr0
2363 $ hg mv d1 d2
2371 $ hg mv d1 d2
2364 moving d1/f to d2/f (glob)
2372 moving d1/f to d2/f (glob)
2365 $ hg ci -qm2
2373 $ hg ci -qm2
2366 Invoking status precommit hook
2374 Invoking status precommit hook
2367 A d2/f
2375 A d2/f
2368 R d1/f
2376 R d1/f
2369 $ hg merge
2377 $ hg merge
2370 merging d2/f and d1/f to d2/f
2378 merging d2/f and d1/f to d2/f
2371 1 files updated, 1 files merged, 0 files removed, 0 files unresolved
2379 1 files updated, 1 files merged, 0 files removed, 0 files unresolved
2372 (branch merge, don't forget to commit)
2380 (branch merge, don't forget to commit)
2373 getting changed largefiles
2381 getting changed largefiles
2374 0 largefiles updated, 0 removed
2382 0 largefiles updated, 0 removed
2375 $ cd ..
2383 $ cd ..
2376
2384
2377
2385
2378 Merge conflicts:
2386 Merge conflicts:
2379
2387
2380 $ hg init merge
2388 $ hg init merge
2381 $ cd merge
2389 $ cd merge
2382 $ echo 0 > f-different
2390 $ echo 0 > f-different
2383 $ echo 0 > f-same
2391 $ echo 0 > f-same
2384 $ echo 0 > f-unchanged-1
2392 $ echo 0 > f-unchanged-1
2385 $ echo 0 > f-unchanged-2
2393 $ echo 0 > f-unchanged-2
2386 $ hg add --large *
2394 $ hg add --large *
2387 $ hg ci -m0
2395 $ hg ci -m0
2388 Invoking status precommit hook
2396 Invoking status precommit hook
2389 A f-different
2397 A f-different
2390 A f-same
2398 A f-same
2391 A f-unchanged-1
2399 A f-unchanged-1
2392 A f-unchanged-2
2400 A f-unchanged-2
2393 $ echo tmp1 > f-unchanged-1
2401 $ echo tmp1 > f-unchanged-1
2394 $ echo tmp1 > f-unchanged-2
2402 $ echo tmp1 > f-unchanged-2
2395 $ echo tmp1 > f-same
2403 $ echo tmp1 > f-same
2396 $ hg ci -m1
2404 $ hg ci -m1
2397 Invoking status precommit hook
2405 Invoking status precommit hook
2398 M f-same
2406 M f-same
2399 M f-unchanged-1
2407 M f-unchanged-1
2400 M f-unchanged-2
2408 M f-unchanged-2
2401 $ echo 2 > f-different
2409 $ echo 2 > f-different
2402 $ echo 0 > f-unchanged-1
2410 $ echo 0 > f-unchanged-1
2403 $ echo 1 > f-unchanged-2
2411 $ echo 1 > f-unchanged-2
2404 $ echo 1 > f-same
2412 $ echo 1 > f-same
2405 $ hg ci -m2
2413 $ hg ci -m2
2406 Invoking status precommit hook
2414 Invoking status precommit hook
2407 M f-different
2415 M f-different
2408 M f-same
2416 M f-same
2409 M f-unchanged-1
2417 M f-unchanged-1
2410 M f-unchanged-2
2418 M f-unchanged-2
2411 $ hg up -qr0
2419 $ hg up -qr0
2412 $ echo tmp2 > f-unchanged-1
2420 $ echo tmp2 > f-unchanged-1
2413 $ echo tmp2 > f-unchanged-2
2421 $ echo tmp2 > f-unchanged-2
2414 $ echo tmp2 > f-same
2422 $ echo tmp2 > f-same
2415 $ hg ci -m3
2423 $ hg ci -m3
2416 Invoking status precommit hook
2424 Invoking status precommit hook
2417 M f-same
2425 M f-same
2418 M f-unchanged-1
2426 M f-unchanged-1
2419 M f-unchanged-2
2427 M f-unchanged-2
2420 created new head
2428 created new head
2421 $ echo 1 > f-different
2429 $ echo 1 > f-different
2422 $ echo 1 > f-unchanged-1
2430 $ echo 1 > f-unchanged-1
2423 $ echo 0 > f-unchanged-2
2431 $ echo 0 > f-unchanged-2
2424 $ echo 1 > f-same
2432 $ echo 1 > f-same
2425 $ hg ci -m4
2433 $ hg ci -m4
2426 Invoking status precommit hook
2434 Invoking status precommit hook
2427 M f-different
2435 M f-different
2428 M f-same
2436 M f-same
2429 M f-unchanged-1
2437 M f-unchanged-1
2430 M f-unchanged-2
2438 M f-unchanged-2
2431 $ hg merge
2439 $ hg merge
2432 largefile f-different has a merge conflict
2440 largefile f-different has a merge conflict
2433 ancestor was 09d2af8dd22201dd8d48e5dcfcaed281ff9422c7
2441 ancestor was 09d2af8dd22201dd8d48e5dcfcaed281ff9422c7
2434 keep (l)ocal e5fa44f2b31c1fb553b6021e7360d07d5d91ff5e or
2442 keep (l)ocal e5fa44f2b31c1fb553b6021e7360d07d5d91ff5e or
2435 take (o)ther 7448d8798a4380162d4b56f9b452e2f6f9e24e7a? l
2443 take (o)ther 7448d8798a4380162d4b56f9b452e2f6f9e24e7a? l
2436 0 files updated, 4 files merged, 0 files removed, 0 files unresolved
2444 0 files updated, 4 files merged, 0 files removed, 0 files unresolved
2437 (branch merge, don't forget to commit)
2445 (branch merge, don't forget to commit)
2438 getting changed largefiles
2446 getting changed largefiles
2439 1 largefiles updated, 0 removed
2447 1 largefiles updated, 0 removed
2440 $ cat f-different
2448 $ cat f-different
2441 1
2449 1
2442 $ cat f-same
2450 $ cat f-same
2443 1
2451 1
2444 $ cat f-unchanged-1
2452 $ cat f-unchanged-1
2445 1
2453 1
2446 $ cat f-unchanged-2
2454 $ cat f-unchanged-2
2447 1
2455 1
2448 $ cd ..
2456 $ cd ..
2449
2457
2450 Check whether "largefiles" feature is supported only in repositories
2458 Check whether "largefiles" feature is supported only in repositories
2451 enabling largefiles extension.
2459 enabling largefiles extension.
2452
2460
2453 $ mkdir individualenabling
2461 $ mkdir individualenabling
2454 $ cd individualenabling
2462 $ cd individualenabling
2455
2463
2456 $ hg init enabledlocally
2464 $ hg init enabledlocally
2457 $ echo large > enabledlocally/large
2465 $ echo large > enabledlocally/large
2458 $ hg -R enabledlocally add --large enabledlocally/large
2466 $ hg -R enabledlocally add --large enabledlocally/large
2459 $ hg -R enabledlocally commit -m '#0'
2467 $ hg -R enabledlocally commit -m '#0'
2460 Invoking status precommit hook
2468 Invoking status precommit hook
2461 A large
2469 A large
2462
2470
2463 $ hg init notenabledlocally
2471 $ hg init notenabledlocally
2464 $ echo large > notenabledlocally/large
2472 $ echo large > notenabledlocally/large
2465 $ hg -R notenabledlocally add --large notenabledlocally/large
2473 $ hg -R notenabledlocally add --large notenabledlocally/large
2466 $ hg -R notenabledlocally commit -m '#0'
2474 $ hg -R notenabledlocally commit -m '#0'
2467 Invoking status precommit hook
2475 Invoking status precommit hook
2468 A large
2476 A large
2469
2477
2470 $ cat >> $HGRCPATH <<EOF
2478 $ cat >> $HGRCPATH <<EOF
2471 > [extensions]
2479 > [extensions]
2472 > # disable globally
2480 > # disable globally
2473 > largefiles=!
2481 > largefiles=!
2474 > EOF
2482 > EOF
2475 $ cat >> enabledlocally/.hg/hgrc <<EOF
2483 $ cat >> enabledlocally/.hg/hgrc <<EOF
2476 > [extensions]
2484 > [extensions]
2477 > # enable locally
2485 > # enable locally
2478 > largefiles=
2486 > largefiles=
2479 > EOF
2487 > EOF
2480 $ hg -R enabledlocally root
2488 $ hg -R enabledlocally root
2481 $TESTTMP/individualenabling/enabledlocally (glob)
2489 $TESTTMP/individualenabling/enabledlocally (glob)
2482 $ hg -R notenabledlocally root
2490 $ hg -R notenabledlocally root
2483 abort: repository requires features unknown to this Mercurial: largefiles!
2491 abort: repository requires features unknown to this Mercurial: largefiles!
2484 (see http://mercurial.selenic.com/wiki/MissingRequirement for more information)
2492 (see http://mercurial.selenic.com/wiki/MissingRequirement for more information)
2485 [255]
2493 [255]
2486
2494
2487 $ hg init push-dst
2495 $ hg init push-dst
2488 $ hg -R enabledlocally push push-dst
2496 $ hg -R enabledlocally push push-dst
2489 pushing to push-dst
2497 pushing to push-dst
2490 abort: required features are not supported in the destination: largefiles
2498 abort: required features are not supported in the destination: largefiles
2491 [255]
2499 [255]
2492
2500
2493 $ hg init pull-src
2501 $ hg init pull-src
2494 $ hg -R pull-src pull enabledlocally
2502 $ hg -R pull-src pull enabledlocally
2495 pulling from enabledlocally
2503 pulling from enabledlocally
2496 abort: required features are not supported in the destination: largefiles
2504 abort: required features are not supported in the destination: largefiles
2497 [255]
2505 [255]
2498
2506
2499 $ hg clone enabledlocally clone-dst
2507 $ hg clone enabledlocally clone-dst
2500 abort: repository requires features unknown to this Mercurial: largefiles!
2508 abort: repository requires features unknown to this Mercurial: largefiles!
2501 (see http://mercurial.selenic.com/wiki/MissingRequirement for more information)
2509 (see http://mercurial.selenic.com/wiki/MissingRequirement for more information)
2502 [255]
2510 [255]
2503 $ test -d clone-dst
2511 $ test -d clone-dst
2504 [1]
2512 [1]
2505 $ hg clone --pull enabledlocally clone-pull-dst
2513 $ hg clone --pull enabledlocally clone-pull-dst
2506 abort: required features are not supported in the destination: largefiles
2514 abort: required features are not supported in the destination: largefiles
2507 [255]
2515 [255]
2508 $ test -d clone-pull-dst
2516 $ test -d clone-pull-dst
2509 [1]
2517 [1]
2510
2518
2511 #if serve
2519 #if serve
2512
2520
2513 Test largefiles specific peer setup, when largefiles is enabled
2521 Test largefiles specific peer setup, when largefiles is enabled
2514 locally (issue4109)
2522 locally (issue4109)
2515
2523
2516 $ hg showconfig extensions | grep largefiles
2524 $ hg showconfig extensions | grep largefiles
2517 extensions.largefiles=!
2525 extensions.largefiles=!
2518 $ mkdir -p $TESTTMP/individualenabling/usercache
2526 $ mkdir -p $TESTTMP/individualenabling/usercache
2519
2527
2520 $ hg serve -R enabledlocally -d -p $HGPORT --pid-file hg.pid
2528 $ hg serve -R enabledlocally -d -p $HGPORT --pid-file hg.pid
2521 $ cat hg.pid >> $DAEMON_PIDS
2529 $ cat hg.pid >> $DAEMON_PIDS
2522
2530
2523 $ hg init pull-dst
2531 $ hg init pull-dst
2524 $ cat > pull-dst/.hg/hgrc <<EOF
2532 $ cat > pull-dst/.hg/hgrc <<EOF
2525 > [extensions]
2533 > [extensions]
2526 > # enable locally
2534 > # enable locally
2527 > largefiles=
2535 > largefiles=
2528 > [largefiles]
2536 > [largefiles]
2529 > # ignore system cache to force largefiles specific wire proto access
2537 > # ignore system cache to force largefiles specific wire proto access
2530 > usercache=$TESTTMP/individualenabling/usercache
2538 > usercache=$TESTTMP/individualenabling/usercache
2531 > EOF
2539 > EOF
2532 $ hg -R pull-dst -q pull -u http://localhost:$HGPORT
2540 $ hg -R pull-dst -q pull -u http://localhost:$HGPORT
2533
2541
2534 $ "$TESTDIR/killdaemons.py" $DAEMON_PIDS
2542 $ "$TESTDIR/killdaemons.py" $DAEMON_PIDS
2535 #endif
2543 #endif
2536
2544
2537 $ cd ..
2545 $ cd ..
General Comments 0
You need to be logged in to leave comments. Login now