##// END OF EJS Templates
largefiles: enable subrepo support for add...
Matt Harbison -
r23886:5ce8dcd0 default
parent child Browse files
Show More
@@ -242,23 +242,25 b' def decodepath(orig, path):'
242
242
243 # -- Wrappers: modify existing commands --------------------------------
243 # -- Wrappers: modify existing commands --------------------------------
244
244
245 # Add works by going through the files that the user wanted to add and
246 # checking if they should be added as largefiles. Then it makes a new
247 # matcher which matches only the normal files and runs the original
248 # version of add.
249 def overrideadd(orig, ui, repo, *pats, **opts):
245 def overrideadd(orig, ui, repo, *pats, **opts):
250 normal = opts.get('normal')
246 normal = opts.get('normal')
251 if normal:
247 if normal:
252 if opts.get('large'):
248 if opts.get('large'):
253 raise util.Abort(_('--normal cannot be used with --large'))
249 raise util.Abort(_('--normal cannot be used with --large'))
254 return orig(ui, repo, *pats, **opts)
250 return orig(ui, repo, *pats, **opts)
255 matcher = scmutil.match(repo[None], pats, opts)
251
256 added, bad = addlargefiles(ui, repo, False, matcher, **opts)
252 def cmdutiladd(orig, ui, repo, matcher, prefix, explicitonly, **opts):
257 installnormalfilesmatchfn(repo[None].manifest())
253 # The --normal flag short circuits this override
258 result = orig(ui, repo, *pats, **opts)
254 if opts.get('normal'):
259 restorematchfn()
255 return orig(ui, repo, matcher, prefix, explicitonly, **opts)
260
256
261 return (result == 1 or bad) and 1 or 0
257 ladded, lbad = addlargefiles(ui, repo, False, matcher, **opts)
258 normalmatcher = composenormalfilematcher(matcher, repo[None].manifest(),
259 ladded)
260 bad = orig(ui, repo, normalmatcher, prefix, explicitonly, **opts)
261
262 bad.extend(f for f in lbad)
263 return bad
262
264
263 def cmdutilremove(orig, ui, repo, matcher, prefix, after, force, subrepos):
265 def cmdutilremove(orig, ui, repo, matcher, prefix, after, force, subrepos):
264 normalmatcher = composenormalfilematcher(matcher, repo[None].manifest())
266 normalmatcher = composenormalfilematcher(matcher, repo[None].manifest())
@@ -33,6 +33,7 b' def uisetup(ui):'
33 # and in the process of handling commit -A (issue3542)
33 # and in the process of handling commit -A (issue3542)
34 entry = extensions.wrapfunction(scmutil, 'addremove',
34 entry = extensions.wrapfunction(scmutil, 'addremove',
35 overrides.scmutiladdremove)
35 overrides.scmutiladdremove)
36 extensions.wrapfunction(cmdutil, 'add', overrides.cmdutiladd)
36 extensions.wrapfunction(cmdutil, 'remove', overrides.cmdutilremove)
37 extensions.wrapfunction(cmdutil, 'remove', overrides.cmdutilremove)
37 extensions.wrapfunction(cmdutil, 'forget', overrides.cmdutilforget)
38 extensions.wrapfunction(cmdutil, 'forget', overrides.cmdutilforget)
38
39
@@ -214,7 +214,7 b' verify that large files in subrepos hand'
214 A .hgsub
214 A .hgsub
215 ? .hgsubstate
215 ? .hgsubstate
216 $ echo "rev 1" > subrepo/large.txt
216 $ echo "rev 1" > subrepo/large.txt
217 $ hg -R subrepo add --large subrepo/large.txt
217 $ hg add --large subrepo/large.txt
218 $ hg sum
218 $ hg sum
219 parent: 1:8ee150ea2e9c tip
219 parent: 1:8ee150ea2e9c tip
220 add subrepo
220 add subrepo
@@ -326,19 +326,27 b' Find an exact match to a standin (should'
326 $ cat >> $HGRCPATH <<EOF
326 $ cat >> $HGRCPATH <<EOF
327 > [extensions]
327 > [extensions]
328 > largefiles=
328 > largefiles=
329 > [largefiles]
330 > patterns=glob:**.dat
329 > EOF
331 > EOF
330
332
331 Test forget through a deep subrepo with the largefiles extension, both a
333 Test forget through a deep subrepo with the largefiles extension, both a
332 largefile and a normal file. Then a largefile that hasn't been committed yet.
334 largefile and a normal file. Then a largefile that hasn't been committed yet.
333 $ touch sub1/sub2/untracked.txt
335 $ touch sub1/sub2/untracked.txt
336 $ touch sub1/sub2/large.dat
334 $ hg forget sub1/sub2/large.bin sub1/sub2/test.txt sub1/sub2/untracked.txt
337 $ hg forget sub1/sub2/large.bin sub1/sub2/test.txt sub1/sub2/untracked.txt
335 not removing sub1/sub2/untracked.txt: file is already untracked (glob)
338 not removing sub1/sub2/untracked.txt: file is already untracked (glob)
336 [1]
339 [1]
337 $ hg add -v --large -R sub1/sub2 sub1/sub2/untracked.txt
340 $ hg add --large --dry-run -v sub1/sub2/untracked.txt
338 adding sub1/sub2/untracked.txt as a largefile (glob)
341 adding sub1/sub2/untracked.txt as a largefile (glob)
342 $ hg add --large -v sub1/sub2/untracked.txt
343 adding sub1/sub2/untracked.txt as a largefile (glob)
344 $ hg add --normal -v sub1/sub2/large.dat
345 adding sub1/sub2/large.dat (glob)
339 $ hg forget -v sub1/sub2/untracked.txt
346 $ hg forget -v sub1/sub2/untracked.txt
340 removing sub1/sub2/untracked.txt (glob)
347 removing sub1/sub2/untracked.txt (glob)
341 $ hg status -S
348 $ hg status -S
349 A sub1/sub2/large.dat
342 R sub1/sub2/large.bin
350 R sub1/sub2/large.bin
343 R sub1/sub2/test.txt
351 R sub1/sub2/test.txt
344 ? foo/bar/abc
352 ? foo/bar/abc
General Comments 0
You need to be logged in to leave comments. Login now