aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile.setup.inc3
-rw-r--r--src/luarocks/fetch/hg.lua2
-rw-r--r--src/luarocks/fetch/hg_http.lua24
-rw-r--r--src/luarocks/fetch/hg_https.lua8
-rw-r--r--src/luarocks/fetch/hg_ssh.lua8
5 files changed, 43 insertions, 2 deletions
diff --git a/Makefile.setup.inc b/Makefile.setup.inc
index eb51ba5e..ef498e9b 100644
--- a/Makefile.setup.inc
+++ b/Makefile.setup.inc
@@ -15,5 +15,6 @@ manif_core.lua fetch.lua unpack.lua validate.lua cfg.lua download.lua \
15help.lua util.lua index.lua cache.lua refresh_cache.lua loader.lua \ 15help.lua util.lua index.lua cache.lua refresh_cache.lua loader.lua \
16admin_remove.lua fetch/hg.lua fetch/git_file.lua new_version.lua lint.lua \ 16admin_remove.lua fetch/hg.lua fetch/git_file.lua new_version.lua lint.lua \
17purge.lua path.lua path_cmd.lua write_rockspec.lua doc.lua upload.lua \ 17purge.lua path.lua path_cmd.lua write_rockspec.lua doc.lua upload.lua \
18upload/api.lua upload/multipart.lua fetch/git_http.lua 18upload/api.lua upload/multipart.lua fetch/git_http.lua fetch/hg_http.lua \
19fetch/hg_https.lua fetch/hg_ssh.lua
19 20
diff --git a/src/luarocks/fetch/hg.lua b/src/luarocks/fetch/hg.lua
index b2ba56e9..e736a071 100644
--- a/src/luarocks/fetch/hg.lua
+++ b/src/luarocks/fetch/hg.lua
@@ -30,7 +30,7 @@ function hg.get_sources(rockspec, extract, dest_dir)
30 local command = {hg_cmd, "clone", url, module} 30 local command = {hg_cmd, "clone", url, module}
31 local tag_or_branch = rockspec.source.tag or rockspec.source.branch 31 local tag_or_branch = rockspec.source.tag or rockspec.source.branch
32 if tag_or_branch then 32 if tag_or_branch then
33 command = {hg_cmd, "clone", "--rev", url, module} 33 command = {hg_cmd, "clone", "--rev", tag_or_branch, url, module}
34 end 34 end
35 local store_dir 35 local store_dir
36 if not dest_dir then 36 if not dest_dir then
diff --git a/src/luarocks/fetch/hg_http.lua b/src/luarocks/fetch/hg_http.lua
new file mode 100644
index 00000000..8f506daf
--- /dev/null
+++ b/src/luarocks/fetch/hg_http.lua
@@ -0,0 +1,24 @@
1
2--- Fetch back-end for retrieving sources from hg repositories
3-- that use http:// transport. For example, for fetching a repository
4-- that requires the following command line:
5-- `hg clone http://example.com/foo`
6-- you can use this in the rockspec:
7-- source = { url = "hg+http://example.com/foo" }
8local hg_http = {}
9
10local hg = require("luarocks.fetch.hg")
11
12--- Download sources for building a rock, using hg over http.
13-- @param rockspec table: The rockspec table
14-- @param extract boolean: Unused in this module (required for API purposes.)
15-- @param dest_dir string or nil: If set, will extract to the given directory.
16-- @return (string, string) or (nil, string): The absolute pathname of
17-- the fetched source tarball and the temporary directory created to
18-- store it; or nil and an error message.
19function hg_http.get_sources(rockspec, extract, dest_dir)
20 rockspec.source.url = rockspec.source.url:gsub("^hg.", "")
21 return hg.get_sources(rockspec, extract, dest_dir)
22end
23
24return hg_http
diff --git a/src/luarocks/fetch/hg_https.lua b/src/luarocks/fetch/hg_https.lua
new file mode 100644
index 00000000..e67417fe
--- /dev/null
+++ b/src/luarocks/fetch/hg_https.lua
@@ -0,0 +1,8 @@
1
2--- Fetch back-end for retrieving sources from hg repositories
3-- that use https:// transport. For example, for fetching a repository
4-- that requires the following command line:
5-- `hg clone https://example.com/foo`
6-- you can use this in the rockspec:
7-- source = { url = "hg+https://example.com/foo" }
8return require "luarocks.fetch.hg_http"
diff --git a/src/luarocks/fetch/hg_ssh.lua b/src/luarocks/fetch/hg_ssh.lua
new file mode 100644
index 00000000..0c365fab
--- /dev/null
+++ b/src/luarocks/fetch/hg_ssh.lua
@@ -0,0 +1,8 @@
1
2--- Fetch back-end for retrieving sources from hg repositories
3-- that use ssh:// transport. For example, for fetching a repository
4-- that requires the following command line:
5-- `hg clone ssh://example.com/foo`
6-- you can use this in the rockspec:
7-- source = { url = "hg+ssh://example.com/foo" }
8return require "luarocks.fetch.hg_http"