Patchwork debugdownload: read repository hgrc if there is one

login
register
mail settings
Submitter Boris Feld
Date Jan. 18, 2018, 4:10 p.m.
Message ID <197a41c16b737d38c0d1.1516291823@FB>
Download mbox | patch
Permalink /patch/26908/
State Accepted
Headers show

Comments

Boris Feld - Jan. 18, 2018, 4:10 p.m.
# HG changeset patch
# User Boris Feld <boris.feld@octobus.net>
# Date 1516290434 -3600
#      Thu Jan 18 16:47:14 2018 +0100
# Node ID 197a41c16b737d38c0d1bc9f1608073a9da7acc1
# Parent  9c575c22dcf4305db2160dc45350ba8e40cf5e60
# EXP-Topic lfurl
# Available At https://bitbucket.org/octobus/mercurial-devel/
#              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 197a41c16b73
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.
Yuya Nishihara - Jan. 19, 2018, 11:59 a.m.
On Thu, 18 Jan 2018 17:10:23 +0100, Boris Feld wrote:
> # HG changeset patch
> # User Boris Feld <boris.feld@octobus.net>
> # Date 1516290434 -3600
> #      Thu Jan 18 16:47:14 2018 +0100
> # Node ID 197a41c16b737d38c0d1bc9f1608073a9da7acc1
> # Parent  9c575c22dcf4305db2160dc45350ba8e40cf5e60
> # EXP-Topic lfurl
> # Available At https://bitbucket.org/octobus/mercurial-devel/
> #              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 197a41c16b73
> debugdownload: read repository hgrc if there is one

Queued, thanks.

Patch

diff --git a/mercurial/debugcommands.py b/mercurial/debugcommands.py
--- a/mercurial/debugcommands.py
+++ b/mercurial/debugcommands.py
@@ -793,8 +793,8 @@  def debugdiscovery(ui, repo, remoteurl="
     [
         ('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)
diff --git a/tests/test-url-download.t b/tests/test-url-download.t
--- a/tests/test-url-download.t
+++ b/tests/test-url-download.t
@@ -52,3 +52,17 @@  Test largefile URL
 
   $ 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 ..