[PATCH 3 of 4 V3] largefiles: add support for 'largefiles://' url scheme

Yuya Nishihara yuya at tcha.org
Fri Jan 19 07:27:48 EST 2018


On Thu, 18 Jan 2018 17:14:18 +0100, Boris Feld wrote:
> `On Tue, 2018-01-09 at 21:08 +0900, Yuya Nishihara wrote:
> > 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-deve
> > > l/ -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.
> 
> How could the user trigger that?

No idea. If there's no url.open(userspecifiedurl, data) call, ProgrammingError
is okay.

> > > +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?
> 
> What attribute error? Could you be a bit more specific?


--- tests/test-url-download.t
+++ tests/test-url-download.t.err
@@ -68,4 +68,46 @@
   $ cd ..
 
   $ hg clone client client2
   updating to branch default
   0 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ hg -R client2 debugdownload "largefile://a57b57b39ee4dc3da1e03526596007f480ecdbe8"
+  ** unknown exception encountered, please report by visiting
+  ** https://mercurial-scm.org/wiki/BugTracker
+  ** Python 2.7.14+ (default, Dec  5 2017, 15:17:02) [GCC 7.2.0]
+  ** Mercurial Distributed SCM (version 4.4.2+690-a62b08f6626b)
+  ** Extensions loaded: largefiles
+  Traceback (most recent call last):
+    File "hg", line 41, in <module>
+      dispatch.run()
+    File "mercurial/dispatch.py", line 88, in run
+      status = (dispatch(req) or 0) & 255
+    File "mercurial/dispatch.py", line 183, in dispatch
+      ret = _runcatch(req)
+    File "mercurial/dispatch.py", line 324, in _runcatch
+      return _callcatch(ui, _runcatchfunc)
+    File "mercurial/dispatch.py", line 332, in _callcatch
+      return scmutil.callcatch(ui, func)
+    File "mercurial/scmutil.py", line 154, in callcatch
+      return func()
+    File "mercurial/dispatch.py", line 314, in _runcatchfunc
+      return _dispatch(req)
+    File "mercurial/dispatch.py", line 918, in _dispatch
+      cmdpats, cmdoptions)
+    File "mercurial/dispatch.py", line 673, in runcommand
+      ret = _runcommand(ui, options, cmd, d)
+    File "mercurial/dispatch.py", line 926, in _runcommand
+      return cmdfunc()
+    File "mercurial/dispatch.py", line 915, in <lambda>
+      d = lambda: util.checksignature(func)(ui, *args, **strcmdopt)
+    File "mercurial/util.py", line 1195, in check
+      return func(*args, **kwargs)
+    File "mercurial/debugcommands.py", line 804, in debugdownload
+      fh = urlmod.open(ui, url, output)
+    File "mercurial/extensions.py", line 344, in closure
+      return func(*(args + a), **kw)
+    File "hgext/largefiles/overrides.py", line 1490, in openlargefile
+      return storefactory.getlfile(ui, lfid)
+    File "hgext/largefiles/storefactory.py", line 86, in getlfile
+      return util.chunkbuffer(openstore(ui=ui)._get(hash))
+  AttributeError: 'localstore' object has no attribute '_get'
+  [1]


More information about the Mercurial-devel mailing list