##// END OF EJS Templates
largefiles: enable subrepo support for forget
Matt Harbison -
r23837:2b79d124 default
parent child Browse files
Show More
@@ -972,12 +972,10 b' def overridebailifchanged(orig, repo):'
972 if s.modified or s.added or s.removed or s.deleted:
972 if s.modified or s.added or s.removed or s.deleted:
973 raise util.Abort(_('uncommitted changes'))
973 raise util.Abort(_('uncommitted changes'))
974
974
975 def overrideforget(orig, ui, repo, *pats, **opts):
975 def cmdutilforget(orig, ui, repo, match, prefix, explicitonly):
976 installnormalfilesmatchfn(repo[None].manifest())
976 normalmatcher = composenormalfilematcher(match, repo[None].manifest())
977 result = orig(ui, repo, *pats, **opts)
977 bad, forgot = orig(ui, repo, normalmatcher, prefix, explicitonly)
978 restorematchfn()
978 m = composelargefilematcher(match, repo[None].manifest())
979 m = composelargefilematcher(scmutil.match(repo[None], pats, opts),
980 repo[None].manifest())
981
979
982 try:
980 try:
983 repo.lfstatus = True
981 repo.lfstatus = True
@@ -992,7 +990,7 b' def overrideforget(orig, ui, repo, *pats'
992 repo.wvfs.isdir(lfutil.standin(f)):
990 repo.wvfs.isdir(lfutil.standin(f)):
993 ui.warn(_('not removing %s: file is already untracked\n')
991 ui.warn(_('not removing %s: file is already untracked\n')
994 % m.rel(f))
992 % m.rel(f))
995 result = 1
993 bad.append(f)
996
994
997 for f in forget:
995 for f in forget:
998 if ui.verbose or not m.exact(f):
996 if ui.verbose or not m.exact(f):
@@ -1012,11 +1010,13 b' def overrideforget(orig, ui, repo, *pats'
1012 standins = [lfutil.standin(f) for f in forget]
1010 standins = [lfutil.standin(f) for f in forget]
1013 for f in standins:
1011 for f in standins:
1014 util.unlinkpath(repo.wjoin(f), ignoremissing=True)
1012 util.unlinkpath(repo.wjoin(f), ignoremissing=True)
1015 repo[None].forget(standins)
1013 rejected = repo[None].forget(standins)
1016 finally:
1014 finally:
1017 wlock.release()
1015 wlock.release()
1018
1016
1019 return result
1017 bad.extend(f for f in rejected if f in m.files())
1018 forgot.extend(f for f in forget if f not in rejected)
1019 return bad, forgot
1020
1020
1021 def _getoutgoings(repo, other, missing, addfunc):
1021 def _getoutgoings(repo, other, missing, addfunc):
1022 """get pairs of filename and largefile hash in outgoing revisions
1022 """get pairs of filename and largefile hash in outgoing revisions
@@ -34,8 +34,7 b' def uisetup(ui):'
34 entry = extensions.wrapfunction(scmutil, 'addremove',
34 entry = extensions.wrapfunction(scmutil, 'addremove',
35 overrides.scmutiladdremove)
35 overrides.scmutiladdremove)
36 extensions.wrapfunction(cmdutil, 'remove', overrides.cmdutilremove)
36 extensions.wrapfunction(cmdutil, 'remove', overrides.cmdutilremove)
37 entry = extensions.wrapcommand(commands.table, 'forget',
37 extensions.wrapfunction(cmdutil, 'forget', overrides.cmdutilforget)
38 overrides.overrideforget)
39
38
40 # Subrepos call status function
39 # Subrepos call status function
41 entry = extensions.wrapcommand(commands.table, 'status',
40 entry = extensions.wrapcommand(commands.table, 'status',
@@ -323,4 +323,25 b' Find an exact match to a standin (should'
323 $ hg --config extensions.largefiles= archive -S -I 'sub/sub2/.hglf/large.bin' ../archive_lf
323 $ hg --config extensions.largefiles= archive -S -I 'sub/sub2/.hglf/large.bin' ../archive_lf
324 $ find ../archive_lf 2> /dev/null | sort
324 $ find ../archive_lf 2> /dev/null | sort
325
325
326 $ cat >> $HGRCPATH <<EOF
327 > [extensions]
328 > largefiles=
329 > EOF
330
331 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.
333 $ touch sub1/sub2/untracked.txt
334 $ 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)
336 [1]
337 $ hg add -v --large -R sub1/sub2 sub1/sub2/untracked.txt
338 adding sub1/sub2/untracked.txt as a largefile (glob)
339 $ hg forget -v sub1/sub2/untracked.txt
340 removing sub1/sub2/untracked.txt (glob)
341 $ hg status -S
342 R sub1/sub2/large.bin
343 R sub1/sub2/test.txt
344 ? foo/bar/abc
345 ? sub1/sub2/untracked.txt
346
326 $ cd ..
347 $ cd ..
General Comments 0
You need to be logged in to leave comments. Login now