[PATCH 3 of 4 V3] largefiles: add support for 'largefiles://' url scheme
Yuya Nishihara
yuya at tcha.org
Tue Jan 9 07:08:26 EST 2018
On Mon, 08 Jan 2018 22:16:47 +0100, Boris Feld wrote:
> # HG changeset patch
> # User Boris Feld <boris.feld at octobus.net>
> # Date 1513861077 -3600
> # Thu Dec 21 13:57:57 2017 +0100
> # Node ID 18db7b5d796d31fbced9d41dd50a61d0e62e6fcb
> # Parent a503a19221d6c6113ad1e3add9eb084be3177daf
> # EXP-Topic largefile-url
> # Available At https://bitbucket.org/octobus/mercurial-devel/
> # hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 18db7b5d796d
> largefiles: add support for 'largefiles://' url scheme
> +_lfscheme = 'largefile://'
> +def openlargefile(orig, ui, url_, data=''):
Nit: s/data=''/data=None/ according to the signature of url.open().
> + if url_.startswith(_lfscheme):
> + if data:
> + msg = "cannot use data on a 'largefile://' url"
> + raise error.ProgrammingError(msg)
If the error can be triggered by user (by e.g. setting crafted repo path),
it shouldn't be a ProgrammingError.
> +def getlfile(ui, hash):
> + return util.chunkbuffer(openstore(ui=ui)._get(hash))
AttributeError would be raised if the default path isn't remote. Can you
send a follow up?
> --- a/tests/test-url-download.t
> +++ b/tests/test-url-download.t
> @@ -34,3 +34,21 @@ Check other kind of compatible url
> $ hg debugdownload ./null.txt
> 1 0000000000000000000000000000000000000000
>
> +Test largefile URL
> +------------------
> +
> + $ cat << EOF >> $HGRCPATH
> + > [extensions]
> + > largefiles=
> + > EOF
> +
> + $ killdaemons.py
> + $ rm -f error.log hg1.pid
> + $ hg serve -R server -p $HGPORT -d --pid-file=hg1.pid -E error.log
> + $ cat hg1.pid >> $DAEMON_PIDS
> +
> + $ hg -R server debuglfput null.txt
> + a57b57b39ee4dc3da1e03526596007f480ecdbe8
> +
> + $ hg --traceback debugdownload "largefile://a57b57b39ee4dc3da1e03526596007f480ecdbe8" --config paths.default=http://localhost:$HGPORT/
debugdownload command could be optionalrepo=True so repo/.hg/hgrc are loaded.
More information about the Mercurial-devel
mailing list