debugdownload: read repository hgrc if there is one
authorBoris Feld <boris.feld@octobus.net>
Thu, 18 Jan 2018 16:47:14 +0100
changeset 35730 05d415790761
parent 35729 7415cc923613
child 35731 f58245b9e3ea
debugdownload: read repository hgrc if there is one The command does not require a repository, but will use it if there is one. This simplifies the reading of the remote destination when testing for largefile based url.
mercurial/debugcommands.py
tests/test-url-download.t
--- a/mercurial/debugcommands.py	Fri Jan 19 00:18:45 2018 -0500
+++ b/mercurial/debugcommands.py	Thu Jan 18 16:47:14 2018 +0100
@@ -797,8 +797,8 @@
     [
         ('o', 'output', '', _('path')),
     ],
-    norepo=True)
-def debugdownload(ui, url, output=None, **opts):
+    optionalrepo=True)
+def debugdownload(ui, repo, url, output=None, **opts):
     """download a resource using Mercurial logic and config
     """
     fh = urlmod.open(ui, url, output)
--- a/tests/test-url-download.t	Fri Jan 19 00:18:45 2018 -0500
+++ b/tests/test-url-download.t	Thu Jan 18 16:47:14 2018 +0100
@@ -52,3 +52,17 @@
 
   $ hg --traceback debugdownload "largefile://a57b57b39ee4dc3da1e03526596007f480ecdbe8" --config paths.default=http://localhost:$HGPORT/
   1 0000000000000000000000000000000000000000
+
+from within a repository
+
+  $ hg clone http://localhost:$HGPORT/ client
+  no changes found
+  updating to branch default
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+
+  $ cd client
+  $ hg path
+  default = http://localhost:$HGPORT/
+  $ hg debugdownload "largefile://a57b57b39ee4dc3da1e03526596007f480ecdbe8"
+  1 0000000000000000000000000000000000000000
+  $ cd ..