##// END OF EJS Templates
largefiles: suppress unexpected warning of 'hg status' for removed files...
FUJIWARA Katsunori -
r16281:d8cc6711 stable
parent child Browse files
Show More
@@ -1,458 +1,458 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
18 18 import lfcommands
19 19 import proto
20 20 import lfutil
21 21
22 22 def reposetup(ui, repo):
23 23 # wire repositories should be given new wireproto functions but not the
24 24 # other largefiles modifications
25 25 if not repo.local():
26 26 return proto.wirereposetup(ui, repo)
27 27
28 28 for name in ('status', 'commitctx', 'commit', 'push'):
29 29 method = getattr(repo, name)
30 30 if (isinstance(method, types.FunctionType) and
31 31 method.func_name == 'wrap'):
32 32 ui.warn(_('largefiles: repo method %r appears to have already been'
33 33 ' wrapped by another extension: '
34 34 'largefiles may behave incorrectly\n')
35 35 % name)
36 36
37 37 class lfiles_repo(repo.__class__):
38 38 lfstatus = False
39 39 def status_nolfiles(self, *args, **kwargs):
40 40 return super(lfiles_repo, self).status(*args, **kwargs)
41 41
42 42 # When lfstatus is set, return a context that gives the names
43 43 # of largefiles instead of their corresponding standins and
44 44 # identifies the largefiles as always binary, regardless of
45 45 # their actual contents.
46 46 def __getitem__(self, changeid):
47 47 ctx = super(lfiles_repo, self).__getitem__(changeid)
48 48 if self.lfstatus:
49 49 class lfiles_manifestdict(manifest.manifestdict):
50 50 def __contains__(self, filename):
51 51 if super(lfiles_manifestdict,
52 52 self).__contains__(filename):
53 53 return True
54 54 return super(lfiles_manifestdict,
55 55 self).__contains__(lfutil.standin(filename))
56 56 class lfiles_ctx(ctx.__class__):
57 57 def files(self):
58 58 filenames = super(lfiles_ctx, self).files()
59 59 return [lfutil.splitstandin(f) or f for f in filenames]
60 60 def manifest(self):
61 61 man1 = super(lfiles_ctx, self).manifest()
62 62 man1.__class__ = lfiles_manifestdict
63 63 return man1
64 64 def filectx(self, path, fileid=None, filelog=None):
65 65 try:
66 66 if filelog is not None:
67 67 result = super(lfiles_ctx, self).filectx(
68 68 path, fileid, filelog)
69 69 else:
70 70 result = super(lfiles_ctx, self).filectx(
71 71 path, fileid)
72 72 except error.LookupError:
73 73 # Adding a null character will cause Mercurial to
74 74 # identify this as a binary file.
75 75 if filelog is not None:
76 76 result = super(lfiles_ctx, self).filectx(
77 77 lfutil.standin(path), fileid, filelog)
78 78 else:
79 79 result = super(lfiles_ctx, self).filectx(
80 80 lfutil.standin(path), fileid)
81 81 olddata = result.data
82 82 result.data = lambda: olddata() + '\0'
83 83 return result
84 84 ctx.__class__ = lfiles_ctx
85 85 return ctx
86 86
87 87 # Figure out the status of big files and insert them into the
88 88 # appropriate list in the result. Also removes standin files
89 89 # from the listing. Revert to the original status if
90 90 # self.lfstatus is False.
91 91 def status(self, node1='.', node2=None, match=None, ignored=False,
92 92 clean=False, unknown=False, listsubrepos=False):
93 93 listignored, listclean, listunknown = ignored, clean, unknown
94 94 if not self.lfstatus:
95 95 return super(lfiles_repo, self).status(node1, node2, match,
96 96 listignored, listclean, listunknown, listsubrepos)
97 97 else:
98 98 # some calls in this function rely on the old version of status
99 99 self.lfstatus = False
100 100 if isinstance(node1, context.changectx):
101 101 ctx1 = node1
102 102 else:
103 103 ctx1 = repo[node1]
104 104 if isinstance(node2, context.changectx):
105 105 ctx2 = node2
106 106 else:
107 107 ctx2 = repo[node2]
108 108 working = ctx2.rev() is None
109 109 parentworking = working and ctx1 == self['.']
110 110
111 111 def inctx(file, ctx):
112 112 try:
113 113 if ctx.rev() is None:
114 114 return file in ctx.manifest()
115 115 ctx[file]
116 116 return True
117 117 except KeyError:
118 118 return False
119 119
120 120 if match is None:
121 121 match = match_.always(self.root, self.getcwd())
122 122
123 123 # First check if there were files specified on the
124 124 # command line. If there were, and none of them were
125 125 # largefiles, we should just bail here and let super
126 126 # handle it -- thus gaining a big performance boost.
127 127 lfdirstate = lfutil.openlfdirstate(ui, self)
128 128 if match.files() and not match.anypats():
129 129 for f in lfdirstate:
130 130 if match(f):
131 131 break
132 132 else:
133 133 return super(lfiles_repo, self).status(node1, node2,
134 134 match, listignored, listclean,
135 135 listunknown, listsubrepos)
136 136
137 137 # Create a copy of match that matches standins instead
138 138 # of largefiles.
139 139 def tostandin(file):
140 if inctx(lfutil.standin(file), ctx2):
140 if working and lfutil.standin(file) in repo.dirstate:
141 141 return lfutil.standin(file)
142 142 return file
143 143
144 144 # Create a function that we can use to override what is
145 145 # normally the ignore matcher. We've already checked
146 146 # for ignored files on the first dirstate walk, and
147 147 # unecessarily re-checking here causes a huge performance
148 148 # hit because lfdirstate only knows about largefiles
149 149 def _ignoreoverride(self):
150 150 return False
151 151
152 152 m = copy.copy(match)
153 153 m._files = [tostandin(f) for f in m._files]
154 154
155 155 # Get ignored files here even if we weren't asked for them; we
156 156 # must use the result here for filtering later
157 157 result = super(lfiles_repo, self).status(node1, node2, m,
158 158 True, clean, unknown, listsubrepos)
159 159 if working:
160 160 try:
161 161 # Any non-largefiles that were explicitly listed must be
162 162 # taken out or lfdirstate.status will report an error.
163 163 # The status of these files was already computed using
164 164 # super's status.
165 165 # Override lfdirstate's ignore matcher to not do
166 166 # anything
167 167 orig_ignore = lfdirstate._ignore
168 168 lfdirstate._ignore = _ignoreoverride
169 169
170 170 match._files = [f for f in match._files if f in
171 171 lfdirstate]
172 172 # Don't waste time getting the ignored and unknown
173 173 # files again; we already have them
174 174 s = lfdirstate.status(match, [], False,
175 175 listclean, False)
176 176 (unsure, modified, added, removed, missing, unknown,
177 177 ignored, clean) = s
178 178 # Replace the list of ignored and unknown files with
179 179 # the previously caclulated lists, and strip out the
180 180 # largefiles
181 181 lfiles = set(lfdirstate._map)
182 182 ignored = set(result[5]).difference(lfiles)
183 183 unknown = set(result[4]).difference(lfiles)
184 184 if parentworking:
185 185 for lfile in unsure:
186 186 standin = lfutil.standin(lfile)
187 187 if standin not in ctx1:
188 188 # from second parent
189 189 modified.append(lfile)
190 190 elif ctx1[standin].data().strip() \
191 191 != lfutil.hashfile(self.wjoin(lfile)):
192 192 modified.append(lfile)
193 193 else:
194 194 clean.append(lfile)
195 195 lfdirstate.normal(lfile)
196 196 else:
197 197 tocheck = unsure + modified + added + clean
198 198 modified, added, clean = [], [], []
199 199
200 200 for lfile in tocheck:
201 201 standin = lfutil.standin(lfile)
202 202 if inctx(standin, ctx1):
203 203 if ctx1[standin].data().strip() != \
204 204 lfutil.hashfile(self.wjoin(lfile)):
205 205 modified.append(lfile)
206 206 else:
207 207 clean.append(lfile)
208 208 else:
209 209 added.append(lfile)
210 210 finally:
211 211 # Replace the original ignore function
212 212 lfdirstate._ignore = orig_ignore
213 213
214 214 for standin in ctx1.manifest():
215 215 if not lfutil.isstandin(standin):
216 216 continue
217 217 lfile = lfutil.splitstandin(standin)
218 218 if not match(lfile):
219 219 continue
220 220 if lfile not in lfdirstate:
221 221 removed.append(lfile)
222 222
223 223 # Filter result lists
224 224 result = list(result)
225 225
226 226 # Largefiles are not really removed when they're
227 227 # still in the normal dirstate. Likewise, normal
228 228 # files are not really removed if it's still in
229 229 # lfdirstate. This happens in merges where files
230 230 # change type.
231 231 removed = [f for f in removed if f not in repo.dirstate]
232 232 result[2] = [f for f in result[2] if f not in lfdirstate]
233 233
234 234 # Unknown files
235 235 unknown = set(unknown).difference(ignored)
236 236 result[4] = [f for f in unknown
237 237 if (repo.dirstate[f] == '?' and
238 238 not lfutil.isstandin(f))]
239 239 # Ignored files were calculated earlier by the dirstate,
240 240 # and we already stripped out the largefiles from the list
241 241 result[5] = ignored
242 242 # combine normal files and largefiles
243 243 normals = [[fn for fn in filelist
244 244 if not lfutil.isstandin(fn)]
245 245 for filelist in result]
246 246 lfiles = (modified, added, removed, missing, [], [], clean)
247 247 result = [sorted(list1 + list2)
248 248 for (list1, list2) in zip(normals, lfiles)]
249 249 else:
250 250 def toname(f):
251 251 if lfutil.isstandin(f):
252 252 return lfutil.splitstandin(f)
253 253 return f
254 254 result = [[toname(f) for f in items] for items in result]
255 255
256 256 if not listunknown:
257 257 result[4] = []
258 258 if not listignored:
259 259 result[5] = []
260 260 if not listclean:
261 261 result[6] = []
262 262 self.lfstatus = True
263 263 return result
264 264
265 265 # As part of committing, copy all of the largefiles into the
266 266 # cache.
267 267 def commitctx(self, *args, **kwargs):
268 268 node = super(lfiles_repo, self).commitctx(*args, **kwargs)
269 269 lfutil.copyalltostore(self, node)
270 270 return node
271 271
272 272 # Before commit, largefile standins have not had their
273 273 # contents updated to reflect the hash of their largefile.
274 274 # Do that here.
275 275 def commit(self, text="", user=None, date=None, match=None,
276 276 force=False, editor=False, extra={}):
277 277 orig = super(lfiles_repo, self).commit
278 278
279 279 wlock = repo.wlock()
280 280 try:
281 281 # Case 0: Rebase or Transplant
282 282 # We have to take the time to pull down the new largefiles now.
283 283 # Otherwise, any largefiles that were modified in the
284 284 # destination changesets get overwritten, either by the rebase
285 285 # or in the first commit after the rebase or transplant.
286 286 # updatelfiles will update the dirstate to mark any pulled
287 287 # largefiles as modified
288 288 if getattr(repo, "_isrebasing", False) or \
289 289 getattr(repo, "_istransplanting", False):
290 290 lfcommands.updatelfiles(repo.ui, repo, filelist=None,
291 291 printmessage=False)
292 292 result = orig(text=text, user=user, date=date, match=match,
293 293 force=force, editor=editor, extra=extra)
294 294 return result
295 295 # Case 1: user calls commit with no specific files or
296 296 # include/exclude patterns: refresh and commit all files that
297 297 # are "dirty".
298 298 if ((match is None) or
299 299 (not match.anypats() and not match.files())):
300 300 # Spend a bit of time here to get a list of files we know
301 301 # are modified so we can compare only against those.
302 302 # It can cost a lot of time (several seconds)
303 303 # otherwise to update all standins if the largefiles are
304 304 # large.
305 305 lfdirstate = lfutil.openlfdirstate(ui, self)
306 306 dirtymatch = match_.always(repo.root, repo.getcwd())
307 307 s = lfdirstate.status(dirtymatch, [], False, False, False)
308 308 modifiedfiles = []
309 309 for i in s:
310 310 modifiedfiles.extend(i)
311 311 lfiles = lfutil.listlfiles(self)
312 312 # this only loops through largefiles that exist (not
313 313 # removed/renamed)
314 314 for lfile in lfiles:
315 315 if lfile in modifiedfiles:
316 316 if os.path.exists(self.wjoin(lfutil.standin(lfile))):
317 317 # this handles the case where a rebase is being
318 318 # performed and the working copy is not updated
319 319 # yet.
320 320 if os.path.exists(self.wjoin(lfile)):
321 321 lfutil.updatestandin(self,
322 322 lfutil.standin(lfile))
323 323 lfdirstate.normal(lfile)
324 324 for lfile in lfdirstate:
325 325 if lfile in modifiedfiles:
326 326 if not os.path.exists(
327 327 repo.wjoin(lfutil.standin(lfile))):
328 328 lfdirstate.drop(lfile)
329 329
330 330 result = orig(text=text, user=user, date=date, match=match,
331 331 force=force, editor=editor, extra=extra)
332 332 # This needs to be after commit; otherwise precommit hooks
333 333 # get the wrong status
334 334 lfdirstate.write()
335 335 return result
336 336
337 337 for f in match.files():
338 338 if lfutil.isstandin(f):
339 339 raise util.Abort(
340 340 _('file "%s" is a largefile standin') % f,
341 341 hint=('commit the largefile itself instead'))
342 342
343 343 # Case 2: user calls commit with specified patterns: refresh
344 344 # any matching big files.
345 345 smatcher = lfutil.composestandinmatcher(self, match)
346 346 standins = lfutil.dirstate_walk(self.dirstate, smatcher)
347 347
348 348 # No matching big files: get out of the way and pass control to
349 349 # the usual commit() method.
350 350 if not standins:
351 351 return orig(text=text, user=user, date=date, match=match,
352 352 force=force, editor=editor, extra=extra)
353 353
354 354 # Refresh all matching big files. It's possible that the
355 355 # commit will end up failing, in which case the big files will
356 356 # stay refreshed. No harm done: the user modified them and
357 357 # asked to commit them, so sooner or later we're going to
358 358 # refresh the standins. Might as well leave them refreshed.
359 359 lfdirstate = lfutil.openlfdirstate(ui, self)
360 360 for standin in standins:
361 361 lfile = lfutil.splitstandin(standin)
362 362 if lfdirstate[lfile] <> 'r':
363 363 lfutil.updatestandin(self, standin)
364 364 lfdirstate.normal(lfile)
365 365 else:
366 366 lfdirstate.drop(lfile)
367 367
368 368 # Cook up a new matcher that only matches regular files or
369 369 # standins corresponding to the big files requested by the
370 370 # user. Have to modify _files to prevent commit() from
371 371 # complaining "not tracked" for big files.
372 372 lfiles = lfutil.listlfiles(repo)
373 373 match = copy.copy(match)
374 374 orig_matchfn = match.matchfn
375 375
376 376 # Check both the list of largefiles and the list of
377 377 # standins because if a largefile was removed, it
378 378 # won't be in the list of largefiles at this point
379 379 match._files += sorted(standins)
380 380
381 381 actualfiles = []
382 382 for f in match._files:
383 383 fstandin = lfutil.standin(f)
384 384
385 385 # ignore known largefiles and standins
386 386 if f in lfiles or fstandin in standins:
387 387 continue
388 388
389 389 # append directory separator to avoid collisions
390 390 if not fstandin.endswith(os.sep):
391 391 fstandin += os.sep
392 392
393 393 # prevalidate matching standin directories
394 394 if util.any(st for st in match._files
395 395 if st.startswith(fstandin)):
396 396 continue
397 397 actualfiles.append(f)
398 398 match._files = actualfiles
399 399
400 400 def matchfn(f):
401 401 if orig_matchfn(f):
402 402 return f not in lfiles
403 403 else:
404 404 return f in standins
405 405
406 406 match.matchfn = matchfn
407 407 result = orig(text=text, user=user, date=date, match=match,
408 408 force=force, editor=editor, extra=extra)
409 409 # This needs to be after commit; otherwise precommit hooks
410 410 # get the wrong status
411 411 lfdirstate.write()
412 412 return result
413 413 finally:
414 414 wlock.release()
415 415
416 416 def push(self, remote, force=False, revs=None, newbranch=False):
417 417 o = lfutil.findoutgoing(repo, remote, force)
418 418 if o:
419 419 toupload = set()
420 420 o = repo.changelog.nodesbetween(o, revs)[0]
421 421 for n in o:
422 422 parents = [p for p in repo.changelog.parents(n)
423 423 if p != node_.nullid]
424 424 ctx = repo[n]
425 425 files = set(ctx.files())
426 426 if len(parents) == 2:
427 427 mc = ctx.manifest()
428 428 mp1 = ctx.parents()[0].manifest()
429 429 mp2 = ctx.parents()[1].manifest()
430 430 for f in mp1:
431 431 if f not in mc:
432 432 files.add(f)
433 433 for f in mp2:
434 434 if f not in mc:
435 435 files.add(f)
436 436 for f in mc:
437 437 if mc[f] != mp1.get(f, None) or mc[f] != mp2.get(f,
438 438 None):
439 439 files.add(f)
440 440
441 441 toupload = toupload.union(
442 442 set([ctx[f].data().strip()
443 443 for f in files
444 444 if lfutil.isstandin(f) and f in ctx]))
445 445 lfcommands.uploadlfiles(ui, self, remote, toupload)
446 446 return super(lfiles_repo, self).push(remote, force, revs,
447 447 newbranch)
448 448
449 449 repo.__class__ = lfiles_repo
450 450
451 451 def checkrequireslfiles(ui, repo, **kwargs):
452 452 if 'largefiles' not in repo.requirements and util.any(
453 453 lfutil.shortname+'/' in f[0] for f in repo.store.datafiles()):
454 454 repo.requirements.add('largefiles')
455 455 repo._writerequirements()
456 456
457 457 ui.setconfig('hooks', 'changegroup.lfiles', checkrequireslfiles)
458 458 ui.setconfig('hooks', 'commit.lfiles', checkrequireslfiles)
@@ -1,1007 +1,1009 b''
1 1 $ "$TESTDIR/hghave" symlink unix-permissions serve || exit 80
2 2 $ USERCACHE=`pwd`/cache; export USERCACHE
3 3 $ mkdir -p ${USERCACHE}
4 4 $ cat >> $HGRCPATH <<EOF
5 5 > [extensions]
6 6 > largefiles=
7 7 > purge=
8 8 > rebase=
9 9 > transplant=
10 10 > [phases]
11 11 > publish=False
12 12 > [largefiles]
13 13 > minsize=2
14 14 > patterns=glob:**.dat
15 15 > usercache=${USERCACHE}
16 16 > [hooks]
17 17 > precommit=echo "Invoking status precommit hook"; hg status
18 18 > EOF
19 19
20 20 Create the repo with a couple of revisions of both large and normal
21 21 files, testing that status correctly shows largefiles and that summary output
22 22 is correct.
23 23
24 24 $ hg init a
25 25 $ cd a
26 26 $ mkdir sub
27 27 $ echo normal1 > normal1
28 28 $ echo normal2 > sub/normal2
29 29 $ echo large1 > large1
30 30 $ echo large2 > sub/large2
31 31 $ hg add normal1 sub/normal2
32 32 $ hg add --large large1 sub/large2
33 33 $ hg commit -m "add files"
34 34 Invoking status precommit hook
35 35 A large1
36 36 A normal1
37 37 A sub/large2
38 38 A sub/normal2
39 39 $ echo normal11 > normal1
40 40 $ echo normal22 > sub/normal2
41 41 $ echo large11 > large1
42 42 $ echo large22 > sub/large2
43 43 $ hg commit -m "edit files"
44 44 Invoking status precommit hook
45 45 M large1
46 46 M normal1
47 47 M sub/large2
48 48 M sub/normal2
49 49 $ hg sum --large
50 50 parent: 1:ce8896473775 tip
51 51 edit files
52 52 branch: default
53 53 commit: (clean)
54 54 update: (current)
55 55 largefiles: No remote repo
56 56
57 57 Commit preserved largefile contents.
58 58
59 59 $ cat normal1
60 60 normal11
61 61 $ cat large1
62 62 large11
63 63 $ cat sub/normal2
64 64 normal22
65 65 $ cat sub/large2
66 66 large22
67 67
68 68 Remove both largefiles and normal files.
69 69
70 70 $ hg remove normal1 large1
71 $ hg status large1
72 R large1
71 73 $ hg commit -m "remove files"
72 74 Invoking status precommit hook
73 75 R large1
74 76 R normal1
75 77 $ ls
76 78 sub
77 79 $ echo "testlargefile" > large1-test
78 80 $ hg add --large large1-test
79 81 $ hg st
80 82 A large1-test
81 83 $ hg rm large1-test
82 84 not removing large1-test: file has been marked for add (use forget to undo)
83 85 $ hg st
84 86 A large1-test
85 87 $ hg forget large1-test
86 88 $ hg st
87 89 ? large1-test
88 90 $ rm large1-test
89 91
90 92 Copy both largefiles and normal files (testing that status output is correct).
91 93
92 94 $ hg cp sub/normal2 normal1
93 95 $ hg cp sub/large2 large1
94 96 $ hg commit -m "copy files"
95 97 Invoking status precommit hook
96 98 A large1
97 99 A normal1
98 100 $ cat normal1
99 101 normal22
100 102 $ cat large1
101 103 large22
102 104
103 105 Test moving largefiles and verify that normal files are also unaffected.
104 106
105 107 $ hg mv normal1 normal3
106 108 $ hg mv large1 large3
107 109 $ hg mv sub/normal2 sub/normal4
108 110 $ hg mv sub/large2 sub/large4
109 111 $ hg commit -m "move files"
110 112 Invoking status precommit hook
111 113 A large3
112 114 A normal3
113 115 A sub/large4
114 116 A sub/normal4
115 117 R large1
116 118 R normal1
117 119 R sub/large2
118 120 R sub/normal2
119 121 $ cat normal3
120 122 normal22
121 123 $ cat large3
122 124 large22
123 125 $ cat sub/normal4
124 126 normal22
125 127 $ cat sub/large4
126 128 large22
127 129
128 130 Test archiving the various revisions. These hit corner cases known with
129 131 archiving.
130 132
131 133 $ hg archive -r 0 ../archive0
132 134 $ hg archive -r 1 ../archive1
133 135 $ hg archive -r 2 ../archive2
134 136 $ hg archive -r 3 ../archive3
135 137 $ hg archive -r 4 ../archive4
136 138 $ cd ../archive0
137 139 $ cat normal1
138 140 normal1
139 141 $ cat large1
140 142 large1
141 143 $ cat sub/normal2
142 144 normal2
143 145 $ cat sub/large2
144 146 large2
145 147 $ cd ../archive1
146 148 $ cat normal1
147 149 normal11
148 150 $ cat large1
149 151 large11
150 152 $ cat sub/normal2
151 153 normal22
152 154 $ cat sub/large2
153 155 large22
154 156 $ cd ../archive2
155 157 $ ls
156 158 sub
157 159 $ cat sub/normal2
158 160 normal22
159 161 $ cat sub/large2
160 162 large22
161 163 $ cd ../archive3
162 164 $ cat normal1
163 165 normal22
164 166 $ cat large1
165 167 large22
166 168 $ cat sub/normal2
167 169 normal22
168 170 $ cat sub/large2
169 171 large22
170 172 $ cd ../archive4
171 173 $ cat normal3
172 174 normal22
173 175 $ cat large3
174 176 large22
175 177 $ cat sub/normal4
176 178 normal22
177 179 $ cat sub/large4
178 180 large22
179 181
180 182 Commit corner case: specify files to commit.
181 183
182 184 $ cd ../a
183 185 $ echo normal3 > normal3
184 186 $ echo large3 > large3
185 187 $ echo normal4 > sub/normal4
186 188 $ echo large4 > sub/large4
187 189 $ hg commit normal3 large3 sub/normal4 sub/large4 -m "edit files again"
188 190 Invoking status precommit hook
189 191 M large3
190 192 M normal3
191 193 M sub/large4
192 194 M sub/normal4
193 195 $ cat normal3
194 196 normal3
195 197 $ cat large3
196 198 large3
197 199 $ cat sub/normal4
198 200 normal4
199 201 $ cat sub/large4
200 202 large4
201 203
202 204 One more commit corner case: commit from a subdirectory.
203 205
204 206 $ cd ../a
205 207 $ echo normal33 > normal3
206 208 $ echo large33 > large3
207 209 $ echo normal44 > sub/normal4
208 210 $ echo large44 > sub/large4
209 211 $ cd sub
210 212 $ hg commit -m "edit files yet again"
211 213 Invoking status precommit hook
212 214 M large3
213 215 M normal3
214 216 M sub/large4
215 217 M sub/normal4
216 218 $ cat ../normal3
217 219 normal33
218 220 $ cat ../large3
219 221 large33
220 222 $ cat normal4
221 223 normal44
222 224 $ cat large4
223 225 large44
224 226
225 227 Committing standins is not allowed.
226 228
227 229 $ cd ..
228 230 $ echo large3 > large3
229 231 $ hg commit .hglf/large3 -m "try to commit standin"
230 232 abort: file ".hglf/large3" is a largefile standin
231 233 (commit the largefile itself instead)
232 234 [255]
233 235
234 236 Corner cases for adding largefiles.
235 237
236 238 $ echo large5 > large5
237 239 $ hg add --large large5
238 240 $ hg add --large large5
239 241 large5 already a largefile
240 242 $ mkdir sub2
241 243 $ echo large6 > sub2/large6
242 244 $ echo large7 > sub2/large7
243 245 $ hg add --large sub2
244 246 adding sub2/large6 as a largefile (glob)
245 247 adding sub2/large7 as a largefile (glob)
246 248 $ hg st
247 249 M large3
248 250 A large5
249 251 A sub2/large6
250 252 A sub2/large7
251 253
252 254 Config settings (pattern **.dat, minsize 2 MB) are respected.
253 255
254 256 $ echo testdata > test.dat
255 257 $ dd bs=1k count=2k if=/dev/zero of=reallylarge > /dev/null 2> /dev/null
256 258 $ hg add
257 259 adding reallylarge as a largefile
258 260 adding test.dat as a largefile
259 261
260 262 Test that minsize and --lfsize handle float values;
261 263 also tests that --lfsize overrides largefiles.minsize.
262 264 (0.250 MB = 256 kB = 262144 B)
263 265
264 266 $ dd if=/dev/zero of=ratherlarge bs=1024 count=256 > /dev/null 2> /dev/null
265 267 $ dd if=/dev/zero of=medium bs=1024 count=128 > /dev/null 2> /dev/null
266 268 $ hg --config largefiles.minsize=.25 add
267 269 adding ratherlarge as a largefile
268 270 adding medium
269 271 $ hg forget medium
270 272 $ hg --config largefiles.minsize=.25 add --lfsize=.125
271 273 adding medium as a largefile
272 274 $ dd if=/dev/zero of=notlarge bs=1024 count=127 > /dev/null 2> /dev/null
273 275 $ hg --config largefiles.minsize=.25 add --lfsize=.125
274 276 adding notlarge
275 277 $ hg forget notlarge
276 278
277 279 Test forget on largefiles.
278 280
279 281 $ hg forget large3 large5 test.dat reallylarge ratherlarge medium
280 282 $ hg commit -m "add/edit more largefiles"
281 283 Invoking status precommit hook
282 284 A sub2/large6
283 285 A sub2/large7
284 286 R large3
285 287 ? large5
286 288 ? medium
287 289 ? notlarge
288 290 ? ratherlarge
289 291 ? reallylarge
290 292 ? test.dat
291 293 $ hg st
292 294 ? large3
293 295 ? large5
294 296 ? medium
295 297 ? notlarge
296 298 ? ratherlarge
297 299 ? reallylarge
298 300 ? test.dat
299 301
300 302 Purge with largefiles: verify that largefiles are still in the working
301 303 dir after a purge.
302 304
303 305 $ hg purge --all
304 306 $ cat sub/large4
305 307 large44
306 308 $ cat sub2/large6
307 309 large6
308 310 $ cat sub2/large7
309 311 large7
310 312
311 313 Test addremove: verify that files that should be added as largfiles are added as
312 314 such and that already-existing largfiles are not added as normal files by
313 315 accident.
314 316
315 317 $ rm normal3
316 318 $ rm sub/large4
317 319 $ echo "testing addremove with patterns" > testaddremove.dat
318 320 $ echo "normaladdremove" > normaladdremove
319 321 $ hg addremove
320 322 removing sub/large4
321 323 adding testaddremove.dat as a largefile
322 324 removing normal3
323 325 adding normaladdremove
324 326
325 327 Clone a largefiles repo.
326 328
327 329 $ hg clone . ../b
328 330 updating to branch default
329 331 5 files updated, 0 files merged, 0 files removed, 0 files unresolved
330 332 getting changed largefiles
331 333 3 largefiles updated, 0 removed
332 334 $ cd ../b
333 335 $ hg log --template '{rev}:{node|short} {desc|firstline}\n'
334 336 7:daea875e9014 add/edit more largefiles
335 337 6:4355d653f84f edit files yet again
336 338 5:9d5af5072dbd edit files again
337 339 4:74c02385b94c move files
338 340 3:9e8fbc4bce62 copy files
339 341 2:51a0ae4d5864 remove files
340 342 1:ce8896473775 edit files
341 343 0:30d30fe6a5be add files
342 344 $ cat normal3
343 345 normal33
344 346 $ cat sub/normal4
345 347 normal44
346 348 $ cat sub/large4
347 349 large44
348 350 $ cat sub2/large6
349 351 large6
350 352 $ cat sub2/large7
351 353 large7
352 354 $ cd ..
353 355 $ hg clone a -r 3 c
354 356 adding changesets
355 357 adding manifests
356 358 adding file changes
357 359 added 4 changesets with 10 changes to 4 files
358 360 updating to branch default
359 361 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
360 362 getting changed largefiles
361 363 2 largefiles updated, 0 removed
362 364 $ cd c
363 365 $ hg log --template '{rev}:{node|short} {desc|firstline}\n'
364 366 3:9e8fbc4bce62 copy files
365 367 2:51a0ae4d5864 remove files
366 368 1:ce8896473775 edit files
367 369 0:30d30fe6a5be add files
368 370 $ cat normal1
369 371 normal22
370 372 $ cat large1
371 373 large22
372 374 $ cat sub/normal2
373 375 normal22
374 376 $ cat sub/large2
375 377 large22
376 378
377 379 Old revisions of a clone have correct largefiles content (this also
378 380 tests update).
379 381
380 382 $ hg update -r 1
381 383 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
382 384 getting changed largefiles
383 385 1 largefiles updated, 0 removed
384 386 $ cat large1
385 387 large11
386 388 $ cat sub/large2
387 389 large22
388 390
389 391 Rebasing between two repositories does not revert largefiles to old
390 392 revisions (this was a very bad bug that took a lot of work to fix).
391 393
392 394 $ cd ..
393 395 $ hg clone a d
394 396 updating to branch default
395 397 5 files updated, 0 files merged, 0 files removed, 0 files unresolved
396 398 getting changed largefiles
397 399 3 largefiles updated, 0 removed
398 400 $ cd b
399 401 $ echo large4-modified > sub/large4
400 402 $ echo normal3-modified > normal3
401 403 $ hg commit -m "modify normal file and largefile in repo b"
402 404 Invoking status precommit hook
403 405 M normal3
404 406 M sub/large4
405 407 $ cd ../d
406 408 $ echo large6-modified > sub2/large6
407 409 $ echo normal4-modified > sub/normal4
408 410 $ hg commit -m "modify normal file largefile in repo d"
409 411 Invoking status precommit hook
410 412 M sub/normal4
411 413 M sub2/large6
412 414 $ cd ..
413 415 $ hg clone d e
414 416 updating to branch default
415 417 5 files updated, 0 files merged, 0 files removed, 0 files unresolved
416 418 getting changed largefiles
417 419 3 largefiles updated, 0 removed
418 420 $ cd d
419 421 $ hg pull --rebase ../b
420 422 pulling from ../b
421 423 searching for changes
422 424 adding changesets
423 425 adding manifests
424 426 adding file changes
425 427 added 1 changesets with 2 changes to 2 files (+1 heads)
426 428 Invoking status precommit hook
427 429 M sub/normal4
428 430 M sub2/large6
429 431 saved backup bundle to $TESTTMP/d/.hg/strip-backup/f574fb32bb45-backup.hg
430 432 nothing to rebase
431 433 $ hg log --template '{rev}:{node|short} {desc|firstline}\n'
432 434 9:598410d3eb9a modify normal file largefile in repo d
433 435 8:a381d2c8c80e modify normal file and largefile in repo b
434 436 7:daea875e9014 add/edit more largefiles
435 437 6:4355d653f84f edit files yet again
436 438 5:9d5af5072dbd edit files again
437 439 4:74c02385b94c move files
438 440 3:9e8fbc4bce62 copy files
439 441 2:51a0ae4d5864 remove files
440 442 1:ce8896473775 edit files
441 443 0:30d30fe6a5be add files
442 444 $ cat normal3
443 445 normal3-modified
444 446 $ cat sub/normal4
445 447 normal4-modified
446 448 $ cat sub/large4
447 449 large4-modified
448 450 $ cat sub2/large6
449 451 large6-modified
450 452 $ cat sub2/large7
451 453 large7
452 454 $ cd ../e
453 455 $ hg pull ../b
454 456 pulling from ../b
455 457 searching for changes
456 458 adding changesets
457 459 adding manifests
458 460 adding file changes
459 461 added 1 changesets with 2 changes to 2 files (+1 heads)
460 462 (run 'hg heads' to see heads, 'hg merge' to merge)
461 463 caching new largefiles
462 464 0 largefiles cached
463 465 $ hg rebase
464 466 Invoking status precommit hook
465 467 M sub/normal4
466 468 M sub2/large6
467 469 saved backup bundle to $TESTTMP/e/.hg/strip-backup/f574fb32bb45-backup.hg
468 470 $ hg log --template '{rev}:{node|short} {desc|firstline}\n'
469 471 9:598410d3eb9a modify normal file largefile in repo d
470 472 8:a381d2c8c80e modify normal file and largefile in repo b
471 473 7:daea875e9014 add/edit more largefiles
472 474 6:4355d653f84f edit files yet again
473 475 5:9d5af5072dbd edit files again
474 476 4:74c02385b94c move files
475 477 3:9e8fbc4bce62 copy files
476 478 2:51a0ae4d5864 remove files
477 479 1:ce8896473775 edit files
478 480 0:30d30fe6a5be add files
479 481 $ cat normal3
480 482 normal3-modified
481 483 $ cat sub/normal4
482 484 normal4-modified
483 485 $ cat sub/large4
484 486 large4-modified
485 487 $ cat sub2/large6
486 488 large6-modified
487 489 $ cat sub2/large7
488 490 large7
489 491
490 492 Rollback on largefiles.
491 493
492 494 $ echo large4-modified-again > sub/large4
493 495 $ hg commit -m "Modify large4 again"
494 496 Invoking status precommit hook
495 497 M sub/large4
496 498 $ hg rollback
497 499 repository tip rolled back to revision 9 (undo commit)
498 500 working directory now based on revision 9
499 501 $ hg st
500 502 M sub/large4
501 503 $ hg log --template '{rev}:{node|short} {desc|firstline}\n'
502 504 9:598410d3eb9a modify normal file largefile in repo d
503 505 8:a381d2c8c80e modify normal file and largefile in repo b
504 506 7:daea875e9014 add/edit more largefiles
505 507 6:4355d653f84f edit files yet again
506 508 5:9d5af5072dbd edit files again
507 509 4:74c02385b94c move files
508 510 3:9e8fbc4bce62 copy files
509 511 2:51a0ae4d5864 remove files
510 512 1:ce8896473775 edit files
511 513 0:30d30fe6a5be add files
512 514 $ cat sub/large4
513 515 large4-modified-again
514 516
515 517 "update --check" refuses to update with uncommitted changes.
516 518 $ hg update --check 8
517 519 abort: uncommitted local changes
518 520 [255]
519 521
520 522 "update --clean" leaves correct largefiles in working copy.
521 523
522 524 $ hg update --clean
523 525 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
524 526 getting changed largefiles
525 527 1 largefiles updated, 0 removed
526 528 $ cat normal3
527 529 normal3-modified
528 530 $ cat sub/normal4
529 531 normal4-modified
530 532 $ cat sub/large4
531 533 large4-modified
532 534 $ cat sub2/large6
533 535 large6-modified
534 536 $ cat sub2/large7
535 537 large7
536 538
537 539 Now "update check" is happy.
538 540 $ hg update --check 8
539 541 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
540 542 getting changed largefiles
541 543 1 largefiles updated, 0 removed
542 544 $ hg update --check
543 545 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
544 546 getting changed largefiles
545 547 1 largefiles updated, 0 removed
546 548
547 549 Test removing empty largefiles directories on update
548 550 $ test -d sub2 && echo "sub2 exists"
549 551 sub2 exists
550 552 $ hg update -q null
551 553 $ test -d sub2 && echo "error: sub2 should not exist anymore"
552 554 [1]
553 555 $ hg update -q
554 556
555 557 Test hg remove removes empty largefiles directories
556 558 $ test -d sub2 && echo "sub2 exists"
557 559 sub2 exists
558 560 $ hg remove sub2/*
559 561 $ test -d sub2 && echo "error: sub2 should not exist anymore"
560 562 [1]
561 563 $ hg revert sub2/large6 sub2/large7
562 564
563 565 "revert" works on largefiles (and normal files too).
564 566 $ echo hack3 >> normal3
565 567 $ echo hack4 >> sub/normal4
566 568 $ echo hack4 >> sub/large4
567 569 $ rm sub2/large6
568 570 $ hg revert sub2/large6
569 571 $ hg rm sub2/large6
570 572 $ echo new >> sub2/large8
571 573 $ hg add --large sub2/large8
572 574 # XXX we don't really want to report that we're reverting the standin;
573 575 # that's just an implementation detail. But I don't see an obvious fix. ;-(
574 576 $ hg revert sub
575 577 reverting .hglf/sub/large4 (glob)
576 578 reverting sub/normal4 (glob)
577 579 $ hg status
578 580 M normal3
579 581 A sub2/large8
580 582 R sub2/large6
581 583 ? sub/large4.orig
582 584 ? sub/normal4.orig
583 585 $ cat sub/normal4
584 586 normal4-modified
585 587 $ cat sub/large4
586 588 large4-modified
587 589 $ hg revert -a --no-backup
588 590 undeleting .hglf/sub2/large6 (glob)
589 591 forgetting .hglf/sub2/large8 (glob)
590 592 reverting normal3
591 593 $ hg status
592 594 ? sub/large4.orig
593 595 ? sub/normal4.orig
594 596 ? sub2/large8
595 597 $ cat normal3
596 598 normal3-modified
597 599 $ cat sub2/large6
598 600 large6-modified
599 601 $ rm sub/*.orig sub2/large8
600 602
601 603 revert some files to an older revision
602 604 $ hg revert --no-backup -r 8 sub2
603 605 reverting .hglf/sub2/large6 (glob)
604 606 $ cat sub2/large6
605 607 large6
606 608 $ hg revert --no-backup sub2
607 609 reverting .hglf/sub2/large6 (glob)
608 610 $ hg status
609 611
610 612 "verify --large" actually verifies largefiles
611 613
612 614 $ hg verify --large
613 615 checking changesets
614 616 checking manifests
615 617 crosschecking files in changesets and manifests
616 618 checking files
617 619 10 files, 10 changesets, 28 total revisions
618 620 searching 1 changesets for largefiles
619 621 verified existence of 3 revisions of 3 largefiles
620 622
621 623 Merging does not revert to old versions of largefiles and also check
622 624 that merging after having pulled from a non-default remote works
623 625 correctly.
624 626
625 627 $ cd ..
626 628 $ hg clone -r 7 e temp
627 629 adding changesets
628 630 adding manifests
629 631 adding file changes
630 632 added 8 changesets with 24 changes to 10 files
631 633 updating to branch default
632 634 5 files updated, 0 files merged, 0 files removed, 0 files unresolved
633 635 getting changed largefiles
634 636 3 largefiles updated, 0 removed
635 637 $ hg clone temp f
636 638 updating to branch default
637 639 5 files updated, 0 files merged, 0 files removed, 0 files unresolved
638 640 getting changed largefiles
639 641 3 largefiles updated, 0 removed
640 642 # Delete the largefiles in the largefiles system cache so that we have an
641 643 # opportunity to test that caching after a pull works.
642 644 $ rm ${USERCACHE}/*
643 645 $ cd f
644 646 $ echo "large4-merge-test" > sub/large4
645 647 $ hg commit -m "Modify large4 to test merge"
646 648 Invoking status precommit hook
647 649 M sub/large4
648 650 $ hg pull ../e
649 651 pulling from ../e
650 652 searching for changes
651 653 adding changesets
652 654 adding manifests
653 655 adding file changes
654 656 added 2 changesets with 4 changes to 4 files (+1 heads)
655 657 (run 'hg heads' to see heads, 'hg merge' to merge)
656 658 caching new largefiles
657 659 2 largefiles cached
658 660 $ hg merge
659 661 merging sub/large4
660 662 largefile sub/large4 has a merge conflict
661 663 keep (l)ocal or take (o)ther? l
662 664 3 files updated, 1 files merged, 0 files removed, 0 files unresolved
663 665 (branch merge, don't forget to commit)
664 666 getting changed largefiles
665 667 1 largefiles updated, 0 removed
666 668 $ hg commit -m "Merge repos e and f"
667 669 Invoking status precommit hook
668 670 M normal3
669 671 M sub/normal4
670 672 M sub2/large6
671 673 $ cat normal3
672 674 normal3-modified
673 675 $ cat sub/normal4
674 676 normal4-modified
675 677 $ cat sub/large4
676 678 large4-merge-test
677 679 $ cat sub2/large6
678 680 large6-modified
679 681 $ cat sub2/large7
680 682 large7
681 683
682 684 Test status after merging with a branch that introduces a new largefile:
683 685
684 686 $ echo large > large
685 687 $ hg add --large large
686 688 $ hg commit -m 'add largefile'
687 689 Invoking status precommit hook
688 690 A large
689 691 $ hg update -q ".^"
690 692 $ echo change >> normal3
691 693 $ hg commit -m 'some change'
692 694 Invoking status precommit hook
693 695 M normal3
694 696 created new head
695 697 $ hg merge
696 698 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
697 699 (branch merge, don't forget to commit)
698 700 getting changed largefiles
699 701 1 largefiles updated, 0 removed
700 702 $ hg status
701 703 M large
702 704
703 705 Test that a normal file and a largefile with the same name and path cannot
704 706 coexist.
705 707
706 708 $ rm sub2/large7
707 709 $ echo "largeasnormal" > sub2/large7
708 710 $ hg add sub2/large7
709 711 sub2/large7 already a largefile
710 712
711 713 Test that transplanting a largefile change works correctly.
712 714
713 715 $ cd ..
714 716 $ hg clone -r 8 d g
715 717 adding changesets
716 718 adding manifests
717 719 adding file changes
718 720 added 9 changesets with 26 changes to 10 files
719 721 updating to branch default
720 722 5 files updated, 0 files merged, 0 files removed, 0 files unresolved
721 723 getting changed largefiles
722 724 3 largefiles updated, 0 removed
723 725 $ cd g
724 726 $ hg transplant -s ../d 598410d3eb9a
725 727 searching for changes
726 728 searching for changes
727 729 adding changesets
728 730 adding manifests
729 731 adding file changes
730 732 added 1 changesets with 2 changes to 2 files
731 733 $ hg log --template '{rev}:{node|short} {desc|firstline}\n'
732 734 9:598410d3eb9a modify normal file largefile in repo d
733 735 8:a381d2c8c80e modify normal file and largefile in repo b
734 736 7:daea875e9014 add/edit more largefiles
735 737 6:4355d653f84f edit files yet again
736 738 5:9d5af5072dbd edit files again
737 739 4:74c02385b94c move files
738 740 3:9e8fbc4bce62 copy files
739 741 2:51a0ae4d5864 remove files
740 742 1:ce8896473775 edit files
741 743 0:30d30fe6a5be add files
742 744 $ cat normal3
743 745 normal3-modified
744 746 $ cat sub/normal4
745 747 normal4-modified
746 748 $ cat sub/large4
747 749 large4-modified
748 750 $ cat sub2/large6
749 751 large6-modified
750 752 $ cat sub2/large7
751 753 large7
752 754
753 755 Test that renaming a largefile results in correct output for status
754 756
755 757 $ hg rename sub/large4 large4-renamed
756 758 $ hg commit -m "test rename output"
757 759 Invoking status precommit hook
758 760 A large4-renamed
759 761 R sub/large4
760 762 $ cat large4-renamed
761 763 large4-modified
762 764 $ cd sub2
763 765 $ hg rename large6 large6-renamed
764 766 $ hg st
765 767 A sub2/large6-renamed
766 768 R sub2/large6
767 769 $ cd ..
768 770
769 771 Test --normal flag
770 772
771 773 $ dd if=/dev/urandom bs=2k count=11k > new-largefile 2> /dev/null
772 774 $ hg add --normal --large new-largefile
773 775 abort: --normal cannot be used with --large
774 776 [255]
775 777 $ hg add --normal new-largefile
776 778 new-largefile: up to 69 MB of RAM may be required to manage this file
777 779 (use 'hg revert new-largefile' to cancel the pending addition)
778 780 $ cd ..
779 781
780 782 vanilla clients not locked out from largefiles servers on vanilla repos
781 783 $ mkdir r1
782 784 $ cd r1
783 785 $ hg init
784 786 $ echo c1 > f1
785 787 $ hg add f1
786 788 $ hg commit -m "m1"
787 789 Invoking status precommit hook
788 790 A f1
789 791 $ cd ..
790 792 $ hg serve -R r1 -d -p $HGPORT --pid-file hg.pid
791 793 $ cat hg.pid >> $DAEMON_PIDS
792 794 $ hg --config extensions.largefiles=! clone http://localhost:$HGPORT r2
793 795 requesting all changes
794 796 adding changesets
795 797 adding manifests
796 798 adding file changes
797 799 added 1 changesets with 1 changes to 1 files
798 800 updating to branch default
799 801 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
800 802
801 803 largefiles clients still work with vanilla servers
802 804 $ hg --config extensions.largefiles=! serve -R r1 -d -p $HGPORT1 --pid-file hg.pid
803 805 $ cat hg.pid >> $DAEMON_PIDS
804 806 $ hg clone http://localhost:$HGPORT1 r3
805 807 requesting all changes
806 808 adding changesets
807 809 adding manifests
808 810 adding file changes
809 811 added 1 changesets with 1 changes to 1 files
810 812 updating to branch default
811 813 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
812 814
813 815 vanilla clients locked out from largefiles http repos
814 816 $ mkdir r4
815 817 $ cd r4
816 818 $ hg init
817 819 $ echo c1 > f1
818 820 $ hg add --large f1
819 821 $ hg commit -m "m1"
820 822 Invoking status precommit hook
821 823 A f1
822 824 $ cd ..
823 825 $ hg serve -R r4 -d -p $HGPORT2 --pid-file hg.pid
824 826 $ cat hg.pid >> $DAEMON_PIDS
825 827 $ hg --config extensions.largefiles=! clone http://localhost:$HGPORT2 r5
826 828 abort: remote error:
827 829
828 830 This repository uses the largefiles extension.
829 831
830 832 Please enable it in your Mercurial config file.
831 833 [255]
832 834
833 835 used all HGPORTs, kill all daemons
834 836 $ "$TESTDIR/killdaemons.py"
835 837
836 838 vanilla clients locked out from largefiles ssh repos
837 839 $ hg --config extensions.largefiles=! clone -e "python $TESTDIR/dummyssh" ssh://user@dummy/r4 r5
838 840 abort: remote error:
839 841
840 842 This repository uses the largefiles extension.
841 843
842 844 Please enable it in your Mercurial config file.
843 845 [255]
844 846
845 847 largefiles clients refuse to push largefiles repos to vanilla servers
846 848 $ mkdir r6
847 849 $ cd r6
848 850 $ hg init
849 851 $ echo c1 > f1
850 852 $ hg add f1
851 853 $ hg commit -m "m1"
852 854 Invoking status precommit hook
853 855 A f1
854 856 $ cat >> .hg/hgrc <<!
855 857 > [web]
856 858 > push_ssl = false
857 859 > allow_push = *
858 860 > !
859 861 $ cd ..
860 862 $ hg clone r6 r7
861 863 updating to branch default
862 864 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
863 865 $ cd r7
864 866 $ echo c2 > f2
865 867 $ hg add --large f2
866 868 $ hg commit -m "m2"
867 869 Invoking status precommit hook
868 870 A f2
869 871 $ hg --config extensions.largefiles=! -R ../r6 serve -d -p $HGPORT --pid-file ../hg.pid
870 872 $ cat ../hg.pid >> $DAEMON_PIDS
871 873 $ hg push http://localhost:$HGPORT
872 874 pushing to http://localhost:$HGPORT/
873 875 searching for changes
874 876 abort: http://localhost:$HGPORT/ does not appear to be a largefile store
875 877 [255]
876 878 $ cd ..
877 879
878 880 putlfile errors are shown (issue3123)
879 881 Corrupt the cached largefile in r7
880 882 $ echo corruption > $USERCACHE/4cdac4d8b084d0b599525cf732437fb337d422a8
881 883 $ hg init empty
882 884 $ hg serve -R empty -d -p $HGPORT1 --pid-file hg.pid \
883 885 > --config 'web.allow_push=*' --config web.push_ssl=False
884 886 $ cat hg.pid >> $DAEMON_PIDS
885 887 $ hg push -R r7 http://localhost:$HGPORT1
886 888 pushing to http://localhost:$HGPORT1/
887 889 searching for changes
888 890 remote: largefiles: failed to put 4cdac4d8b084d0b599525cf732437fb337d422a8 into store: largefile contents do not match hash
889 891 abort: remotestore: could not put $TESTTMP/r7/.hg/largefiles/4cdac4d8b084d0b599525cf732437fb337d422a8 to remote store http://localhost:$HGPORT1/
890 892 [255]
891 893 $ rm -rf empty
892 894
893 895 Clone a local repository owned by another user
894 896 We have to simulate that here by setting $HOME and removing write permissions
895 897 $ ORIGHOME="$HOME"
896 898 $ mkdir alice
897 899 $ HOME="`pwd`/alice"
898 900 $ cd alice
899 901 $ hg init pubrepo
900 902 $ cd pubrepo
901 903 $ dd if=/dev/urandom bs=1k count=11k > a-large-file 2> /dev/null
902 904 $ hg add --large a-large-file
903 905 $ hg commit -m "Add a large file"
904 906 Invoking status precommit hook
905 907 A a-large-file
906 908 $ cd ..
907 909 $ chmod -R a-w pubrepo
908 910 $ cd ..
909 911 $ mkdir bob
910 912 $ HOME="`pwd`/bob"
911 913 $ cd bob
912 914 $ hg clone --pull ../alice/pubrepo pubrepo
913 915 requesting all changes
914 916 adding changesets
915 917 adding manifests
916 918 adding file changes
917 919 added 1 changesets with 1 changes to 1 files
918 920 updating to branch default
919 921 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
920 922 getting changed largefiles
921 923 1 largefiles updated, 0 removed
922 924 $ cd ..
923 925 $ chmod -R u+w alice/pubrepo
924 926 $ HOME="$ORIGHOME"
925 927
926 928 Symlink to a large largefile should behave the same as a symlink to a normal file
927 929 $ hg init largesymlink
928 930 $ cd largesymlink
929 931 $ dd if=/dev/zero bs=1k count=10k of=largefile 2>/dev/null
930 932 $ hg add --large largefile
931 933 $ hg commit -m "commit a large file"
932 934 Invoking status precommit hook
933 935 A largefile
934 936 $ ln -s largefile largelink
935 937 $ hg add largelink
936 938 $ hg commit -m "commit a large symlink"
937 939 Invoking status precommit hook
938 940 A largelink
939 941 $ rm -f largelink
940 942 $ hg up >/dev/null
941 943 $ test -f largelink
942 944 [1]
943 945 $ test -L largelink
944 946 [1]
945 947 $ rm -f largelink # make next part of the test independent of the previous
946 948 $ hg up -C >/dev/null
947 949 $ test -f largelink
948 950 $ test -L largelink
949 951 $ cd ..
950 952
951 953 test for pattern matching on 'hg status':
952 954 to boost performance, largefiles checks whether specified patterns are
953 955 related to largefiles in working directory (NOT to STANDIN) or not.
954 956
955 957 $ hg init statusmatch
956 958 $ cd statusmatch
957 959
958 960 $ mkdir -p a/b/c/d
959 961 $ echo normal > a/b/c/d/e.normal.txt
960 962 $ hg add a/b/c/d/e.normal.txt
961 963 $ echo large > a/b/c/d/e.large.txt
962 964 $ hg add --large a/b/c/d/e.large.txt
963 965 $ mkdir -p a/b/c/x
964 966 $ echo normal > a/b/c/x/y.normal.txt
965 967 $ hg add a/b/c/x/y.normal.txt
966 968 $ hg commit -m 'add files'
967 969 Invoking status precommit hook
968 970 A a/b/c/d/e.large.txt
969 971 A a/b/c/d/e.normal.txt
970 972 A a/b/c/x/y.normal.txt
971 973
972 974 (1) no pattern: no performance boost
973 975 $ hg status -A
974 976 C a/b/c/d/e.large.txt
975 977 C a/b/c/d/e.normal.txt
976 978 C a/b/c/x/y.normal.txt
977 979
978 980 (2) pattern not related to largefiles: performance boost
979 981 $ hg status -A a/b/c/x
980 982 C a/b/c/x/y.normal.txt
981 983
982 984 (3) pattern related to largefiles: no performance boost
983 985 $ hg status -A a/b/c/d
984 986 C a/b/c/d/e.large.txt
985 987 C a/b/c/d/e.normal.txt
986 988
987 989 (4) pattern related to STANDIN (not to largefiles): performance boost
988 990 $ hg status -A .hglf/a
989 991 C .hglf/a/b/c/d/e.large.txt
990 992
991 993 (5) mixed case: no performance boost
992 994 $ hg status -A a/b/c/x a/b/c/d
993 995 C a/b/c/d/e.large.txt
994 996 C a/b/c/d/e.normal.txt
995 997 C a/b/c/x/y.normal.txt
996 998
997 999 verify that largefiles doesn't break filesets
998 1000
999 1001 $ hg log --rev . --exclude "set:binary()"
1000 1002 changeset: 0:41bd42f10efa
1001 1003 tag: tip
1002 1004 user: test
1003 1005 date: Thu Jan 01 00:00:00 1970 +0000
1004 1006 summary: add files
1005 1007
1006 1008
1007 1009 $ cd ..
General Comments 0
You need to be logged in to leave comments. Login now