aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormpeterv <mpeterval@gmail.com>2015-03-19 16:02:25 +0300
committermpeterv <mpeterval@gmail.com>2015-03-19 16:02:25 +0300
commit20eb94723f142f2bba420a05046157a3e115a3f0 (patch)
tree4d3f175cfc74ebfc4b99cf29c72270137f1f35ee /src
parent603b0ea346d050bef2ced801ec8818773aae0fa0 (diff)
downloadluarocks-20eb94723f142f2bba420a05046157a3e115a3f0.tar.gz
luarocks-20eb94723f142f2bba420a05046157a3e115a3f0.tar.bz2
luarocks-20eb94723f142f2bba420a05046157a3e115a3f0.zip
Improve hg support
* Allow fetching from remote hg repos using hg+http, hg+https and hg+ssh protocols; * Fix incorrect branch cloning.
Diffstat (limited to 'src')
-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
4 files changed, 41 insertions, 1 deletions
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"