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