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