largefiles: add --normal option to hg add (issue3061)

This commit is contained in:
Na'Tosha Bard 2011-12-02 18:20:32 +01:00
parent 77c6b2a6a2
commit ccfa519703
3 changed files with 18 additions and 1 deletions

View File

@ -179,6 +179,11 @@ def remove_largefiles(ui, repo, *pats, **opts):
# matcher which matches only the normal files and runs the original
# version of add.
def override_add(orig, ui, repo, *pats, **opts):
normal = opts.pop('normal')
if normal:
if opts.get('large'):
raise util.Abort(_('--normal cannot be used with --large'))
return orig(ui, repo, *pats, **opts)
bad = add_largefiles(ui, repo, *pats, **opts)
installnormalfilesmatchfn(repo[None].manifest())
result = orig(ui, repo, *pats, **opts)

View File

@ -23,6 +23,7 @@ def uisetup(ui):
entry = extensions.wrapcommand(commands.table, 'add',
overrides.override_add)
addopt = [('', 'large', None, _('add as largefile')),
('', 'normal', None, _('add as normal file')),
('', 'lfsize', '', _('add all files above this size '
'(in megabytes) as largefiles '
'(default: 10)'))]

View File

@ -768,7 +768,18 @@ Test that renaming a largefile results in correct output for status
$ hg st
A sub2/large6-renamed
R sub2/large6
$ cd ../..
$ cd ..
Test --normal flag
$ dd if=/dev/urandom bs=2k count=11k > new-largefile 2> /dev/null
$ hg add --normal --large new-largefile
abort: --normal cannot be used with --large
[255]
$ hg add --normal new-largefile
new-largefile: up to 69 MB of RAM may be required to manage this file
(use 'hg revert new-largefile' to cancel the pending addition)
$ cd ..
vanilla clients not locked out from largefiles servers on vanilla repos
$ mkdir r1