It appears that a repo is not made aware of its largefiles-enabled status until a commit is made. This can cause some odd behavior - addremove will add a file twice (as an additional standard file in addition to the largefile version) until that first commit is made. Also, files above largefile's minimum size threshold are not added as largefiles until that initial commit. After that, things work as advertised. Example (linux/bash): > mkdir test; cd test > hg version | head -n 1 Mercurial Distributed SCM (version 2.2.2) > hg init > touch foo > hg add --large foo > hg stat A foo > hg addremove adding foo > hg stat A foo A foo > hg ci -vm 'test' .hglf/foo foo calling hook commit.lfiles: <function checkrequireslfiles at 0x53c3668> committed changeset 0:97ced15c4071 >> touch bar > hg add --large bar > hg addremove > hg ci -vm 'test2' .hglf/bar calling hook commit.lfiles: <function checkrequireslfiles at 0x1a9e9668> committed changeset 1:31885e85a412
Sorry - paste error above: >> touch bar is really just > touch bar ('>' is just the end of my prompt - not redirection or anything like that - sorry)
Reformated as a test script, still in 2.2.3+: $ echo "[extensions]" >> $HGRCPATH $ echo "largefiles=" >> $HGRCPATH $ hg init repo $ cd repo $ touch foo $ hg add --large foo $ hg st A foo $ hg addremove adding foo $ hg st A foo A foo $ hg ci -m addfoo --verbose .hglf/foo foo calling hook commit.lfiles: <function checkrequireslfiles at 0x101234140> committed changeset 0:1bf345c078a9 $ touch bar $ hg add --large bar $ hg st A bar $ hg addremove $ hg st A bar $ hg ci -m addbar --verbose .hglf/bar calling hook commit.lfiles: <function checkrequireslfiles at 0x101234140> committed changeset 1:38deda2b1bb8
Fixed by http://selenic.com/repo/hg/rev/ae57920ac188 Matt Harbison <matt_harbison@yahoo.com> largefiles: enable islfilesrepo() prior to a commit (issue3541) Previously, even if a file was added with --large, 'hg addremove' or 'hg ci -A' would add all files (including the previously added large files) as normal files. Only after a commit where a file was added with --large would subsequent adds or 'ci -A' take into account the minsize or the pattern configuration. This change more closely follows the help for largefiles, which mentions that 'add --large' is required to enable the configuration, but doesn't mention the previously required commit. Also, if 'hg add --large' was performed and then 'hg forget <file>' (both before a largefile enabling commit), the forget command would error out saying '.hglf/<file> not tracked'. This is also fixed. This reports that a repo is largefiles enabled as soon as a file is added with --large, which enables 'add', 'addremove' and 'ci -A' to honor the config settings before the first commit. Note that prior to the next commit, if all largefiles are forgotten, the repository goes back to reporting the repo as not largefiles enabled. It makes no sense to handle this by adding a --large option to 'addremove', because then it would also be needed for 'commit', but only when '-A' is specified. While this gets around the awkwardness of having to add a largefile, then commit it, and then addremove the other files when importing an existing codebase (and preserving that extra commit in permanent history), it does still require finding and manually adding one of the files as --large. Therefore it is probably desirable to have a --large option for init as well. (please test the fix)