##// END OF EJS Templates
largefiles: drop repo wrapping detection...
Mads Kiilerich -
r19088:ce4472b2 stable
parent child Browse files
Show More
@@ -1,524 +1,513 b''
1 1 # Copyright 2009-2010 Gregory P. Ward
2 2 # Copyright 2009-2010 Intelerad Medical Systems Incorporated
3 3 # Copyright 2010-2011 Fog Creek Software
4 4 # Copyright 2010-2011 Unity Technologies
5 5 #
6 6 # This software may be used and distributed according to the terms of the
7 7 # GNU General Public License version 2 or any later version.
8 8
9 9 '''setup for largefiles repositories: reposetup'''
10 10 import copy
11 import types
12 11 import os
13 12
14 13 from mercurial import context, error, manifest, match as match_, util, \
15 14 discovery
16 15 from mercurial import node as node_
17 16 from mercurial.i18n import _
18 17 from mercurial import localrepo
19 18
20 19 import lfcommands
21 20 import proto
22 21 import lfutil
23 22
24 23 def reposetup(ui, repo):
25 24 # wire repositories should be given new wireproto functions but not the
26 25 # other largefiles modifications
27 26 if not repo.local():
28 27 return proto.wirereposetup(ui, repo)
29 28
30 origclass = localrepo.localrepository
31 repoclass = repo.__class__
32 for name in ('status', 'commitctx', 'commit', 'push'):
33 if (getattr(origclass, name) != getattr(repoclass, name) or
34 isinstance(getattr(repo, name), types.FunctionType)):
35 ui.warn(_('largefiles: repo method %r appears to have already been'
36 ' wrapped by another extension: '
37 'largefiles may behave incorrectly\n')
38 % name)
39
40 29 class lfilesrepo(repo.__class__):
41 30 lfstatus = False
42 31 def status_nolfiles(self, *args, **kwargs):
43 32 return super(lfilesrepo, self).status(*args, **kwargs)
44 33
45 34 # When lfstatus is set, return a context that gives the names
46 35 # of largefiles instead of their corresponding standins and
47 36 # identifies the largefiles as always binary, regardless of
48 37 # their actual contents.
49 38 def __getitem__(self, changeid):
50 39 ctx = super(lfilesrepo, self).__getitem__(changeid)
51 40 if self.lfstatus:
52 41 class lfilesmanifestdict(manifest.manifestdict):
53 42 def __contains__(self, filename):
54 43 if super(lfilesmanifestdict,
55 44 self).__contains__(filename):
56 45 return True
57 46 return super(lfilesmanifestdict,
58 47 self).__contains__(lfutil.standin(filename))
59 48 class lfilesctx(ctx.__class__):
60 49 def files(self):
61 50 filenames = super(lfilesctx, self).files()
62 51 return [lfutil.splitstandin(f) or f for f in filenames]
63 52 def manifest(self):
64 53 man1 = super(lfilesctx, self).manifest()
65 54 man1.__class__ = lfilesmanifestdict
66 55 return man1
67 56 def filectx(self, path, fileid=None, filelog=None):
68 57 try:
69 58 if filelog is not None:
70 59 result = super(lfilesctx, self).filectx(
71 60 path, fileid, filelog)
72 61 else:
73 62 result = super(lfilesctx, self).filectx(
74 63 path, fileid)
75 64 except error.LookupError:
76 65 # Adding a null character will cause Mercurial to
77 66 # identify this as a binary file.
78 67 if filelog is not None:
79 68 result = super(lfilesctx, self).filectx(
80 69 lfutil.standin(path), fileid, filelog)
81 70 else:
82 71 result = super(lfilesctx, self).filectx(
83 72 lfutil.standin(path), fileid)
84 73 olddata = result.data
85 74 result.data = lambda: olddata() + '\0'
86 75 return result
87 76 ctx.__class__ = lfilesctx
88 77 return ctx
89 78
90 79 # Figure out the status of big files and insert them into the
91 80 # appropriate list in the result. Also removes standin files
92 81 # from the listing. Revert to the original status if
93 82 # self.lfstatus is False.
94 83 # XXX large file status is buggy when used on repo proxy.
95 84 # XXX this needs to be investigated.
96 85 @localrepo.unfilteredmethod
97 86 def status(self, node1='.', node2=None, match=None, ignored=False,
98 87 clean=False, unknown=False, listsubrepos=False):
99 88 listignored, listclean, listunknown = ignored, clean, unknown
100 89 if not self.lfstatus:
101 90 return super(lfilesrepo, self).status(node1, node2, match,
102 91 listignored, listclean, listunknown, listsubrepos)
103 92 else:
104 93 # some calls in this function rely on the old version of status
105 94 self.lfstatus = False
106 95 if isinstance(node1, context.changectx):
107 96 ctx1 = node1
108 97 else:
109 98 ctx1 = self[node1]
110 99 if isinstance(node2, context.changectx):
111 100 ctx2 = node2
112 101 else:
113 102 ctx2 = self[node2]
114 103 working = ctx2.rev() is None
115 104 parentworking = working and ctx1 == self['.']
116 105
117 106 def inctx(file, ctx):
118 107 try:
119 108 if ctx.rev() is None:
120 109 return file in ctx.manifest()
121 110 ctx[file]
122 111 return True
123 112 except KeyError:
124 113 return False
125 114
126 115 if match is None:
127 116 match = match_.always(self.root, self.getcwd())
128 117
129 118 wlock = None
130 119 try:
131 120 try:
132 121 # updating the dirstate is optional
133 122 # so we don't wait on the lock
134 123 wlock = self.wlock(False)
135 124 except error.LockError:
136 125 pass
137 126
138 127 # First check if there were files specified on the
139 128 # command line. If there were, and none of them were
140 129 # largefiles, we should just bail here and let super
141 130 # handle it -- thus gaining a big performance boost.
142 131 lfdirstate = lfutil.openlfdirstate(ui, self)
143 132 if match.files() and not match.anypats():
144 133 for f in lfdirstate:
145 134 if match(f):
146 135 break
147 136 else:
148 137 return super(lfilesrepo, self).status(node1, node2,
149 138 match, listignored, listclean,
150 139 listunknown, listsubrepos)
151 140
152 141 # Create a copy of match that matches standins instead
153 142 # of largefiles.
154 143 def tostandins(files):
155 144 if not working:
156 145 return files
157 146 newfiles = []
158 147 dirstate = self.dirstate
159 148 for f in files:
160 149 sf = lfutil.standin(f)
161 150 if sf in dirstate:
162 151 newfiles.append(sf)
163 152 elif sf in dirstate.dirs():
164 153 # Directory entries could be regular or
165 154 # standin, check both
166 155 newfiles.extend((f, sf))
167 156 else:
168 157 newfiles.append(f)
169 158 return newfiles
170 159
171 160 m = copy.copy(match)
172 161 m._files = tostandins(m._files)
173 162
174 163 result = super(lfilesrepo, self).status(node1, node2, m,
175 164 ignored, clean, unknown, listsubrepos)
176 165 if working:
177 166
178 167 def sfindirstate(f):
179 168 sf = lfutil.standin(f)
180 169 dirstate = self.dirstate
181 170 return sf in dirstate or sf in dirstate.dirs()
182 171
183 172 match._files = [f for f in match._files
184 173 if sfindirstate(f)]
185 174 # Don't waste time getting the ignored and unknown
186 175 # files from lfdirstate
187 176 s = lfdirstate.status(match, [], False,
188 177 listclean, False)
189 178 (unsure, modified, added, removed, missing, _unknown,
190 179 _ignored, clean) = s
191 180 if parentworking:
192 181 for lfile in unsure:
193 182 standin = lfutil.standin(lfile)
194 183 if standin not in ctx1:
195 184 # from second parent
196 185 modified.append(lfile)
197 186 elif ctx1[standin].data().strip() \
198 187 != lfutil.hashfile(self.wjoin(lfile)):
199 188 modified.append(lfile)
200 189 else:
201 190 clean.append(lfile)
202 191 lfdirstate.normal(lfile)
203 192 else:
204 193 tocheck = unsure + modified + added + clean
205 194 modified, added, clean = [], [], []
206 195
207 196 for lfile in tocheck:
208 197 standin = lfutil.standin(lfile)
209 198 if inctx(standin, ctx1):
210 199 if ctx1[standin].data().strip() != \
211 200 lfutil.hashfile(self.wjoin(lfile)):
212 201 modified.append(lfile)
213 202 else:
214 203 clean.append(lfile)
215 204 else:
216 205 added.append(lfile)
217 206
218 207 # Standins no longer found in lfdirstate has been
219 208 # removed
220 209 for standin in ctx1.manifest():
221 210 if not lfutil.isstandin(standin):
222 211 continue
223 212 lfile = lfutil.splitstandin(standin)
224 213 if not match(lfile):
225 214 continue
226 215 if lfile not in lfdirstate:
227 216 removed.append(lfile)
228 217
229 218 # Filter result lists
230 219 result = list(result)
231 220
232 221 # Largefiles are not really removed when they're
233 222 # still in the normal dirstate. Likewise, normal
234 223 # files are not really removed if they are still in
235 224 # lfdirstate. This happens in merges where files
236 225 # change type.
237 226 removed = [f for f in removed
238 227 if f not in self.dirstate]
239 228 result[2] = [f for f in result[2]
240 229 if f not in lfdirstate]
241 230
242 231 lfiles = set(lfdirstate._map)
243 232 # Unknown files
244 233 result[4] = set(result[4]).difference(lfiles)
245 234 # Ignored files
246 235 result[5] = set(result[5]).difference(lfiles)
247 236 # combine normal files and largefiles
248 237 normals = [[fn for fn in filelist
249 238 if not lfutil.isstandin(fn)]
250 239 for filelist in result]
251 240 lfiles = (modified, added, removed, missing, [], [],
252 241 clean)
253 242 result = [sorted(list1 + list2)
254 243 for (list1, list2) in zip(normals, lfiles)]
255 244 else:
256 245 def toname(f):
257 246 if lfutil.isstandin(f):
258 247 return lfutil.splitstandin(f)
259 248 return f
260 249 result = [[toname(f) for f in items]
261 250 for items in result]
262 251
263 252 if wlock:
264 253 lfdirstate.write()
265 254
266 255 finally:
267 256 if wlock:
268 257 wlock.release()
269 258
270 259 if not listunknown:
271 260 result[4] = []
272 261 if not listignored:
273 262 result[5] = []
274 263 if not listclean:
275 264 result[6] = []
276 265 self.lfstatus = True
277 266 return result
278 267
279 268 # As part of committing, copy all of the largefiles into the
280 269 # cache.
281 270 def commitctx(self, *args, **kwargs):
282 271 node = super(lfilesrepo, self).commitctx(*args, **kwargs)
283 272 lfutil.copyalltostore(self, node)
284 273 return node
285 274
286 275 # Before commit, largefile standins have not had their
287 276 # contents updated to reflect the hash of their largefile.
288 277 # Do that here.
289 278 def commit(self, text="", user=None, date=None, match=None,
290 279 force=False, editor=False, extra={}):
291 280 orig = super(lfilesrepo, self).commit
292 281
293 282 wlock = self.wlock()
294 283 try:
295 284 # Case 0: Rebase or Transplant
296 285 # We have to take the time to pull down the new largefiles now.
297 286 # Otherwise, any largefiles that were modified in the
298 287 # destination changesets get overwritten, either by the rebase
299 288 # or in the first commit after the rebase or transplant.
300 289 # updatelfiles will update the dirstate to mark any pulled
301 290 # largefiles as modified
302 291 if getattr(self, "_isrebasing", False) or \
303 292 getattr(self, "_istransplanting", False):
304 293 lfcommands.updatelfiles(self.ui, self, filelist=None,
305 294 printmessage=False)
306 295 result = orig(text=text, user=user, date=date, match=match,
307 296 force=force, editor=editor, extra=extra)
308 297 return result
309 298 # Case 1: user calls commit with no specific files or
310 299 # include/exclude patterns: refresh and commit all files that
311 300 # are "dirty".
312 301 if ((match is None) or
313 302 (not match.anypats() and not match.files())):
314 303 # Spend a bit of time here to get a list of files we know
315 304 # are modified so we can compare only against those.
316 305 # It can cost a lot of time (several seconds)
317 306 # otherwise to update all standins if the largefiles are
318 307 # large.
319 308 lfdirstate = lfutil.openlfdirstate(ui, self)
320 309 dirtymatch = match_.always(self.root, self.getcwd())
321 310 s = lfdirstate.status(dirtymatch, [], False, False, False)
322 311 (unsure, modified, added, removed, _missing, _unknown,
323 312 _ignored, _clean) = s
324 313 modifiedfiles = unsure + modified + added + removed
325 314 lfiles = lfutil.listlfiles(self)
326 315 # this only loops through largefiles that exist (not
327 316 # removed/renamed)
328 317 for lfile in lfiles:
329 318 if lfile in modifiedfiles:
330 319 if os.path.exists(
331 320 self.wjoin(lfutil.standin(lfile))):
332 321 # this handles the case where a rebase is being
333 322 # performed and the working copy is not updated
334 323 # yet.
335 324 if os.path.exists(self.wjoin(lfile)):
336 325 lfutil.updatestandin(self,
337 326 lfutil.standin(lfile))
338 327 lfdirstate.normal(lfile)
339 328
340 329 result = orig(text=text, user=user, date=date, match=match,
341 330 force=force, editor=editor, extra=extra)
342 331
343 332 if result is not None:
344 333 for lfile in lfdirstate:
345 334 if lfile in modifiedfiles:
346 335 if (not os.path.exists(self.wjoin(
347 336 lfutil.standin(lfile)))) or \
348 337 (not os.path.exists(self.wjoin(lfile))):
349 338 lfdirstate.drop(lfile)
350 339
351 340 # This needs to be after commit; otherwise precommit hooks
352 341 # get the wrong status
353 342 lfdirstate.write()
354 343 return result
355 344
356 345 lfiles = lfutil.listlfiles(self)
357 346 match._files = self._subdirlfs(match.files(), lfiles)
358 347
359 348 # Case 2: user calls commit with specified patterns: refresh
360 349 # any matching big files.
361 350 smatcher = lfutil.composestandinmatcher(self, match)
362 351 standins = self.dirstate.walk(smatcher, [], False, False)
363 352
364 353 # No matching big files: get out of the way and pass control to
365 354 # the usual commit() method.
366 355 if not standins:
367 356 return orig(text=text, user=user, date=date, match=match,
368 357 force=force, editor=editor, extra=extra)
369 358
370 359 # Refresh all matching big files. It's possible that the
371 360 # commit will end up failing, in which case the big files will
372 361 # stay refreshed. No harm done: the user modified them and
373 362 # asked to commit them, so sooner or later we're going to
374 363 # refresh the standins. Might as well leave them refreshed.
375 364 lfdirstate = lfutil.openlfdirstate(ui, self)
376 365 for standin in standins:
377 366 lfile = lfutil.splitstandin(standin)
378 367 if lfdirstate[lfile] != 'r':
379 368 lfutil.updatestandin(self, standin)
380 369 lfdirstate.normal(lfile)
381 370 else:
382 371 lfdirstate.drop(lfile)
383 372
384 373 # Cook up a new matcher that only matches regular files or
385 374 # standins corresponding to the big files requested by the
386 375 # user. Have to modify _files to prevent commit() from
387 376 # complaining "not tracked" for big files.
388 377 match = copy.copy(match)
389 378 origmatchfn = match.matchfn
390 379
391 380 # Check both the list of largefiles and the list of
392 381 # standins because if a largefile was removed, it
393 382 # won't be in the list of largefiles at this point
394 383 match._files += sorted(standins)
395 384
396 385 actualfiles = []
397 386 for f in match._files:
398 387 fstandin = lfutil.standin(f)
399 388
400 389 # ignore known largefiles and standins
401 390 if f in lfiles or fstandin in standins:
402 391 continue
403 392
404 393 # append directory separator to avoid collisions
405 394 if not fstandin.endswith(os.sep):
406 395 fstandin += os.sep
407 396
408 397 actualfiles.append(f)
409 398 match._files = actualfiles
410 399
411 400 def matchfn(f):
412 401 if origmatchfn(f):
413 402 return f not in lfiles
414 403 else:
415 404 return f in standins
416 405
417 406 match.matchfn = matchfn
418 407 result = orig(text=text, user=user, date=date, match=match,
419 408 force=force, editor=editor, extra=extra)
420 409 # This needs to be after commit; otherwise precommit hooks
421 410 # get the wrong status
422 411 lfdirstate.write()
423 412 return result
424 413 finally:
425 414 wlock.release()
426 415
427 416 def push(self, remote, force=False, revs=None, newbranch=False):
428 417 outgoing = discovery.findcommonoutgoing(repo, remote.peer(),
429 418 force=force)
430 419 if outgoing.missing:
431 420 toupload = set()
432 421 o = self.changelog.nodesbetween(outgoing.missing, revs)[0]
433 422 for n in o:
434 423 parents = [p for p in self.changelog.parents(n)
435 424 if p != node_.nullid]
436 425 ctx = self[n]
437 426 files = set(ctx.files())
438 427 if len(parents) == 2:
439 428 mc = ctx.manifest()
440 429 mp1 = ctx.parents()[0].manifest()
441 430 mp2 = ctx.parents()[1].manifest()
442 431 for f in mp1:
443 432 if f not in mc:
444 433 files.add(f)
445 434 for f in mp2:
446 435 if f not in mc:
447 436 files.add(f)
448 437 for f in mc:
449 438 if mc[f] != mp1.get(f, None) or mc[f] != mp2.get(f,
450 439 None):
451 440 files.add(f)
452 441
453 442 toupload = toupload.union(
454 443 set([ctx[f].data().strip()
455 444 for f in files
456 445 if lfutil.isstandin(f) and f in ctx]))
457 446 lfcommands.uploadlfiles(ui, self, remote, toupload)
458 447 return super(lfilesrepo, self).push(remote, force, revs,
459 448 newbranch)
460 449
461 450 def _subdirlfs(self, files, lfiles):
462 451 '''
463 452 Adjust matched file list
464 453 If we pass a directory to commit whose only commitable files
465 454 are largefiles, the core commit code aborts before finding
466 455 the largefiles.
467 456 So we do the following:
468 457 For directories that only have largefiles as matches,
469 458 we explicitly add the largefiles to the match list and remove
470 459 the directory.
471 460 In other cases, we leave the match list unmodified.
472 461 '''
473 462 actualfiles = []
474 463 dirs = []
475 464 regulars = []
476 465
477 466 for f in files:
478 467 if lfutil.isstandin(f + '/'):
479 468 raise util.Abort(
480 469 _('file "%s" is a largefile standin') % f,
481 470 hint=('commit the largefile itself instead'))
482 471 # Scan directories
483 472 if os.path.isdir(self.wjoin(f)):
484 473 dirs.append(f)
485 474 else:
486 475 regulars.append(f)
487 476
488 477 for f in dirs:
489 478 matcheddir = False
490 479 d = self.dirstate.normalize(f) + '/'
491 480 # Check for matched normal files
492 481 for mf in regulars:
493 482 if self.dirstate.normalize(mf).startswith(d):
494 483 actualfiles.append(f)
495 484 matcheddir = True
496 485 break
497 486 if not matcheddir:
498 487 # If no normal match, manually append
499 488 # any matching largefiles
500 489 for lf in lfiles:
501 490 if self.dirstate.normalize(lf).startswith(d):
502 491 actualfiles.append(lf)
503 492 if not matcheddir:
504 493 actualfiles.append(lfutil.standin(f))
505 494 matcheddir = True
506 495 # Nothing in dir, so readd it
507 496 # and let commit reject it
508 497 if not matcheddir:
509 498 actualfiles.append(f)
510 499
511 500 # Always add normal files
512 501 actualfiles += regulars
513 502 return actualfiles
514 503
515 504 repo.__class__ = lfilesrepo
516 505
517 506 def checkrequireslfiles(ui, repo, **kwargs):
518 507 if 'largefiles' not in repo.requirements and util.any(
519 508 lfutil.shortname+'/' in f[0] for f in repo.store.datafiles()):
520 509 repo.requirements.add('largefiles')
521 510 repo._writerequirements()
522 511
523 512 ui.setconfig('hooks', 'changegroup.lfiles', checkrequireslfiles)
524 513 ui.setconfig('hooks', 'commit.lfiles', checkrequireslfiles)
@@ -1,2219 +1,2191 b''
1 1 $ USERCACHE="$TESTTMP/cache"; export USERCACHE
2 2 $ mkdir "${USERCACHE}"
3 3 $ cat >> $HGRCPATH <<EOF
4 4 > [extensions]
5 5 > largefiles=
6 6 > purge=
7 7 > rebase=
8 8 > transplant=
9 9 > [phases]
10 10 > publish=False
11 11 > [largefiles]
12 12 > minsize=2
13 13 > patterns=glob:**.dat
14 14 > usercache=${USERCACHE}
15 15 > [hooks]
16 16 > precommit=sh -c "echo \\"Invoking status precommit hook\\"; hg status"
17 17 > EOF
18 18
19 19 Create the repo with a couple of revisions of both large and normal
20 20 files.
21 21 Test status and dirstate of largefiles and that summary output is correct.
22 22
23 23 $ hg init a
24 24 $ cd a
25 25 $ mkdir sub
26 26 $ echo normal1 > normal1
27 27 $ echo normal2 > sub/normal2
28 28 $ echo large1 > large1
29 29 $ echo large2 > sub/large2
30 30 $ hg add normal1 sub/normal2
31 31 $ hg add --large large1 sub/large2
32 32 $ hg commit -m "add files"
33 33 Invoking status precommit hook
34 34 A large1
35 35 A normal1
36 36 A sub/large2
37 37 A sub/normal2
38 38 $ touch large1 sub/large2
39 39 $ sleep 1
40 40 $ hg st
41 41 $ hg debugstate --nodates
42 42 n 644 41 .hglf/large1
43 43 n 644 41 .hglf/sub/large2
44 44 n 644 8 normal1
45 45 n 644 8 sub/normal2
46 46 $ hg debugstate --large
47 47 n 644 7 large1
48 48 n 644 7 sub/large2
49 49 $ echo normal11 > normal1
50 50 $ echo normal22 > sub/normal2
51 51 $ echo large11 > large1
52 52 $ echo large22 > sub/large2
53 53 $ hg commit -m "edit files"
54 54 Invoking status precommit hook
55 55 M large1
56 56 M normal1
57 57 M sub/large2
58 58 M sub/normal2
59 59 $ hg sum --large
60 60 parent: 1:ce8896473775 tip
61 61 edit files
62 62 branch: default
63 63 commit: (clean)
64 64 update: (current)
65 65 largefiles: (no remote repo)
66 66
67 67 Commit preserved largefile contents.
68 68
69 69 $ cat normal1
70 70 normal11
71 71 $ cat large1
72 72 large11
73 73 $ cat sub/normal2
74 74 normal22
75 75 $ cat sub/large2
76 76 large22
77 77
78 78 Test status, subdir and unknown files
79 79
80 80 $ echo unknown > sub/unknown
81 81 $ hg st --all
82 82 ? sub/unknown
83 83 C large1
84 84 C normal1
85 85 C sub/large2
86 86 C sub/normal2
87 87 $ hg st --all sub
88 88 ? sub/unknown
89 89 C sub/large2
90 90 C sub/normal2
91 91 $ rm sub/unknown
92 92
93 93 Test messages and exit codes for remove warning cases
94 94
95 95 $ hg remove -A large1
96 96 not removing large1: file still exists
97 97 [1]
98 98 $ echo 'modified' > large1
99 99 $ hg remove large1
100 100 not removing large1: file is modified (use -f to force removal)
101 101 [1]
102 102 $ echo 'new' > normalnew
103 103 $ hg add normalnew
104 104 $ echo 'new' > largenew
105 105 $ hg add --large normalnew
106 106 normalnew already tracked!
107 107 $ hg remove normalnew largenew
108 108 not removing largenew: file is untracked
109 109 not removing normalnew: file has been marked for add (use forget to undo)
110 110 [1]
111 111 $ rm normalnew largenew
112 112 $ hg up -Cq
113 113
114 114 Remove both largefiles and normal files.
115 115
116 116 $ hg remove normal1 large1
117 117 $ hg status large1
118 118 R large1
119 119 $ hg commit -m "remove files"
120 120 Invoking status precommit hook
121 121 R large1
122 122 R normal1
123 123 $ ls
124 124 sub
125 125 $ echo "testlargefile" > large1-test
126 126 $ hg add --large large1-test
127 127 $ hg st
128 128 A large1-test
129 129 $ hg rm large1-test
130 130 not removing large1-test: file has been marked for add (use forget to undo)
131 131 [1]
132 132 $ hg st
133 133 A large1-test
134 134 $ hg forget large1-test
135 135 $ hg st
136 136 ? large1-test
137 137 $ hg remove large1-test
138 138 not removing large1-test: file is untracked
139 139 [1]
140 140 $ hg forget large1-test
141 141 not removing large1-test: file is already untracked
142 142 [1]
143 143 $ rm large1-test
144 144
145 145 Copy both largefiles and normal files (testing that status output is correct).
146 146
147 147 $ hg cp sub/normal2 normal1
148 148 $ hg cp sub/large2 large1
149 149 $ hg commit -m "copy files"
150 150 Invoking status precommit hook
151 151 A large1
152 152 A normal1
153 153 $ cat normal1
154 154 normal22
155 155 $ cat large1
156 156 large22
157 157
158 158 Test moving largefiles and verify that normal files are also unaffected.
159 159
160 160 $ hg mv normal1 normal3
161 161 $ hg mv large1 large3
162 162 $ hg mv sub/normal2 sub/normal4
163 163 $ hg mv sub/large2 sub/large4
164 164 $ hg commit -m "move files"
165 165 Invoking status precommit hook
166 166 A large3
167 167 A normal3
168 168 A sub/large4
169 169 A sub/normal4
170 170 R large1
171 171 R normal1
172 172 R sub/large2
173 173 R sub/normal2
174 174 $ cat normal3
175 175 normal22
176 176 $ cat large3
177 177 large22
178 178 $ cat sub/normal4
179 179 normal22
180 180 $ cat sub/large4
181 181 large22
182 182
183 Test repo method wrapping detection
184
185 $ cat > $TESTTMP/wrapping1.py <<EOF
186 > from hgext import largefiles
187 > def reposetup(ui, repo):
188 > class derived(repo.__class__):
189 > def push(self, *args, **kwargs):
190 > return super(derived, self).push(*args, **kwargs)
191 > repo.__class__ = derived
192 > largefiles.reposetup(ui, repo)
193 > uisetup = largefiles.uisetup
194 > EOF
195 $ hg --config extensions.largefiles=$TESTTMP/wrapping1.py status
196 largefiles: repo method 'push' appears to have already been wrapped by another extension: largefiles may behave incorrectly
197
198 $ cat > $TESTTMP/wrapping2.py <<EOF
199 > from hgext import largefiles
200 > def reposetup(ui, repo):
201 > orgpush = repo.push
202 > def push(*args, **kwargs):
203 > return orgpush(*args, **kwargs)
204 > repo.push = push
205 > largefiles.reposetup(ui, repo)
206 > uisetup = largefiles.uisetup
207 > EOF
208 $ hg --config extensions.largefiles=$TESTTMP/wrapping2.py status
209 largefiles: repo method 'push' appears to have already been wrapped by another extension: largefiles may behave incorrectly
210
211 183 Test copies and moves from a directory other than root (issue3516)
212 184
213 185 $ cd ..
214 186 $ hg init lf_cpmv
215 187 $ cd lf_cpmv
216 188 $ mkdir dira
217 189 $ mkdir dira/dirb
218 190 $ touch dira/dirb/largefile
219 191 $ hg add --large dira/dirb/largefile
220 192 $ hg commit -m "added"
221 193 Invoking status precommit hook
222 194 A dira/dirb/largefile
223 195 $ cd dira
224 196 $ hg cp dirb/largefile foo/largefile
225 197 $ hg ci -m "deep copy"
226 198 Invoking status precommit hook
227 199 A dira/foo/largefile
228 200 $ find . | sort
229 201 .
230 202 ./dirb
231 203 ./dirb/largefile
232 204 ./foo
233 205 ./foo/largefile
234 206 $ hg mv foo/largefile baz/largefile
235 207 $ hg ci -m "moved"
236 208 Invoking status precommit hook
237 209 A dira/baz/largefile
238 210 R dira/foo/largefile
239 211 $ find . | sort
240 212 .
241 213 ./baz
242 214 ./baz/largefile
243 215 ./dirb
244 216 ./dirb/largefile
245 217 ./foo
246 218 $ cd ../../a
247 219
248 220 #if serve
249 221 Test display of largefiles in hgweb
250 222
251 223 $ hg serve -d -p $HGPORT --pid-file ../hg.pid
252 224 $ cat ../hg.pid >> $DAEMON_PIDS
253 225 $ "$TESTDIR/get-with-headers.py" 127.0.0.1:$HGPORT 'file/tip/?style=raw'
254 226 200 Script output follows
255 227
256 228
257 229 drwxr-xr-x sub
258 230 -rw-r--r-- 41 large3
259 231 -rw-r--r-- 9 normal3
260 232
261 233
262 234 $ "$TESTDIR/get-with-headers.py" 127.0.0.1:$HGPORT 'file/tip/sub/?style=raw'
263 235 200 Script output follows
264 236
265 237
266 238 -rw-r--r-- 41 large4
267 239 -rw-r--r-- 9 normal4
268 240
269 241
270 242 $ "$TESTDIR/killdaemons.py" $DAEMON_PIDS
271 243 #endif
272 244
273 245 Test archiving the various revisions. These hit corner cases known with
274 246 archiving.
275 247
276 248 $ hg archive -r 0 ../archive0
277 249 $ hg archive -r 1 ../archive1
278 250 $ hg archive -r 2 ../archive2
279 251 $ hg archive -r 3 ../archive3
280 252 $ hg archive -r 4 ../archive4
281 253 $ cd ../archive0
282 254 $ cat normal1
283 255 normal1
284 256 $ cat large1
285 257 large1
286 258 $ cat sub/normal2
287 259 normal2
288 260 $ cat sub/large2
289 261 large2
290 262 $ cd ../archive1
291 263 $ cat normal1
292 264 normal11
293 265 $ cat large1
294 266 large11
295 267 $ cat sub/normal2
296 268 normal22
297 269 $ cat sub/large2
298 270 large22
299 271 $ cd ../archive2
300 272 $ ls
301 273 sub
302 274 $ cat sub/normal2
303 275 normal22
304 276 $ cat sub/large2
305 277 large22
306 278 $ cd ../archive3
307 279 $ cat normal1
308 280 normal22
309 281 $ cat large1
310 282 large22
311 283 $ cat sub/normal2
312 284 normal22
313 285 $ cat sub/large2
314 286 large22
315 287 $ cd ../archive4
316 288 $ cat normal3
317 289 normal22
318 290 $ cat large3
319 291 large22
320 292 $ cat sub/normal4
321 293 normal22
322 294 $ cat sub/large4
323 295 large22
324 296
325 297 Commit corner case: specify files to commit.
326 298
327 299 $ cd ../a
328 300 $ echo normal3 > normal3
329 301 $ echo large3 > large3
330 302 $ echo normal4 > sub/normal4
331 303 $ echo large4 > sub/large4
332 304 $ hg commit normal3 large3 sub/normal4 sub/large4 -m "edit files again"
333 305 Invoking status precommit hook
334 306 M large3
335 307 M normal3
336 308 M sub/large4
337 309 M sub/normal4
338 310 $ cat normal3
339 311 normal3
340 312 $ cat large3
341 313 large3
342 314 $ cat sub/normal4
343 315 normal4
344 316 $ cat sub/large4
345 317 large4
346 318
347 319 One more commit corner case: commit from a subdirectory.
348 320
349 321 $ cd ../a
350 322 $ echo normal33 > normal3
351 323 $ echo large33 > large3
352 324 $ echo normal44 > sub/normal4
353 325 $ echo large44 > sub/large4
354 326 $ cd sub
355 327 $ hg commit -m "edit files yet again"
356 328 Invoking status precommit hook
357 329 M large3
358 330 M normal3
359 331 M sub/large4
360 332 M sub/normal4
361 333 $ cat ../normal3
362 334 normal33
363 335 $ cat ../large3
364 336 large33
365 337 $ cat normal4
366 338 normal44
367 339 $ cat large4
368 340 large44
369 341
370 342 Committing standins is not allowed.
371 343
372 344 $ cd ..
373 345 $ echo large3 > large3
374 346 $ hg commit .hglf/large3 -m "try to commit standin"
375 347 abort: file ".hglf/large3" is a largefile standin
376 348 (commit the largefile itself instead)
377 349 [255]
378 350
379 351 Corner cases for adding largefiles.
380 352
381 353 $ echo large5 > large5
382 354 $ hg add --large large5
383 355 $ hg add --large large5
384 356 large5 already a largefile
385 357 $ mkdir sub2
386 358 $ echo large6 > sub2/large6
387 359 $ echo large7 > sub2/large7
388 360 $ hg add --large sub2
389 361 adding sub2/large6 as a largefile (glob)
390 362 adding sub2/large7 as a largefile (glob)
391 363 $ hg st
392 364 M large3
393 365 A large5
394 366 A sub2/large6
395 367 A sub2/large7
396 368
397 369 Committing directories containing only largefiles.
398 370
399 371 $ mkdir -p z/y/x/m
400 372 $ touch z/y/x/m/large1
401 373 $ touch z/y/x/large2
402 374 $ hg add --large z/y/x/m/large1 z/y/x/large2
403 375 $ hg commit -m "Subdir with directory only containing largefiles" z
404 376 Invoking status precommit hook
405 377 M large3
406 378 A large5
407 379 A sub2/large6
408 380 A sub2/large7
409 381 A z/y/x/large2
410 382 A z/y/x/m/large1
411 383 $ hg rollback --quiet
412 384 $ touch z/y/x/m/normal
413 385 $ hg add z/y/x/m/normal
414 386 $ hg commit -m "Subdir with mixed contents" z
415 387 Invoking status precommit hook
416 388 M large3
417 389 A large5
418 390 A sub2/large6
419 391 A sub2/large7
420 392 A z/y/x/large2
421 393 A z/y/x/m/large1
422 394 A z/y/x/m/normal
423 395 $ hg st
424 396 M large3
425 397 A large5
426 398 A sub2/large6
427 399 A sub2/large7
428 400 $ hg rollback --quiet
429 401 $ hg revert z/y/x/large2 z/y/x/m/large1
430 402 $ rm z/y/x/large2 z/y/x/m/large1
431 403 $ hg commit -m "Subdir with normal contents" z
432 404 Invoking status precommit hook
433 405 M large3
434 406 A large5
435 407 A sub2/large6
436 408 A sub2/large7
437 409 A z/y/x/m/normal
438 410 $ hg st
439 411 M large3
440 412 A large5
441 413 A sub2/large6
442 414 A sub2/large7
443 415 $ hg rollback --quiet
444 416 $ hg revert --quiet z
445 417 $ hg commit -m "Empty subdir" z
446 418 abort: z: no match under directory!
447 419 [255]
448 420 $ rm -rf z
449 421 $ hg ci -m "standin" .hglf
450 422 abort: file ".hglf" is a largefile standin
451 423 (commit the largefile itself instead)
452 424 [255]
453 425
454 426 Test "hg status" with combination of 'file pattern' and 'directory
455 427 pattern' for largefiles:
456 428
457 429 $ hg status sub2/large6 sub2
458 430 A sub2/large6
459 431 A sub2/large7
460 432
461 433 Config settings (pattern **.dat, minsize 2 MB) are respected.
462 434
463 435 $ echo testdata > test.dat
464 436 $ dd bs=1k count=2k if=/dev/zero of=reallylarge > /dev/null 2> /dev/null
465 437 $ hg add
466 438 adding reallylarge as a largefile
467 439 adding test.dat as a largefile
468 440
469 441 Test that minsize and --lfsize handle float values;
470 442 also tests that --lfsize overrides largefiles.minsize.
471 443 (0.250 MB = 256 kB = 262144 B)
472 444
473 445 $ dd if=/dev/zero of=ratherlarge bs=1024 count=256 > /dev/null 2> /dev/null
474 446 $ dd if=/dev/zero of=medium bs=1024 count=128 > /dev/null 2> /dev/null
475 447 $ hg --config largefiles.minsize=.25 add
476 448 adding ratherlarge as a largefile
477 449 adding medium
478 450 $ hg forget medium
479 451 $ hg --config largefiles.minsize=.25 add --lfsize=.125
480 452 adding medium as a largefile
481 453 $ dd if=/dev/zero of=notlarge bs=1024 count=127 > /dev/null 2> /dev/null
482 454 $ hg --config largefiles.minsize=.25 add --lfsize=.125
483 455 adding notlarge
484 456 $ hg forget notlarge
485 457
486 458 Test forget on largefiles.
487 459
488 460 $ hg forget large3 large5 test.dat reallylarge ratherlarge medium
489 461 $ hg commit -m "add/edit more largefiles"
490 462 Invoking status precommit hook
491 463 A sub2/large6
492 464 A sub2/large7
493 465 R large3
494 466 ? large5
495 467 ? medium
496 468 ? notlarge
497 469 ? ratherlarge
498 470 ? reallylarge
499 471 ? test.dat
500 472 $ hg st
501 473 ? large3
502 474 ? large5
503 475 ? medium
504 476 ? notlarge
505 477 ? ratherlarge
506 478 ? reallylarge
507 479 ? test.dat
508 480
509 481 Purge with largefiles: verify that largefiles are still in the working
510 482 dir after a purge.
511 483
512 484 $ hg purge --all
513 485 $ cat sub/large4
514 486 large44
515 487 $ cat sub2/large6
516 488 large6
517 489 $ cat sub2/large7
518 490 large7
519 491
520 492 Test addremove: verify that files that should be added as largfiles are added as
521 493 such and that already-existing largfiles are not added as normal files by
522 494 accident.
523 495
524 496 $ rm normal3
525 497 $ rm sub/large4
526 498 $ echo "testing addremove with patterns" > testaddremove.dat
527 499 $ echo "normaladdremove" > normaladdremove
528 500 $ hg addremove
529 501 removing sub/large4
530 502 adding testaddremove.dat as a largefile
531 503 removing normal3
532 504 adding normaladdremove
533 505
534 506 Test addremove with -R
535 507
536 508 $ hg up -C
537 509 getting changed largefiles
538 510 1 largefiles updated, 0 removed
539 511 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
540 512 $ rm normal3
541 513 $ rm sub/large4
542 514 $ echo "testing addremove with patterns" > testaddremove.dat
543 515 $ echo "normaladdremove" > normaladdremove
544 516 $ cd ..
545 517 $ hg -R a addremove
546 518 removing sub/large4
547 519 adding a/testaddremove.dat as a largefile (glob)
548 520 removing normal3
549 521 adding normaladdremove
550 522 $ cd a
551 523
552 524 Test 3364
553 525 $ hg clone . ../addrm
554 526 updating to branch default
555 527 getting changed largefiles
556 528 3 largefiles updated, 0 removed
557 529 5 files updated, 0 files merged, 0 files removed, 0 files unresolved
558 530 $ cd ../addrm
559 531 $ cat >> .hg/hgrc <<EOF
560 532 > [hooks]
561 533 > post-commit.stat=sh -c "echo \\"Invoking status postcommit hook\\"; hg status -A"
562 534 > EOF
563 535 $ touch foo
564 536 $ hg add --large foo
565 537 $ hg ci -m "add foo"
566 538 Invoking status precommit hook
567 539 A foo
568 540 Invoking status postcommit hook
569 541 C foo
570 542 C normal3
571 543 C sub/large4
572 544 C sub/normal4
573 545 C sub2/large6
574 546 C sub2/large7
575 547 $ rm foo
576 548 $ hg st
577 549 ! foo
578 550 hmm.. no precommit invoked, but there is a postcommit??
579 551 $ hg ci -m "will not checkin"
580 552 nothing changed
581 553 Invoking status postcommit hook
582 554 ! foo
583 555 C normal3
584 556 C sub/large4
585 557 C sub/normal4
586 558 C sub2/large6
587 559 C sub2/large7
588 560 [1]
589 561 $ hg addremove
590 562 removing foo
591 563 $ hg st
592 564 R foo
593 565 $ hg ci -m "used to say nothing changed"
594 566 Invoking status precommit hook
595 567 R foo
596 568 Invoking status postcommit hook
597 569 C normal3
598 570 C sub/large4
599 571 C sub/normal4
600 572 C sub2/large6
601 573 C sub2/large7
602 574 $ hg st
603 575
604 576 Test 3507 (both normal files and largefiles were a problem)
605 577
606 578 $ touch normal
607 579 $ touch large
608 580 $ hg add normal
609 581 $ hg add --large large
610 582 $ hg ci -m "added"
611 583 Invoking status precommit hook
612 584 A large
613 585 A normal
614 586 Invoking status postcommit hook
615 587 C large
616 588 C normal
617 589 C normal3
618 590 C sub/large4
619 591 C sub/normal4
620 592 C sub2/large6
621 593 C sub2/large7
622 594 $ hg remove normal
623 595 $ hg addremove --traceback
624 596 $ hg ci -m "addremoved normal"
625 597 Invoking status precommit hook
626 598 R normal
627 599 Invoking status postcommit hook
628 600 C large
629 601 C normal3
630 602 C sub/large4
631 603 C sub/normal4
632 604 C sub2/large6
633 605 C sub2/large7
634 606 $ hg up -C '.^'
635 607 getting changed largefiles
636 608 0 largefiles updated, 0 removed
637 609 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
638 610 $ hg remove large
639 611 $ hg addremove --traceback
640 612 $ hg ci -m "removed large"
641 613 Invoking status precommit hook
642 614 R large
643 615 created new head
644 616 Invoking status postcommit hook
645 617 C normal
646 618 C normal3
647 619 C sub/large4
648 620 C sub/normal4
649 621 C sub2/large6
650 622 C sub2/large7
651 623
652 624 Test commit -A (issue 3542)
653 625 $ echo large8 > large8
654 626 $ hg add --large large8
655 627 $ hg ci -Am 'this used to add large8 as normal and commit both'
656 628 Invoking status precommit hook
657 629 A large8
658 630 Invoking status postcommit hook
659 631 C large8
660 632 C normal
661 633 C normal3
662 634 C sub/large4
663 635 C sub/normal4
664 636 C sub2/large6
665 637 C sub2/large7
666 638 $ rm large8
667 639 $ hg ci -Am 'this used to not notice the rm'
668 640 removing large8
669 641 Invoking status precommit hook
670 642 R large8
671 643 Invoking status postcommit hook
672 644 C normal
673 645 C normal3
674 646 C sub/large4
675 647 C sub/normal4
676 648 C sub2/large6
677 649 C sub2/large7
678 650
679 651 Test that a standin can't be added as a large file
680 652
681 653 $ touch large
682 654 $ hg add --large large
683 655 $ hg ci -m "add"
684 656 Invoking status precommit hook
685 657 A large
686 658 Invoking status postcommit hook
687 659 C large
688 660 C normal
689 661 C normal3
690 662 C sub/large4
691 663 C sub/normal4
692 664 C sub2/large6
693 665 C sub2/large7
694 666 $ hg remove large
695 667 $ touch large
696 668 $ hg addremove --config largefiles.patterns=**large --traceback
697 669 adding large as a largefile
698 670
699 671 Test that outgoing --large works (with revsets too)
700 672 $ hg outgoing --rev '.^' --large
701 673 comparing with $TESTTMP/a (glob)
702 674 searching for changes
703 675 changeset: 8:c02fd3b77ec4
704 676 user: test
705 677 date: Thu Jan 01 00:00:00 1970 +0000
706 678 summary: add foo
707 679
708 680 changeset: 9:289dd08c9bbb
709 681 user: test
710 682 date: Thu Jan 01 00:00:00 1970 +0000
711 683 summary: used to say nothing changed
712 684
713 685 changeset: 10:34f23ac6ac12
714 686 user: test
715 687 date: Thu Jan 01 00:00:00 1970 +0000
716 688 summary: added
717 689
718 690 changeset: 12:710c1b2f523c
719 691 parent: 10:34f23ac6ac12
720 692 user: test
721 693 date: Thu Jan 01 00:00:00 1970 +0000
722 694 summary: removed large
723 695
724 696 changeset: 13:0a3e75774479
725 697 user: test
726 698 date: Thu Jan 01 00:00:00 1970 +0000
727 699 summary: this used to add large8 as normal and commit both
728 700
729 701 changeset: 14:84f3d378175c
730 702 user: test
731 703 date: Thu Jan 01 00:00:00 1970 +0000
732 704 summary: this used to not notice the rm
733 705
734 706 searching for changes
735 707 largefiles to upload:
736 708 foo
737 709 large
738 710 large8
739 711
740 712 $ cd ../a
741 713
742 714 Clone a largefiles repo.
743 715
744 716 $ hg clone . ../b
745 717 updating to branch default
746 718 getting changed largefiles
747 719 3 largefiles updated, 0 removed
748 720 5 files updated, 0 files merged, 0 files removed, 0 files unresolved
749 721 $ cd ../b
750 722 $ hg log --template '{rev}:{node|short} {desc|firstline}\n'
751 723 7:daea875e9014 add/edit more largefiles
752 724 6:4355d653f84f edit files yet again
753 725 5:9d5af5072dbd edit files again
754 726 4:74c02385b94c move files
755 727 3:9e8fbc4bce62 copy files
756 728 2:51a0ae4d5864 remove files
757 729 1:ce8896473775 edit files
758 730 0:30d30fe6a5be add files
759 731 $ cat normal3
760 732 normal33
761 733 $ cat sub/normal4
762 734 normal44
763 735 $ cat sub/large4
764 736 large44
765 737 $ cat sub2/large6
766 738 large6
767 739 $ cat sub2/large7
768 740 large7
769 741 $ cd ..
770 742 $ hg clone a -r 3 c
771 743 adding changesets
772 744 adding manifests
773 745 adding file changes
774 746 added 4 changesets with 10 changes to 4 files
775 747 updating to branch default
776 748 getting changed largefiles
777 749 2 largefiles updated, 0 removed
778 750 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
779 751 $ cd c
780 752 $ hg log --template '{rev}:{node|short} {desc|firstline}\n'
781 753 3:9e8fbc4bce62 copy files
782 754 2:51a0ae4d5864 remove files
783 755 1:ce8896473775 edit files
784 756 0:30d30fe6a5be add files
785 757 $ cat normal1
786 758 normal22
787 759 $ cat large1
788 760 large22
789 761 $ cat sub/normal2
790 762 normal22
791 763 $ cat sub/large2
792 764 large22
793 765
794 766 Old revisions of a clone have correct largefiles content (this also
795 767 tests update).
796 768
797 769 $ hg update -r 1
798 770 getting changed largefiles
799 771 1 largefiles updated, 0 removed
800 772 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
801 773 $ cat large1
802 774 large11
803 775 $ cat sub/large2
804 776 large22
805 777 $ cd ..
806 778
807 779 Test cloning with --all-largefiles flag
808 780
809 781 $ rm "${USERCACHE}"/*
810 782 $ hg clone --all-largefiles a a-backup
811 783 updating to branch default
812 784 getting changed largefiles
813 785 3 largefiles updated, 0 removed
814 786 5 files updated, 0 files merged, 0 files removed, 0 files unresolved
815 787 8 additional largefiles cached
816 788
817 789 $ rm "${USERCACHE}"/*
818 790 $ hg clone --all-largefiles -u 0 a a-clone0
819 791 updating to branch default
820 792 getting changed largefiles
821 793 2 largefiles updated, 0 removed
822 794 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
823 795 9 additional largefiles cached
824 796 $ hg -R a-clone0 sum
825 797 parent: 0:30d30fe6a5be
826 798 add files
827 799 branch: default
828 800 commit: (clean)
829 801 update: 7 new changesets (update)
830 802
831 803 $ rm "${USERCACHE}"/*
832 804 $ hg clone --all-largefiles -u 1 a a-clone1
833 805 updating to branch default
834 806 getting changed largefiles
835 807 2 largefiles updated, 0 removed
836 808 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
837 809 8 additional largefiles cached
838 810 $ hg -R a-clone1 verify --large --lfa --lfc
839 811 checking changesets
840 812 checking manifests
841 813 crosschecking files in changesets and manifests
842 814 checking files
843 815 10 files, 8 changesets, 24 total revisions
844 816 searching 8 changesets for largefiles
845 817 verified contents of 13 revisions of 6 largefiles
846 818 $ hg -R a-clone1 sum
847 819 parent: 1:ce8896473775
848 820 edit files
849 821 branch: default
850 822 commit: (clean)
851 823 update: 6 new changesets (update)
852 824
853 825 $ rm "${USERCACHE}"/*
854 826 $ hg clone --all-largefiles -U a a-clone-u
855 827 11 additional largefiles cached
856 828 $ hg -R a-clone-u sum
857 829 parent: -1:000000000000 (no revision checked out)
858 830 branch: default
859 831 commit: (clean)
860 832 update: 8 new changesets (update)
861 833
862 834 Show computed destination directory:
863 835
864 836 $ mkdir xyz
865 837 $ cd xyz
866 838 $ hg clone ../a
867 839 destination directory: a
868 840 updating to branch default
869 841 getting changed largefiles
870 842 3 largefiles updated, 0 removed
871 843 5 files updated, 0 files merged, 0 files removed, 0 files unresolved
872 844 $ cd ..
873 845
874 846 Clone URL without path:
875 847
876 848 $ hg clone file://
877 849 abort: repository / not found!
878 850 [255]
879 851
880 852 Ensure base clone command argument validation
881 853
882 854 $ hg clone -U -u 0 a a-clone-failure
883 855 abort: cannot specify both --noupdate and --updaterev
884 856 [255]
885 857
886 858 $ hg clone --all-largefiles a ssh://localhost/a
887 859 abort: --all-largefiles is incompatible with non-local destination ssh://localhost/a
888 860 [255]
889 861
890 862 Test pulling with --all-largefiles flag. Also test that the largefiles are
891 863 downloaded from 'default' instead of 'default-push' when no source is specified
892 864 (issue3584)
893 865
894 866 $ rm -Rf a-backup
895 867 $ hg clone -r 1 a a-backup
896 868 adding changesets
897 869 adding manifests
898 870 adding file changes
899 871 added 2 changesets with 8 changes to 4 files
900 872 updating to branch default
901 873 getting changed largefiles
902 874 2 largefiles updated, 0 removed
903 875 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
904 876 $ rm "${USERCACHE}"/*
905 877 $ cd a-backup
906 878 $ hg pull --all-largefiles --config paths.default-push=bogus/path
907 879 pulling from $TESTTMP/a (glob)
908 880 searching for changes
909 881 adding changesets
910 882 adding manifests
911 883 adding file changes
912 884 added 6 changesets with 16 changes to 8 files
913 885 (run 'hg update' to get a working copy)
914 886 6 largefiles cached
915 887
916 888 redo pull with --lfrev and check it pulls largefiles for the right revs
917 889
918 890 $ hg rollback
919 891 repository tip rolled back to revision 1 (undo pull)
920 892 $ hg pull -v --lfrev 'heads(pulled())+min(pulled())'
921 893 pulling from $TESTTMP/a (glob)
922 894 searching for changes
923 895 all local heads known remotely
924 896 6 changesets found
925 897 adding changesets
926 898 adding manifests
927 899 adding file changes
928 900 added 6 changesets with 16 changes to 8 files
929 901 calling hook changegroup.lfiles: <function checkrequireslfiles at *> (glob)
930 902 (run 'hg update' to get a working copy)
931 903 pulling largefiles for revision 7
932 904 found 971fb41e78fea4f8e0ba5244784239371cb00591 in store
933 905 found 0d6d75887db61b2c7e6c74b5dd8fc6ad50c0cc30 in store
934 906 found bb3151689acb10f0c3125c560d5e63df914bc1af in store
935 907 pulling largefiles for revision 2
936 908 found eb7338044dc27f9bc59b8dd5a246b065ead7a9c4 in store
937 909 0 largefiles cached
938 910
939 911 lfpull
940 912
941 913 $ hg lfpull -r : --config largefiles.usercache=usercache-lfpull
942 914 2 largefiles cached
943 915 $ hg lfpull -v -r 4+2 --config largefiles.usercache=usercache-lfpull
944 916 pulling largefiles for revision 4
945 917 found eb7338044dc27f9bc59b8dd5a246b065ead7a9c4 in store
946 918 found eb7338044dc27f9bc59b8dd5a246b065ead7a9c4 in store
947 919 pulling largefiles for revision 2
948 920 found eb7338044dc27f9bc59b8dd5a246b065ead7a9c4 in store
949 921 0 largefiles cached
950 922
951 923 $ ls usercache-lfpull/* | sort
952 924 usercache-lfpull/1deebade43c8c498a3c8daddac0244dc55d1331d
953 925 usercache-lfpull/4669e532d5b2c093a78eca010077e708a071bb64
954 926
955 927 $ cd ..
956 928
957 929 Rebasing between two repositories does not revert largefiles to old
958 930 revisions (this was a very bad bug that took a lot of work to fix).
959 931
960 932 $ hg clone a d
961 933 updating to branch default
962 934 getting changed largefiles
963 935 3 largefiles updated, 0 removed
964 936 5 files updated, 0 files merged, 0 files removed, 0 files unresolved
965 937 $ cd b
966 938 $ echo large4-modified > sub/large4
967 939 $ echo normal3-modified > normal3
968 940 $ hg commit -m "modify normal file and largefile in repo b"
969 941 Invoking status precommit hook
970 942 M normal3
971 943 M sub/large4
972 944 $ cd ../d
973 945 $ echo large6-modified > sub2/large6
974 946 $ echo normal4-modified > sub/normal4
975 947 $ hg commit -m "modify normal file largefile in repo d"
976 948 Invoking status precommit hook
977 949 M sub/normal4
978 950 M sub2/large6
979 951 $ cd ..
980 952 $ hg clone d e
981 953 updating to branch default
982 954 getting changed largefiles
983 955 3 largefiles updated, 0 removed
984 956 5 files updated, 0 files merged, 0 files removed, 0 files unresolved
985 957 $ cd d
986 958
987 959 More rebase testing, but also test that the largefiles are downloaded from
988 960 'default-push' when no source is specified (issue3584). (The largefile from the
989 961 pulled revision is however not downloaded but found in the local cache.)
990 962 Largefiles are fetched for the new pulled revision, not for existing revisions,
991 963 rebased or not.
992 964
993 965 $ [ ! -f .hg/largefiles/e166e74c7303192238d60af5a9c4ce9bef0b7928 ]
994 966 $ hg pull --rebase --all-largefiles --config paths.default-push=bogus/path --config paths.default=../b
995 967 pulling from $TESTTMP/b (glob)
996 968 searching for changes
997 969 adding changesets
998 970 adding manifests
999 971 adding file changes
1000 972 added 1 changesets with 2 changes to 2 files (+1 heads)
1001 973 Invoking status precommit hook
1002 974 M sub/normal4
1003 975 M sub2/large6
1004 976 saved backup bundle to $TESTTMP/d/.hg/strip-backup/f574fb32bb45-backup.hg (glob)
1005 977 0 largefiles cached
1006 978 nothing to rebase
1007 979 $ [ -f .hg/largefiles/e166e74c7303192238d60af5a9c4ce9bef0b7928 ]
1008 980 $ hg log --template '{rev}:{node|short} {desc|firstline}\n'
1009 981 9:598410d3eb9a modify normal file largefile in repo d
1010 982 8:a381d2c8c80e modify normal file and largefile in repo b
1011 983 7:daea875e9014 add/edit more largefiles
1012 984 6:4355d653f84f edit files yet again
1013 985 5:9d5af5072dbd edit files again
1014 986 4:74c02385b94c move files
1015 987 3:9e8fbc4bce62 copy files
1016 988 2:51a0ae4d5864 remove files
1017 989 1:ce8896473775 edit files
1018 990 0:30d30fe6a5be add files
1019 991 $ cat normal3
1020 992 normal3-modified
1021 993 $ cat sub/normal4
1022 994 normal4-modified
1023 995 $ cat sub/large4
1024 996 large4-modified
1025 997 $ cat sub2/large6
1026 998 large6-modified
1027 999 $ cat sub2/large7
1028 1000 large7
1029 1001 $ cd ../e
1030 1002 $ hg pull ../b
1031 1003 pulling from ../b
1032 1004 searching for changes
1033 1005 adding changesets
1034 1006 adding manifests
1035 1007 adding file changes
1036 1008 added 1 changesets with 2 changes to 2 files (+1 heads)
1037 1009 (run 'hg heads' to see heads, 'hg merge' to merge)
1038 1010 $ hg rebase
1039 1011 Invoking status precommit hook
1040 1012 M sub/normal4
1041 1013 M sub2/large6
1042 1014 saved backup bundle to $TESTTMP/e/.hg/strip-backup/f574fb32bb45-backup.hg (glob)
1043 1015 $ hg log --template '{rev}:{node|short} {desc|firstline}\n'
1044 1016 9:598410d3eb9a modify normal file largefile in repo d
1045 1017 8:a381d2c8c80e modify normal file and largefile in repo b
1046 1018 7:daea875e9014 add/edit more largefiles
1047 1019 6:4355d653f84f edit files yet again
1048 1020 5:9d5af5072dbd edit files again
1049 1021 4:74c02385b94c move files
1050 1022 3:9e8fbc4bce62 copy files
1051 1023 2:51a0ae4d5864 remove files
1052 1024 1:ce8896473775 edit files
1053 1025 0:30d30fe6a5be add files
1054 1026 $ cat normal3
1055 1027 normal3-modified
1056 1028 $ cat sub/normal4
1057 1029 normal4-modified
1058 1030 $ cat sub/large4
1059 1031 large4-modified
1060 1032 $ cat sub2/large6
1061 1033 large6-modified
1062 1034 $ cat sub2/large7
1063 1035 large7
1064 1036
1065 1037 Log on largefiles
1066 1038
1067 1039 - same output
1068 1040 $ hg log --template '{rev}:{node|short} {desc|firstline}\n' .hglf/sub/large4
1069 1041 8:a381d2c8c80e modify normal file and largefile in repo b
1070 1042 6:4355d653f84f edit files yet again
1071 1043 5:9d5af5072dbd edit files again
1072 1044 4:74c02385b94c move files
1073 1045 $ hg log --template '{rev}:{node|short} {desc|firstline}\n' sub/large4
1074 1046 8:a381d2c8c80e modify normal file and largefile in repo b
1075 1047 6:4355d653f84f edit files yet again
1076 1048 5:9d5af5072dbd edit files again
1077 1049 4:74c02385b94c move files
1078 1050
1079 1051 - .hglf only matches largefiles, without .hglf it matches 9 bco sub/normal
1080 1052 $ hg log --template '{rev}:{node|short} {desc|firstline}\n' .hglf/sub
1081 1053 8:a381d2c8c80e modify normal file and largefile in repo b
1082 1054 6:4355d653f84f edit files yet again
1083 1055 5:9d5af5072dbd edit files again
1084 1056 4:74c02385b94c move files
1085 1057 1:ce8896473775 edit files
1086 1058 0:30d30fe6a5be add files
1087 1059 $ hg log --template '{rev}:{node|short} {desc|firstline}\n' sub
1088 1060 9:598410d3eb9a modify normal file largefile in repo d
1089 1061 8:a381d2c8c80e modify normal file and largefile in repo b
1090 1062 6:4355d653f84f edit files yet again
1091 1063 5:9d5af5072dbd edit files again
1092 1064 4:74c02385b94c move files
1093 1065 1:ce8896473775 edit files
1094 1066 0:30d30fe6a5be add files
1095 1067
1096 1068 - globbing gives same result
1097 1069 $ hg log --template '{rev}:{node|short} {desc|firstline}\n' 'glob:sub/*'
1098 1070 9:598410d3eb9a modify normal file largefile in repo d
1099 1071 8:a381d2c8c80e modify normal file and largefile in repo b
1100 1072 6:4355d653f84f edit files yet again
1101 1073 5:9d5af5072dbd edit files again
1102 1074 4:74c02385b94c move files
1103 1075 1:ce8896473775 edit files
1104 1076 0:30d30fe6a5be add files
1105 1077
1106 1078 Rollback on largefiles.
1107 1079
1108 1080 $ echo large4-modified-again > sub/large4
1109 1081 $ hg commit -m "Modify large4 again"
1110 1082 Invoking status precommit hook
1111 1083 M sub/large4
1112 1084 $ hg rollback
1113 1085 repository tip rolled back to revision 9 (undo commit)
1114 1086 working directory now based on revision 9
1115 1087 $ hg st
1116 1088 M sub/large4
1117 1089 $ hg log --template '{rev}:{node|short} {desc|firstline}\n'
1118 1090 9:598410d3eb9a modify normal file largefile in repo d
1119 1091 8:a381d2c8c80e modify normal file and largefile in repo b
1120 1092 7:daea875e9014 add/edit more largefiles
1121 1093 6:4355d653f84f edit files yet again
1122 1094 5:9d5af5072dbd edit files again
1123 1095 4:74c02385b94c move files
1124 1096 3:9e8fbc4bce62 copy files
1125 1097 2:51a0ae4d5864 remove files
1126 1098 1:ce8896473775 edit files
1127 1099 0:30d30fe6a5be add files
1128 1100 $ cat sub/large4
1129 1101 large4-modified-again
1130 1102
1131 1103 "update --check" refuses to update with uncommitted changes.
1132 1104 $ hg update --check 8
1133 1105 abort: uncommitted local changes
1134 1106 [255]
1135 1107
1136 1108 "update --clean" leaves correct largefiles in working copy, even when there is
1137 1109 .orig files from revert in .hglf.
1138 1110
1139 1111 $ echo mistake > sub2/large7
1140 1112 $ hg revert sub2/large7
1141 1113 $ hg -q update --clean -r null
1142 1114 $ hg update --clean
1143 1115 getting changed largefiles
1144 1116 3 largefiles updated, 0 removed
1145 1117 5 files updated, 0 files merged, 0 files removed, 0 files unresolved
1146 1118 $ cat normal3
1147 1119 normal3-modified
1148 1120 $ cat sub/normal4
1149 1121 normal4-modified
1150 1122 $ cat sub/large4
1151 1123 large4-modified
1152 1124 $ cat sub2/large6
1153 1125 large6-modified
1154 1126 $ cat sub2/large7
1155 1127 large7
1156 1128 $ cat sub2/large7.orig
1157 1129 mistake
1158 1130 $ cat .hglf/sub2/large7.orig
1159 1131 9dbfb2c79b1c40981b258c3efa1b10b03f18ad31
1160 1132
1161 1133 demonstrate misfeature: .orig file is overwritten on every update -C,
1162 1134 also when clean:
1163 1135 $ hg update --clean
1164 1136 getting changed largefiles
1165 1137 0 largefiles updated, 0 removed
1166 1138 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
1167 1139 $ cat sub2/large7.orig
1168 1140 large7
1169 1141 $ rm sub2/large7.orig .hglf/sub2/large7.orig
1170 1142
1171 1143 Now "update check" is happy.
1172 1144 $ hg update --check 8
1173 1145 getting changed largefiles
1174 1146 1 largefiles updated, 0 removed
1175 1147 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
1176 1148 $ hg update --check
1177 1149 getting changed largefiles
1178 1150 1 largefiles updated, 0 removed
1179 1151 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
1180 1152
1181 1153 Test removing empty largefiles directories on update
1182 1154 $ test -d sub2 && echo "sub2 exists"
1183 1155 sub2 exists
1184 1156 $ hg update -q null
1185 1157 $ test -d sub2 && echo "error: sub2 should not exist anymore"
1186 1158 [1]
1187 1159 $ hg update -q
1188 1160
1189 1161 Test hg remove removes empty largefiles directories
1190 1162 $ test -d sub2 && echo "sub2 exists"
1191 1163 sub2 exists
1192 1164 $ hg remove sub2/*
1193 1165 $ test -d sub2 && echo "error: sub2 should not exist anymore"
1194 1166 [1]
1195 1167 $ hg revert sub2/large6 sub2/large7
1196 1168
1197 1169 "revert" works on largefiles (and normal files too).
1198 1170 $ echo hack3 >> normal3
1199 1171 $ echo hack4 >> sub/normal4
1200 1172 $ echo hack4 >> sub/large4
1201 1173 $ rm sub2/large6
1202 1174 $ hg revert sub2/large6
1203 1175 $ hg rm sub2/large6
1204 1176 $ echo new >> sub2/large8
1205 1177 $ hg add --large sub2/large8
1206 1178 # XXX we don't really want to report that we're reverting the standin;
1207 1179 # that's just an implementation detail. But I don't see an obvious fix. ;-(
1208 1180 $ hg revert sub
1209 1181 reverting .hglf/sub/large4 (glob)
1210 1182 reverting sub/normal4 (glob)
1211 1183 $ hg status
1212 1184 M normal3
1213 1185 A sub2/large8
1214 1186 R sub2/large6
1215 1187 ? sub/large4.orig
1216 1188 ? sub/normal4.orig
1217 1189 $ cat sub/normal4
1218 1190 normal4-modified
1219 1191 $ cat sub/large4
1220 1192 large4-modified
1221 1193 $ hg revert -a --no-backup
1222 1194 undeleting .hglf/sub2/large6 (glob)
1223 1195 forgetting .hglf/sub2/large8 (glob)
1224 1196 reverting normal3
1225 1197 $ hg status
1226 1198 ? sub/large4.orig
1227 1199 ? sub/normal4.orig
1228 1200 ? sub2/large8
1229 1201 $ cat normal3
1230 1202 normal3-modified
1231 1203 $ cat sub2/large6
1232 1204 large6-modified
1233 1205 $ rm sub/*.orig sub2/large8
1234 1206
1235 1207 revert some files to an older revision
1236 1208 $ hg revert --no-backup -r 8 sub2
1237 1209 reverting .hglf/sub2/large6 (glob)
1238 1210 $ cat sub2/large6
1239 1211 large6
1240 1212 $ hg revert --no-backup -C -r '.^' sub2
1241 1213 reverting .hglf/sub2/large6 (glob)
1242 1214 $ hg revert --no-backup sub2
1243 1215 reverting .hglf/sub2/large6 (glob)
1244 1216 $ hg status
1245 1217
1246 1218 "verify --large" actually verifies largefiles
1247 1219
1248 1220 - Where Do We Come From? What Are We? Where Are We Going?
1249 1221 $ pwd
1250 1222 $TESTTMP/e
1251 1223 $ hg paths
1252 1224 default = $TESTTMP/d (glob)
1253 1225
1254 1226 $ hg verify --large
1255 1227 checking changesets
1256 1228 checking manifests
1257 1229 crosschecking files in changesets and manifests
1258 1230 checking files
1259 1231 10 files, 10 changesets, 28 total revisions
1260 1232 searching 1 changesets for largefiles
1261 1233 verified existence of 3 revisions of 3 largefiles
1262 1234
1263 1235 - introduce missing blob in local store repo and make sure that this is caught:
1264 1236 $ mv $TESTTMP/d/.hg/largefiles/e166e74c7303192238d60af5a9c4ce9bef0b7928 .
1265 1237 $ hg verify --large
1266 1238 checking changesets
1267 1239 checking manifests
1268 1240 crosschecking files in changesets and manifests
1269 1241 checking files
1270 1242 10 files, 10 changesets, 28 total revisions
1271 1243 searching 1 changesets for largefiles
1272 1244 changeset 9:598410d3eb9a: sub/large4 references missing $TESTTMP/d/.hg/largefiles/e166e74c7303192238d60af5a9c4ce9bef0b7928 (glob)
1273 1245 verified existence of 3 revisions of 3 largefiles
1274 1246 [1]
1275 1247
1276 1248 - introduce corruption and make sure that it is caught when checking content:
1277 1249 $ echo '5 cents' > $TESTTMP/d/.hg/largefiles/e166e74c7303192238d60af5a9c4ce9bef0b7928
1278 1250 $ hg verify -q --large --lfc
1279 1251 changeset 9:598410d3eb9a: sub/large4 references corrupted $TESTTMP/d/.hg/largefiles/e166e74c7303192238d60af5a9c4ce9bef0b7928 (glob)
1280 1252 [1]
1281 1253
1282 1254 - cleanup
1283 1255 $ mv e166e74c7303192238d60af5a9c4ce9bef0b7928 $TESTTMP/d/.hg/largefiles/
1284 1256
1285 1257 - verifying all revisions will fail because we didn't clone all largefiles to d:
1286 1258 $ echo 'T-shirt' > $TESTTMP/d/.hg/largefiles/eb7338044dc27f9bc59b8dd5a246b065ead7a9c4
1287 1259 $ hg verify -q --lfa --lfc
1288 1260 changeset 0:30d30fe6a5be: large1 references missing $TESTTMP/d/.hg/largefiles/4669e532d5b2c093a78eca010077e708a071bb64 (glob)
1289 1261 changeset 0:30d30fe6a5be: sub/large2 references missing $TESTTMP/d/.hg/largefiles/1deebade43c8c498a3c8daddac0244dc55d1331d (glob)
1290 1262 changeset 1:ce8896473775: large1 references missing $TESTTMP/d/.hg/largefiles/5f78770c0e77ba4287ad6ef3071c9bf9c379742f (glob)
1291 1263 changeset 1:ce8896473775: sub/large2 references corrupted $TESTTMP/d/.hg/largefiles/eb7338044dc27f9bc59b8dd5a246b065ead7a9c4 (glob)
1292 1264 changeset 3:9e8fbc4bce62: large1 references corrupted $TESTTMP/d/.hg/largefiles/eb7338044dc27f9bc59b8dd5a246b065ead7a9c4 (glob)
1293 1265 changeset 4:74c02385b94c: large3 references corrupted $TESTTMP/d/.hg/largefiles/eb7338044dc27f9bc59b8dd5a246b065ead7a9c4 (glob)
1294 1266 changeset 4:74c02385b94c: sub/large4 references corrupted $TESTTMP/d/.hg/largefiles/eb7338044dc27f9bc59b8dd5a246b065ead7a9c4 (glob)
1295 1267 changeset 5:9d5af5072dbd: large3 references missing $TESTTMP/d/.hg/largefiles/baaf12afde9d8d67f25dab6dced0d2bf77dba47c (glob)
1296 1268 changeset 5:9d5af5072dbd: sub/large4 references missing $TESTTMP/d/.hg/largefiles/aeb2210d19f02886dde00dac279729a48471e2f9 (glob)
1297 1269 changeset 6:4355d653f84f: large3 references missing $TESTTMP/d/.hg/largefiles/7838695e10da2bb75ac1156565f40a2595fa2fa0 (glob)
1298 1270 [1]
1299 1271
1300 1272 - cleanup
1301 1273 $ rm $TESTTMP/d/.hg/largefiles/eb7338044dc27f9bc59b8dd5a246b065ead7a9c4
1302 1274 $ rm -f .hglf/sub/*.orig
1303 1275
1304 1276 Update to revision with missing largefile - and make sure it really is missing
1305 1277
1306 1278 $ rm ${USERCACHE}/7838695e10da2bb75ac1156565f40a2595fa2fa0
1307 1279 $ hg up -r 6
1308 1280 getting changed largefiles
1309 1281 large3: largefile 7838695e10da2bb75ac1156565f40a2595fa2fa0 not available from file:$TESTTMP/d
1310 1282 1 largefiles updated, 2 removed
1311 1283 4 files updated, 0 files merged, 2 files removed, 0 files unresolved
1312 1284 $ rm normal3
1313 1285 $ echo >> sub/normal4
1314 1286 $ hg ci -m 'commit with missing files'
1315 1287 Invoking status precommit hook
1316 1288 M sub/normal4
1317 1289 ! large3
1318 1290 ! normal3
1319 1291 created new head
1320 1292 $ hg st
1321 1293 ! large3
1322 1294 ! normal3
1323 1295 $ hg up -r.
1324 1296 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
1325 1297 $ hg st
1326 1298 ! large3
1327 1299 ! normal3
1328 1300 $ hg up -Cr.
1329 1301 getting changed largefiles
1330 1302 large3: largefile 7838695e10da2bb75ac1156565f40a2595fa2fa0 not available from file:$TESTTMP/d
1331 1303 0 largefiles updated, 0 removed
1332 1304 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1333 1305 $ hg st
1334 1306 ! large3
1335 1307 $ hg rollback
1336 1308 repository tip rolled back to revision 9 (undo commit)
1337 1309 working directory now based on revision 6
1338 1310
1339 1311 Merge with revision with missing largefile - and make sure it tries to fetch it.
1340 1312
1341 1313 $ hg up -Cqr null
1342 1314 $ echo f > f
1343 1315 $ hg ci -Am branch
1344 1316 adding f
1345 1317 Invoking status precommit hook
1346 1318 A f
1347 1319 created new head
1348 1320 $ hg merge -r 6
1349 1321 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
1350 1322 (branch merge, don't forget to commit)
1351 1323 getting changed largefiles
1352 1324 large3: largefile 7838695e10da2bb75ac1156565f40a2595fa2fa0 not available from file:$TESTTMP/d
1353 1325 1 largefiles updated, 0 removed
1354 1326
1355 1327 $ hg rollback -q
1356 1328 $ hg up -Cq
1357 1329
1358 1330 Pulling 0 revisions with --all-largefiles should not fetch for all revisions
1359 1331
1360 1332 $ hg pull --all-largefiles
1361 1333 pulling from $TESTTMP/d (glob)
1362 1334 searching for changes
1363 1335 no changes found
1364 1336
1365 1337 Merging does not revert to old versions of largefiles and also check
1366 1338 that merging after having pulled from a non-default remote works
1367 1339 correctly.
1368 1340
1369 1341 $ cd ..
1370 1342 $ hg clone -r 7 e temp
1371 1343 adding changesets
1372 1344 adding manifests
1373 1345 adding file changes
1374 1346 added 8 changesets with 24 changes to 10 files
1375 1347 updating to branch default
1376 1348 getting changed largefiles
1377 1349 3 largefiles updated, 0 removed
1378 1350 5 files updated, 0 files merged, 0 files removed, 0 files unresolved
1379 1351 $ hg clone temp f
1380 1352 updating to branch default
1381 1353 getting changed largefiles
1382 1354 3 largefiles updated, 0 removed
1383 1355 5 files updated, 0 files merged, 0 files removed, 0 files unresolved
1384 1356 # Delete the largefiles in the largefiles system cache so that we have an
1385 1357 # opportunity to test that caching after a pull works.
1386 1358 $ rm "${USERCACHE}"/*
1387 1359 $ cd f
1388 1360 $ echo "large4-merge-test" > sub/large4
1389 1361 $ hg commit -m "Modify large4 to test merge"
1390 1362 Invoking status precommit hook
1391 1363 M sub/large4
1392 1364 # Test --cache-largefiles flag
1393 1365 $ hg pull --lfrev 'heads(pulled())' ../e
1394 1366 pulling from ../e
1395 1367 searching for changes
1396 1368 adding changesets
1397 1369 adding manifests
1398 1370 adding file changes
1399 1371 added 2 changesets with 4 changes to 4 files (+1 heads)
1400 1372 (run 'hg heads' to see heads, 'hg merge' to merge)
1401 1373 2 largefiles cached
1402 1374 $ hg merge
1403 1375 merging sub/large4
1404 1376 largefile sub/large4 has a merge conflict
1405 1377 keep (l)ocal or take (o)ther? l
1406 1378 3 files updated, 1 files merged, 0 files removed, 0 files unresolved
1407 1379 (branch merge, don't forget to commit)
1408 1380 getting changed largefiles
1409 1381 1 largefiles updated, 0 removed
1410 1382 $ hg commit -m "Merge repos e and f"
1411 1383 Invoking status precommit hook
1412 1384 M normal3
1413 1385 M sub/normal4
1414 1386 M sub2/large6
1415 1387 $ cat normal3
1416 1388 normal3-modified
1417 1389 $ cat sub/normal4
1418 1390 normal4-modified
1419 1391 $ cat sub/large4
1420 1392 large4-merge-test
1421 1393 $ cat sub2/large6
1422 1394 large6-modified
1423 1395 $ cat sub2/large7
1424 1396 large7
1425 1397
1426 1398 Test status after merging with a branch that introduces a new largefile:
1427 1399
1428 1400 $ echo large > large
1429 1401 $ hg add --large large
1430 1402 $ hg commit -m 'add largefile'
1431 1403 Invoking status precommit hook
1432 1404 A large
1433 1405 $ hg update -q ".^"
1434 1406 $ echo change >> normal3
1435 1407 $ hg commit -m 'some change'
1436 1408 Invoking status precommit hook
1437 1409 M normal3
1438 1410 created new head
1439 1411 $ hg merge
1440 1412 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1441 1413 (branch merge, don't forget to commit)
1442 1414 getting changed largefiles
1443 1415 1 largefiles updated, 0 removed
1444 1416 $ hg status
1445 1417 M large
1446 1418
1447 1419 - make sure update of merge with removed largefiles fails as expected
1448 1420 $ hg rm sub2/large6
1449 1421 $ hg up -r.
1450 1422 abort: outstanding uncommitted merges
1451 1423 [255]
1452 1424
1453 1425 - revert should be able to revert files introduced in a pending merge
1454 1426 $ hg revert --all -r .
1455 1427 removing .hglf/large (glob)
1456 1428 undeleting .hglf/sub2/large6 (glob)
1457 1429
1458 1430 Test that a normal file and a largefile with the same name and path cannot
1459 1431 coexist.
1460 1432
1461 1433 $ rm sub2/large7
1462 1434 $ echo "largeasnormal" > sub2/large7
1463 1435 $ hg add sub2/large7
1464 1436 sub2/large7 already a largefile
1465 1437
1466 1438 Test that transplanting a largefile change works correctly.
1467 1439
1468 1440 $ cd ..
1469 1441 $ hg clone -r 8 d g
1470 1442 adding changesets
1471 1443 adding manifests
1472 1444 adding file changes
1473 1445 added 9 changesets with 26 changes to 10 files
1474 1446 updating to branch default
1475 1447 getting changed largefiles
1476 1448 3 largefiles updated, 0 removed
1477 1449 5 files updated, 0 files merged, 0 files removed, 0 files unresolved
1478 1450 $ cd g
1479 1451 $ hg transplant -s ../d 598410d3eb9a
1480 1452 searching for changes
1481 1453 searching for changes
1482 1454 adding changesets
1483 1455 adding manifests
1484 1456 adding file changes
1485 1457 added 1 changesets with 2 changes to 2 files
1486 1458 getting changed largefiles
1487 1459 1 largefiles updated, 0 removed
1488 1460 $ hg log --template '{rev}:{node|short} {desc|firstline}\n'
1489 1461 9:598410d3eb9a modify normal file largefile in repo d
1490 1462 8:a381d2c8c80e modify normal file and largefile in repo b
1491 1463 7:daea875e9014 add/edit more largefiles
1492 1464 6:4355d653f84f edit files yet again
1493 1465 5:9d5af5072dbd edit files again
1494 1466 4:74c02385b94c move files
1495 1467 3:9e8fbc4bce62 copy files
1496 1468 2:51a0ae4d5864 remove files
1497 1469 1:ce8896473775 edit files
1498 1470 0:30d30fe6a5be add files
1499 1471 $ cat normal3
1500 1472 normal3-modified
1501 1473 $ cat sub/normal4
1502 1474 normal4-modified
1503 1475 $ cat sub/large4
1504 1476 large4-modified
1505 1477 $ cat sub2/large6
1506 1478 large6-modified
1507 1479 $ cat sub2/large7
1508 1480 large7
1509 1481
1510 1482 Cat a largefile
1511 1483 $ hg cat normal3
1512 1484 normal3-modified
1513 1485 $ hg cat sub/large4
1514 1486 large4-modified
1515 1487 $ rm "${USERCACHE}"/*
1516 1488 $ hg cat -r a381d2c8c80e -o cat.out sub/large4
1517 1489 $ cat cat.out
1518 1490 large4-modified
1519 1491 $ rm cat.out
1520 1492 $ hg cat -r a381d2c8c80e normal3
1521 1493 normal3-modified
1522 1494 $ hg cat -r '.^' normal3
1523 1495 normal3-modified
1524 1496 $ hg cat -r '.^' sub/large4 doesntexist
1525 1497 large4-modified
1526 1498 doesntexist: no such file in rev a381d2c8c80e
1527 1499 $ hg --cwd sub cat -r '.^' large4
1528 1500 large4-modified
1529 1501 $ hg --cwd sub cat -r '.^' ../normal3
1530 1502 normal3-modified
1531 1503
1532 1504 Test that renaming a largefile results in correct output for status
1533 1505
1534 1506 $ hg rename sub/large4 large4-renamed
1535 1507 $ hg commit -m "test rename output"
1536 1508 Invoking status precommit hook
1537 1509 A large4-renamed
1538 1510 R sub/large4
1539 1511 $ cat large4-renamed
1540 1512 large4-modified
1541 1513 $ cd sub2
1542 1514 $ hg rename large6 large6-renamed
1543 1515 $ hg st
1544 1516 A sub2/large6-renamed
1545 1517 R sub2/large6
1546 1518 $ cd ..
1547 1519
1548 1520 Test --normal flag
1549 1521
1550 1522 $ dd if=/dev/zero bs=2k count=11k > new-largefile 2> /dev/null
1551 1523 $ hg add --normal --large new-largefile
1552 1524 abort: --normal cannot be used with --large
1553 1525 [255]
1554 1526 $ hg add --normal new-largefile
1555 1527 new-largefile: up to 69 MB of RAM may be required to manage this file
1556 1528 (use 'hg revert new-largefile' to cancel the pending addition)
1557 1529 $ cd ..
1558 1530
1559 1531 #if serve
1560 1532 vanilla clients not locked out from largefiles servers on vanilla repos
1561 1533 $ mkdir r1
1562 1534 $ cd r1
1563 1535 $ hg init
1564 1536 $ echo c1 > f1
1565 1537 $ hg add f1
1566 1538 $ hg commit -m "m1"
1567 1539 Invoking status precommit hook
1568 1540 A f1
1569 1541 $ cd ..
1570 1542 $ hg serve -R r1 -d -p $HGPORT --pid-file hg.pid
1571 1543 $ cat hg.pid >> $DAEMON_PIDS
1572 1544 $ hg --config extensions.largefiles=! clone http://localhost:$HGPORT r2
1573 1545 requesting all changes
1574 1546 adding changesets
1575 1547 adding manifests
1576 1548 adding file changes
1577 1549 added 1 changesets with 1 changes to 1 files
1578 1550 updating to branch default
1579 1551 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1580 1552
1581 1553 largefiles clients still work with vanilla servers
1582 1554 $ hg --config extensions.largefiles=! serve -R r1 -d -p $HGPORT1 --pid-file hg.pid
1583 1555 $ cat hg.pid >> $DAEMON_PIDS
1584 1556 $ hg clone http://localhost:$HGPORT1 r3
1585 1557 requesting all changes
1586 1558 adding changesets
1587 1559 adding manifests
1588 1560 adding file changes
1589 1561 added 1 changesets with 1 changes to 1 files
1590 1562 updating to branch default
1591 1563 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1592 1564 #endif
1593 1565
1594 1566
1595 1567 vanilla clients locked out from largefiles http repos
1596 1568 $ mkdir r4
1597 1569 $ cd r4
1598 1570 $ hg init
1599 1571 $ echo c1 > f1
1600 1572 $ hg add --large f1
1601 1573 $ hg commit -m "m1"
1602 1574 Invoking status precommit hook
1603 1575 A f1
1604 1576 $ cd ..
1605 1577
1606 1578 largefiles can be pushed locally (issue3583)
1607 1579 $ hg init dest
1608 1580 $ cd r4
1609 1581 $ hg outgoing ../dest
1610 1582 comparing with ../dest
1611 1583 searching for changes
1612 1584 changeset: 0:639881c12b4c
1613 1585 tag: tip
1614 1586 user: test
1615 1587 date: Thu Jan 01 00:00:00 1970 +0000
1616 1588 summary: m1
1617 1589
1618 1590 $ hg push ../dest
1619 1591 pushing to ../dest
1620 1592 searching for changes
1621 1593 searching for changes
1622 1594 adding changesets
1623 1595 adding manifests
1624 1596 adding file changes
1625 1597 added 1 changesets with 1 changes to 1 files
1626 1598
1627 1599 exit code with nothing outgoing (issue3611)
1628 1600 $ hg outgoing ../dest
1629 1601 comparing with ../dest
1630 1602 searching for changes
1631 1603 no changes found
1632 1604 [1]
1633 1605 $ cd ..
1634 1606
1635 1607 #if serve
1636 1608 $ hg serve -R r4 -d -p $HGPORT2 --pid-file hg.pid
1637 1609 $ cat hg.pid >> $DAEMON_PIDS
1638 1610 $ hg --config extensions.largefiles=! clone http://localhost:$HGPORT2 r5
1639 1611 abort: remote error:
1640 1612
1641 1613 This repository uses the largefiles extension.
1642 1614
1643 1615 Please enable it in your Mercurial config file.
1644 1616 [255]
1645 1617
1646 1618 used all HGPORTs, kill all daemons
1647 1619 $ "$TESTDIR/killdaemons.py" $DAEMON_PIDS
1648 1620 #endif
1649 1621
1650 1622 vanilla clients locked out from largefiles ssh repos
1651 1623 $ hg --config extensions.largefiles=! clone -e "python \"$TESTDIR/dummyssh\"" ssh://user@dummy/r4 r5
1652 1624 abort: remote error:
1653 1625
1654 1626 This repository uses the largefiles extension.
1655 1627
1656 1628 Please enable it in your Mercurial config file.
1657 1629 [255]
1658 1630
1659 1631 #if serve
1660 1632
1661 1633 largefiles clients refuse to push largefiles repos to vanilla servers
1662 1634 $ mkdir r6
1663 1635 $ cd r6
1664 1636 $ hg init
1665 1637 $ echo c1 > f1
1666 1638 $ hg add f1
1667 1639 $ hg commit -m "m1"
1668 1640 Invoking status precommit hook
1669 1641 A f1
1670 1642 $ cat >> .hg/hgrc <<!
1671 1643 > [web]
1672 1644 > push_ssl = false
1673 1645 > allow_push = *
1674 1646 > !
1675 1647 $ cd ..
1676 1648 $ hg clone r6 r7
1677 1649 updating to branch default
1678 1650 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1679 1651 $ cd r7
1680 1652 $ echo c2 > f2
1681 1653 $ hg add --large f2
1682 1654 $ hg commit -m "m2"
1683 1655 Invoking status precommit hook
1684 1656 A f2
1685 1657 $ hg --config extensions.largefiles=! -R ../r6 serve -d -p $HGPORT --pid-file ../hg.pid
1686 1658 $ cat ../hg.pid >> $DAEMON_PIDS
1687 1659 $ hg push http://localhost:$HGPORT
1688 1660 pushing to http://localhost:$HGPORT/
1689 1661 searching for changes
1690 1662 abort: http://localhost:$HGPORT/ does not appear to be a largefile store
1691 1663 [255]
1692 1664 $ cd ..
1693 1665
1694 1666 putlfile errors are shown (issue3123)
1695 1667 Corrupt the cached largefile in r7 and move it out of the servers usercache
1696 1668 $ mv r7/.hg/largefiles/4cdac4d8b084d0b599525cf732437fb337d422a8 .
1697 1669 $ echo 'client side corruption' > r7/.hg/largefiles/4cdac4d8b084d0b599525cf732437fb337d422a8
1698 1670 $ rm "$USERCACHE/4cdac4d8b084d0b599525cf732437fb337d422a8"
1699 1671 $ hg init empty
1700 1672 $ hg serve -R empty -d -p $HGPORT1 --pid-file hg.pid \
1701 1673 > --config 'web.allow_push=*' --config web.push_ssl=False
1702 1674 $ cat hg.pid >> $DAEMON_PIDS
1703 1675 $ hg push -R r7 http://localhost:$HGPORT1
1704 1676 pushing to http://localhost:$HGPORT1/
1705 1677 searching for changes
1706 1678 remote: largefiles: failed to put 4cdac4d8b084d0b599525cf732437fb337d422a8 into store: largefile contents do not match hash
1707 1679 abort: remotestore: could not put $TESTTMP/r7/.hg/largefiles/4cdac4d8b084d0b599525cf732437fb337d422a8 to remote store http://localhost:$HGPORT1/ (glob)
1708 1680 [255]
1709 1681 $ mv 4cdac4d8b084d0b599525cf732437fb337d422a8 r7/.hg/largefiles/4cdac4d8b084d0b599525cf732437fb337d422a8
1710 1682 Push of file that exists on server but is corrupted - magic healing would be nice ... but too magic
1711 1683 $ echo "server side corruption" > empty/.hg/largefiles/4cdac4d8b084d0b599525cf732437fb337d422a8
1712 1684 $ hg push -R r7 http://localhost:$HGPORT1
1713 1685 pushing to http://localhost:$HGPORT1/
1714 1686 searching for changes
1715 1687 searching for changes
1716 1688 remote: adding changesets
1717 1689 remote: adding manifests
1718 1690 remote: adding file changes
1719 1691 remote: added 2 changesets with 2 changes to 2 files
1720 1692 $ cat empty/.hg/largefiles/4cdac4d8b084d0b599525cf732437fb337d422a8
1721 1693 server side corruption
1722 1694 $ rm -rf empty
1723 1695
1724 1696 Push a largefiles repository to a served empty repository
1725 1697 $ hg init r8
1726 1698 $ echo c3 > r8/f1
1727 1699 $ hg add --large r8/f1 -R r8
1728 1700 $ hg commit -m "m1" -R r8
1729 1701 Invoking status precommit hook
1730 1702 A f1
1731 1703 $ hg init empty
1732 1704 $ hg serve -R empty -d -p $HGPORT2 --pid-file hg.pid \
1733 1705 > --config 'web.allow_push=*' --config web.push_ssl=False
1734 1706 $ cat hg.pid >> $DAEMON_PIDS
1735 1707 $ rm "${USERCACHE}"/*
1736 1708 $ hg push -R r8 http://localhost:$HGPORT2/#default
1737 1709 pushing to http://localhost:$HGPORT2/
1738 1710 searching for changes
1739 1711 searching for changes
1740 1712 remote: adding changesets
1741 1713 remote: adding manifests
1742 1714 remote: adding file changes
1743 1715 remote: added 1 changesets with 1 changes to 1 files
1744 1716 $ [ -f "${USERCACHE}"/02a439e5c31c526465ab1a0ca1f431f76b827b90 ]
1745 1717 $ [ -f empty/.hg/largefiles/02a439e5c31c526465ab1a0ca1f431f76b827b90 ]
1746 1718
1747 1719 Clone over http, no largefiles pulled on clone.
1748 1720
1749 1721 $ hg clone http://localhost:$HGPORT2/#default http-clone -U
1750 1722 adding changesets
1751 1723 adding manifests
1752 1724 adding file changes
1753 1725 added 1 changesets with 1 changes to 1 files
1754 1726
1755 1727 test 'verify' with remotestore:
1756 1728
1757 1729 $ rm "${USERCACHE}"/02a439e5c31c526465ab1a0ca1f431f76b827b90
1758 1730 $ mv empty/.hg/largefiles/02a439e5c31c526465ab1a0ca1f431f76b827b90 .
1759 1731 $ hg -R http-clone verify --large --lfa
1760 1732 checking changesets
1761 1733 checking manifests
1762 1734 crosschecking files in changesets and manifests
1763 1735 checking files
1764 1736 1 files, 1 changesets, 1 total revisions
1765 1737 searching 1 changesets for largefiles
1766 1738 changeset 0:cf03e5bb9936: f1 missing
1767 1739 verified existence of 1 revisions of 1 largefiles
1768 1740 [1]
1769 1741 $ mv 02a439e5c31c526465ab1a0ca1f431f76b827b90 empty/.hg/largefiles/
1770 1742 $ hg -R http-clone -q verify --large --lfa
1771 1743
1772 1744 largefiles pulled on update - a largefile missing on the server:
1773 1745 $ mv empty/.hg/largefiles/02a439e5c31c526465ab1a0ca1f431f76b827b90 .
1774 1746 $ hg -R http-clone up --config largefiles.usercache=http-clone-usercache
1775 1747 getting changed largefiles
1776 1748 f1: largefile 02a439e5c31c526465ab1a0ca1f431f76b827b90 not available from http://localhost:$HGPORT2/
1777 1749 0 largefiles updated, 0 removed
1778 1750 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1779 1751 $ hg -R http-clone st
1780 1752 ! f1
1781 1753 $ hg -R http-clone up -Cqr null
1782 1754
1783 1755 largefiles pulled on update - a largefile corrupted on the server:
1784 1756 $ echo corruption > empty/.hg/largefiles/02a439e5c31c526465ab1a0ca1f431f76b827b90
1785 1757 $ hg -R http-clone up --config largefiles.usercache=http-clone-usercache
1786 1758 getting changed largefiles
1787 1759 f1: data corruption (expected 02a439e5c31c526465ab1a0ca1f431f76b827b90, got 6a7bb2556144babe3899b25e5428123735bb1e27)
1788 1760 0 largefiles updated, 0 removed
1789 1761 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1790 1762 $ hg -R http-clone st
1791 1763 ! f1
1792 1764 $ [ ! -f http-clone/.hg/largefiles/02a439e5c31c526465ab1a0ca1f431f76b827b90 ]
1793 1765 $ [ ! -f http-clone/f1 ]
1794 1766 $ [ ! -f http-clone-usercache ]
1795 1767 $ hg -R http-clone verify --large --lfc
1796 1768 checking changesets
1797 1769 checking manifests
1798 1770 crosschecking files in changesets and manifests
1799 1771 checking files
1800 1772 1 files, 1 changesets, 1 total revisions
1801 1773 searching 1 changesets for largefiles
1802 1774 verified contents of 1 revisions of 1 largefiles
1803 1775 $ hg -R http-clone up -Cqr null
1804 1776
1805 1777 largefiles pulled on update - no server side problems:
1806 1778 $ mv 02a439e5c31c526465ab1a0ca1f431f76b827b90 empty/.hg/largefiles/
1807 1779 $ hg -R http-clone --debug up --config largefiles.usercache=http-clone-usercache
1808 1780 resolving manifests
1809 1781 branchmerge: False, force: False, partial: False
1810 1782 ancestor: 000000000000, local: 000000000000+, remote: cf03e5bb9936
1811 1783 .hglf/f1: remote created -> g
1812 1784 getting .hglf/f1
1813 1785 updating: .hglf/f1 1/1 files (100.00%)
1814 1786 getting changed largefiles
1815 1787 using http://localhost:$HGPORT2/
1816 1788 sending capabilities command
1817 1789 sending batch command
1818 1790 getting largefiles: 0/1 lfile (0.00%)
1819 1791 getting f1:02a439e5c31c526465ab1a0ca1f431f76b827b90
1820 1792 sending getlfile command
1821 1793 found 02a439e5c31c526465ab1a0ca1f431f76b827b90 in store
1822 1794 1 largefiles updated, 0 removed
1823 1795 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1824 1796
1825 1797 $ ls http-clone-usercache/*
1826 1798 http-clone-usercache/02a439e5c31c526465ab1a0ca1f431f76b827b90
1827 1799
1828 1800 $ rm -rf empty http-clone*
1829 1801
1830 1802 used all HGPORTs, kill all daemons
1831 1803 $ "$TESTDIR/killdaemons.py" $DAEMON_PIDS
1832 1804
1833 1805 #endif
1834 1806
1835 1807
1836 1808 #if unix-permissions
1837 1809
1838 1810 Clone a local repository owned by another user
1839 1811 We have to simulate that here by setting $HOME and removing write permissions
1840 1812 $ ORIGHOME="$HOME"
1841 1813 $ mkdir alice
1842 1814 $ HOME="`pwd`/alice"
1843 1815 $ cd alice
1844 1816 $ hg init pubrepo
1845 1817 $ cd pubrepo
1846 1818 $ dd if=/dev/zero bs=1k count=11k > a-large-file 2> /dev/null
1847 1819 $ hg add --large a-large-file
1848 1820 $ hg commit -m "Add a large file"
1849 1821 Invoking status precommit hook
1850 1822 A a-large-file
1851 1823 $ cd ..
1852 1824 $ chmod -R a-w pubrepo
1853 1825 $ cd ..
1854 1826 $ mkdir bob
1855 1827 $ HOME="`pwd`/bob"
1856 1828 $ cd bob
1857 1829 $ hg clone --pull ../alice/pubrepo pubrepo
1858 1830 requesting all changes
1859 1831 adding changesets
1860 1832 adding manifests
1861 1833 adding file changes
1862 1834 added 1 changesets with 1 changes to 1 files
1863 1835 updating to branch default
1864 1836 getting changed largefiles
1865 1837 1 largefiles updated, 0 removed
1866 1838 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1867 1839 $ cd ..
1868 1840 $ chmod -R u+w alice/pubrepo
1869 1841 $ HOME="$ORIGHOME"
1870 1842
1871 1843 #endif
1872 1844
1873 1845 #if symlink
1874 1846
1875 1847 Symlink to a large largefile should behave the same as a symlink to a normal file
1876 1848 $ hg init largesymlink
1877 1849 $ cd largesymlink
1878 1850 $ dd if=/dev/zero bs=1k count=10k of=largefile 2>/dev/null
1879 1851 $ hg add --large largefile
1880 1852 $ hg commit -m "commit a large file"
1881 1853 Invoking status precommit hook
1882 1854 A largefile
1883 1855 $ ln -s largefile largelink
1884 1856 $ hg add largelink
1885 1857 $ hg commit -m "commit a large symlink"
1886 1858 Invoking status precommit hook
1887 1859 A largelink
1888 1860 $ rm -f largelink
1889 1861 $ hg up >/dev/null
1890 1862 $ test -f largelink
1891 1863 [1]
1892 1864 $ test -L largelink
1893 1865 [1]
1894 1866 $ rm -f largelink # make next part of the test independent of the previous
1895 1867 $ hg up -C >/dev/null
1896 1868 $ test -f largelink
1897 1869 $ test -L largelink
1898 1870 $ cd ..
1899 1871
1900 1872 #endif
1901 1873
1902 1874 test for pattern matching on 'hg status':
1903 1875 to boost performance, largefiles checks whether specified patterns are
1904 1876 related to largefiles in working directory (NOT to STANDIN) or not.
1905 1877
1906 1878 $ hg init statusmatch
1907 1879 $ cd statusmatch
1908 1880
1909 1881 $ mkdir -p a/b/c/d
1910 1882 $ echo normal > a/b/c/d/e.normal.txt
1911 1883 $ hg add a/b/c/d/e.normal.txt
1912 1884 $ echo large > a/b/c/d/e.large.txt
1913 1885 $ hg add --large a/b/c/d/e.large.txt
1914 1886 $ mkdir -p a/b/c/x
1915 1887 $ echo normal > a/b/c/x/y.normal.txt
1916 1888 $ hg add a/b/c/x/y.normal.txt
1917 1889 $ hg commit -m 'add files'
1918 1890 Invoking status precommit hook
1919 1891 A a/b/c/d/e.large.txt
1920 1892 A a/b/c/d/e.normal.txt
1921 1893 A a/b/c/x/y.normal.txt
1922 1894
1923 1895 (1) no pattern: no performance boost
1924 1896 $ hg status -A
1925 1897 C a/b/c/d/e.large.txt
1926 1898 C a/b/c/d/e.normal.txt
1927 1899 C a/b/c/x/y.normal.txt
1928 1900
1929 1901 (2) pattern not related to largefiles: performance boost
1930 1902 $ hg status -A a/b/c/x
1931 1903 C a/b/c/x/y.normal.txt
1932 1904
1933 1905 (3) pattern related to largefiles: no performance boost
1934 1906 $ hg status -A a/b/c/d
1935 1907 C a/b/c/d/e.large.txt
1936 1908 C a/b/c/d/e.normal.txt
1937 1909
1938 1910 (4) pattern related to STANDIN (not to largefiles): performance boost
1939 1911 $ hg status -A .hglf/a
1940 1912 C .hglf/a/b/c/d/e.large.txt
1941 1913
1942 1914 (5) mixed case: no performance boost
1943 1915 $ hg status -A a/b/c/x a/b/c/d
1944 1916 C a/b/c/d/e.large.txt
1945 1917 C a/b/c/d/e.normal.txt
1946 1918 C a/b/c/x/y.normal.txt
1947 1919
1948 1920 verify that largefiles doesn't break filesets
1949 1921
1950 1922 $ hg log --rev . --exclude "set:binary()"
1951 1923 changeset: 0:41bd42f10efa
1952 1924 tag: tip
1953 1925 user: test
1954 1926 date: Thu Jan 01 00:00:00 1970 +0000
1955 1927 summary: add files
1956 1928
1957 1929 verify that large files in subrepos handled properly
1958 1930 $ hg init subrepo
1959 1931 $ echo "subrepo = subrepo" > .hgsub
1960 1932 $ hg add .hgsub
1961 1933 $ hg ci -m "add subrepo"
1962 1934 Invoking status precommit hook
1963 1935 A .hgsub
1964 1936 ? .hgsubstate
1965 1937 $ echo "rev 1" > subrepo/large.txt
1966 1938 $ hg -R subrepo add --large subrepo/large.txt
1967 1939 $ hg sum
1968 1940 parent: 1:8ee150ea2e9c tip
1969 1941 add subrepo
1970 1942 branch: default
1971 1943 commit: 1 subrepos
1972 1944 update: (current)
1973 1945 $ hg st
1974 1946 $ hg st -S
1975 1947 A subrepo/large.txt
1976 1948 $ hg ci -S -m "commit top repo"
1977 1949 committing subrepository subrepo
1978 1950 Invoking status precommit hook
1979 1951 A large.txt
1980 1952 Invoking status precommit hook
1981 1953 M .hgsubstate
1982 1954 # No differences
1983 1955 $ hg st -S
1984 1956 $ hg sum
1985 1957 parent: 2:ce4cd0c527a6 tip
1986 1958 commit top repo
1987 1959 branch: default
1988 1960 commit: (clean)
1989 1961 update: (current)
1990 1962 $ echo "rev 2" > subrepo/large.txt
1991 1963 $ hg st -S
1992 1964 M subrepo/large.txt
1993 1965 $ hg sum
1994 1966 parent: 2:ce4cd0c527a6 tip
1995 1967 commit top repo
1996 1968 branch: default
1997 1969 commit: 1 subrepos
1998 1970 update: (current)
1999 1971 $ hg ci -m "this commit should fail without -S"
2000 1972 abort: uncommitted changes in subrepo subrepo
2001 1973 (use --subrepos for recursive commit)
2002 1974 [255]
2003 1975
2004 1976 Add a normal file to the subrepo, then test archiving
2005 1977
2006 1978 $ echo 'normal file' > subrepo/normal.txt
2007 1979 $ hg -R subrepo add subrepo/normal.txt
2008 1980
2009 1981 Lock in subrepo, otherwise the change isn't archived
2010 1982
2011 1983 $ hg ci -S -m "add normal file to top level"
2012 1984 committing subrepository subrepo
2013 1985 Invoking status precommit hook
2014 1986 M large.txt
2015 1987 A normal.txt
2016 1988 Invoking status precommit hook
2017 1989 M .hgsubstate
2018 1990 $ hg archive -S ../lf_subrepo_archive
2019 1991 $ find ../lf_subrepo_archive | sort
2020 1992 ../lf_subrepo_archive
2021 1993 ../lf_subrepo_archive/.hg_archival.txt
2022 1994 ../lf_subrepo_archive/.hgsub
2023 1995 ../lf_subrepo_archive/.hgsubstate
2024 1996 ../lf_subrepo_archive/a
2025 1997 ../lf_subrepo_archive/a/b
2026 1998 ../lf_subrepo_archive/a/b/c
2027 1999 ../lf_subrepo_archive/a/b/c/d
2028 2000 ../lf_subrepo_archive/a/b/c/d/e.large.txt
2029 2001 ../lf_subrepo_archive/a/b/c/d/e.normal.txt
2030 2002 ../lf_subrepo_archive/a/b/c/x
2031 2003 ../lf_subrepo_archive/a/b/c/x/y.normal.txt
2032 2004 ../lf_subrepo_archive/subrepo
2033 2005 ../lf_subrepo_archive/subrepo/large.txt
2034 2006 ../lf_subrepo_archive/subrepo/normal.txt
2035 2007
2036 2008 Test update with subrepos.
2037 2009
2038 2010 $ hg update 0
2039 2011 getting changed largefiles
2040 2012 0 largefiles updated, 1 removed
2041 2013 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
2042 2014 $ hg status -S
2043 2015 $ hg update tip
2044 2016 getting changed largefiles
2045 2017 1 largefiles updated, 0 removed
2046 2018 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
2047 2019 $ hg status -S
2048 2020 # modify a large file
2049 2021 $ echo "modified" > subrepo/large.txt
2050 2022 $ hg st -S
2051 2023 M subrepo/large.txt
2052 2024 # update -C should revert the change.
2053 2025 $ hg update -C
2054 2026 getting changed largefiles
2055 2027 1 largefiles updated, 0 removed
2056 2028 getting changed largefiles
2057 2029 0 largefiles updated, 0 removed
2058 2030 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
2059 2031 $ hg status -S
2060 2032
2061 2033 Test archiving a revision that references a subrepo that is not yet
2062 2034 cloned (see test-subrepo-recursion.t):
2063 2035
2064 2036 $ hg clone -U . ../empty
2065 2037 $ cd ../empty
2066 2038 $ hg archive --subrepos -r tip ../archive.tar.gz
2067 2039 cloning subrepo subrepo from $TESTTMP/statusmatch/subrepo
2068 2040 $ cd ..
2069 2041
2070 2042 Test that addremove picks up largefiles prior to the initial commit (issue3541)
2071 2043
2072 2044 $ hg init addrm2
2073 2045 $ cd addrm2
2074 2046 $ touch large.dat
2075 2047 $ touch large2.dat
2076 2048 $ touch normal
2077 2049 $ hg add --large large.dat
2078 2050 $ hg addremove -v
2079 2051 adding large2.dat as a largefile
2080 2052 adding normal
2081 2053
2082 2054 Test that forgetting all largefiles reverts to islfilesrepo() == False
2083 2055 (addremove will add *.dat as normal files now)
2084 2056 $ hg forget large.dat
2085 2057 $ hg forget large2.dat
2086 2058 $ hg addremove -v
2087 2059 adding large.dat
2088 2060 adding large2.dat
2089 2061
2090 2062 Test commit's addremove option prior to the first commit
2091 2063 $ hg forget large.dat
2092 2064 $ hg forget large2.dat
2093 2065 $ hg add --large large.dat
2094 2066 $ hg ci -Am "commit"
2095 2067 adding large2.dat as a largefile
2096 2068 Invoking status precommit hook
2097 2069 A large.dat
2098 2070 A large2.dat
2099 2071 A normal
2100 2072 $ find .hglf | sort
2101 2073 .hglf
2102 2074 .hglf/large.dat
2103 2075 .hglf/large2.dat
2104 2076
2105 2077 Test actions on largefiles using relative paths from subdir
2106 2078
2107 2079 $ mkdir sub
2108 2080 $ cd sub
2109 2081 $ echo anotherlarge > anotherlarge
2110 2082 $ hg add --large anotherlarge
2111 2083 $ hg st
2112 2084 A sub/anotherlarge
2113 2085 $ hg st anotherlarge
2114 2086 A anotherlarge
2115 2087 $ hg commit -m anotherlarge anotherlarge
2116 2088 Invoking status precommit hook
2117 2089 A sub/anotherlarge
2118 2090 $ hg log anotherlarge
2119 2091 changeset: 1:9627a577c5e9
2120 2092 tag: tip
2121 2093 user: test
2122 2094 date: Thu Jan 01 00:00:00 1970 +0000
2123 2095 summary: anotherlarge
2124 2096
2125 2097 $ echo more >> anotherlarge
2126 2098 $ hg st .
2127 2099 M anotherlarge
2128 2100 $ hg cat anotherlarge
2129 2101 anotherlarge
2130 2102 $ hg revert anotherlarge
2131 2103 $ hg st
2132 2104 ? sub/anotherlarge.orig
2133 2105 $ cd ..
2134 2106
2135 2107 $ cd ..
2136 2108
2137 2109 issue3651: summary/outgoing with largefiles shows "no remote repo"
2138 2110 unexpectedly
2139 2111
2140 2112 $ mkdir issue3651
2141 2113 $ cd issue3651
2142 2114
2143 2115 $ hg init src
2144 2116 $ echo a > src/a
2145 2117 $ hg -R src add --large src/a
2146 2118 $ hg -R src commit -m '#0'
2147 2119 Invoking status precommit hook
2148 2120 A a
2149 2121
2150 2122 check messages when no remote repository is specified:
2151 2123 "no remote repo" route for "hg outgoing --large" is not tested here,
2152 2124 because it can't be reproduced easily.
2153 2125
2154 2126 $ hg init clone1
2155 2127 $ hg -R clone1 -q pull src
2156 2128 $ hg -R clone1 -q update
2157 2129 $ hg -R clone1 paths | grep default
2158 2130 [1]
2159 2131
2160 2132 $ hg -R clone1 summary --large
2161 2133 parent: 0:fc0bd45326d3 tip
2162 2134 #0
2163 2135 branch: default
2164 2136 commit: (clean)
2165 2137 update: (current)
2166 2138 largefiles: (no remote repo)
2167 2139
2168 2140 check messages when there is no files to upload:
2169 2141
2170 2142 $ hg -q clone src clone2
2171 2143 $ hg -R clone2 paths | grep default
2172 2144 default = $TESTTMP/issue3651/src (glob)
2173 2145
2174 2146 $ hg -R clone2 summary --large
2175 2147 parent: 0:fc0bd45326d3 tip
2176 2148 #0
2177 2149 branch: default
2178 2150 commit: (clean)
2179 2151 update: (current)
2180 2152 searching for changes
2181 2153 largefiles: (no files to upload)
2182 2154 $ hg -R clone2 outgoing --large
2183 2155 comparing with $TESTTMP/issue3651/src (glob)
2184 2156 searching for changes
2185 2157 no changes found
2186 2158 searching for changes
2187 2159 largefiles: no files to upload
2188 2160 [1]
2189 2161
2190 2162 check messages when there are files to upload:
2191 2163
2192 2164 $ echo b > clone2/b
2193 2165 $ hg -R clone2 add --large clone2/b
2194 2166 $ hg -R clone2 commit -m '#1'
2195 2167 Invoking status precommit hook
2196 2168 A b
2197 2169 $ hg -R clone2 summary --large
2198 2170 parent: 1:1acbe71ce432 tip
2199 2171 #1
2200 2172 branch: default
2201 2173 commit: (clean)
2202 2174 update: (current)
2203 2175 searching for changes
2204 2176 largefiles: 1 to upload
2205 2177 $ hg -R clone2 outgoing --large
2206 2178 comparing with $TESTTMP/issue3651/src (glob)
2207 2179 searching for changes
2208 2180 changeset: 1:1acbe71ce432
2209 2181 tag: tip
2210 2182 user: test
2211 2183 date: Thu Jan 01 00:00:00 1970 +0000
2212 2184 summary: #1
2213 2185
2214 2186 searching for changes
2215 2187 largefiles to upload:
2216 2188 b
2217 2189
2218 2190
2219 2191 $ cd ..
General Comments 0
You need to be logged in to leave comments. Login now