largefiles: restore normal 'clone -u' and 'clone -U' functionality

Previously, tip would be checked out regardless of the -u or -U parameter.  I'm
not sure what the 'required for successful walkchangerevs' comment meant, but it
appears to reference code which has since moved to downloadlfiles() in
7d6a660ca151.  Perhaps it was to force caching when the -U parameter is given?
The price of this change is that -U --all-largefiles won't cache anything.  That
will be fixed next.

Note that X + Y in the 'X largefiles updated, n removed' and 'Y additional
largefiles cached' lines do not add up to the same values in these tests, but
all of the largefiles have been downloaded.  The reason being that several
largefiles have the same content (eb7338044 is pointed to by sub/large2, large3
and sub/large4).  In the 'clone -u 1' operation, this largefile is cached to
populate the working directory, even without --all-largefiles.  That means the
file isn't downloaded again and cached in the rev where large3 and sub/large4
both point to this file.  Downloading that one file in that one rev seems to be
counted twice with 'clone -u 0'.  (Maybe it is also being downloaded twice?)

--HG--
branch : stable
extra : rebase_source : 26cf996dd8b4540d58ce7297c64973c267420559
largefiles: restore caching of largefiles with 'clone -U --all-largefiles'

This was broken when restoring normal -u and -U functionality.

--HG--
branch : stable
extra : rebase_source : e664d647035f615bfc03b67727753de73711d2da
largefiles: don't convert dest=None to dest=hg.defaultdest() in clone command

A status message is output if hg.clone() determines the default destination
because None was provided.  The previous code never passed None to hg.clone().

--HG--
branch : stable
extra : rebase_source : 5267bd5f58b66bedf8ee4afb66ae4c4250c7f723
largefiles: delegate to the wrapped clone command

This allows the wrapped command's validation code to run (which is currently
only to ensure 'noupdate' and 'updaterev' aren't both specified), the
copy/pasted unpacking of hg.clone() args to be removed, and any future changes
to the base command (however unlikely) to be inherited by largefiles.

Unfortunately, the command override can't be swapped entirely for an hg.clone()
override because the extra --all-largefiles arg needs to be injected.  It also
isn't enough to call the wrapped clone command and leave the caching code after
it, because the file caching code needs access to the destination repo, which is
only available from hg.clone().  An alternative would be to use the dest path in
the clone command override to re-obtain a reference to the repo.

A slight deviation from the regular hg.clone() function is that the repo is NOT
deleted if the caching fails, but that was also the previous behavior.  Maybe it
should for consistency?

--HG--
branch : stable
extra : rebase_source : 132d844af9b8464eec62ba31b33b34f27fd30183
store: refactor splitting off of "data/" in _hybridencode()

encodefilename() already calls encodedir(). Note that encodedir() skips the
encoding if the path doesn't start with "data/".
store: remove uneeded startswith('data/') check in _hybridencode()
store: remove uneeded startswith('data/') checks in encodedir() and decodedir()

I don't think we will ever have anything in the store that resides inside a
directory that ends in .i or .d under store/ that we wouldn't want to have
direncoded. The files not under data/ surely don't need direncoding, but it
doesn't harm to let these few run through it. It hurts more to check whether the
thousands of other files start with 'data/'. They do anyway.

See also 810387f59696 (fixed with c31fe74a6633), which moved the direncoding
from filelog into store
store: reorder basename assignment in _hybridencode
store: keep an accumulated length for the shorted dirs in _hybridencode

so we don't have to repeatedly do  '/'.join(sdirs)  inside the loop
store: parameter path of _auxencode is now a list of strings
store: eliminate one level of lambda functions on _hybridencode
store: move encode lambda logic into fncachestore

and define two named functions at module scope.

This again also speeds up perffncacheencode a little bit.
store: optimize fncache._write by direncoding the contents in one go

For a netbeans clone on Windows 7 x64:

  Before:
    $ hg perffncachewrite
    ! wall 0.210000 comb 0.218401 user 0.202801 sys 0.015600 (best of 47)

  After:
    $ hg perffncachewrite
    ! wall 0.104000 comb 0.109201 user 0.078000 sys 0.031200 (best of 95)
test-hybridencode: add a case for direncode
largefiles: fix trailing spaces in test-largefiles.t

With the default branch this will cause warnings from check-code.

--HG--
branch : stable
merge with main
merge with stable
formatter: add base implementation of data method

Previously, nothing was done with the passed in values, which clearly wasn't
the intention.

--HG--
extra : rebase_source : 796c74c6a9f3e1245ebbf24ba41b1996ff92a3fc
merge with stable