diff options
author | sylvanaar <sylvanaar@mindspring.com> | 2011-09-03 02:01:33 -0400 |
---|---|---|
committer | sylvanaar <sylvanaar@mindspring.com> | 2011-09-03 02:24:20 -0400 |
commit | 6a4d1f42228a47b74f5542e09d132515d6ef19ba (patch) | |
tree | 012b4ce81ae2dce323fa30fbeb7fce810c78fc7c /src | |
parent | c1809b0c62bb118157880de56b01174f18c1c18e (diff) | |
download | luarocks-6a4d1f42228a47b74f5542e09d132515d6ef19ba.tar.gz luarocks-6a4d1f42228a47b74f5542e09d132515d6ef19ba.tar.bz2 luarocks-6a4d1f42228a47b74f5542e09d132515d6ef19ba.zip |
change the hg provider to use the hg:// protocol for backwards compatibility. add HG to the default vars
Diffstat (limited to 'src')
-rw-r--r-- | src/luarocks/cfg.lua | 1 | ||||
-rw-r--r-- | src/luarocks/fetch.lua | 11 | ||||
-rw-r--r-- | src/luarocks/fetch/hg.lua | 9 | ||||
-rw-r--r-- | src/luarocks/type_check.lua | 1 |
4 files changed, 11 insertions, 11 deletions
diff --git a/src/luarocks/cfg.lua b/src/luarocks/cfg.lua index 1abe39cb..43f10e6b 100644 --- a/src/luarocks/cfg.lua +++ b/src/luarocks/cfg.lua | |||
@@ -154,6 +154,7 @@ local defaults = { | |||
154 | GIT = "git", | 154 | GIT = "git", |
155 | SSCM = "sscm", | 155 | SSCM = "sscm", |
156 | SVN = "svn", | 156 | SVN = "svn", |
157 | HG = "hg", | ||
157 | 158 | ||
158 | RSYNC = "rsync", | 159 | RSYNC = "rsync", |
159 | WGET = "wget", | 160 | WGET = "wget", |
diff --git a/src/luarocks/fetch.lua b/src/luarocks/fetch.lua index 9b946684..2ea2c906 100644 --- a/src/luarocks/fetch.lua +++ b/src/luarocks/fetch.lua | |||
@@ -156,8 +156,7 @@ function load_local_rockspec(filename) | |||
156 | end | 156 | end |
157 | 157 | ||
158 | local protocol, pathname = dir.split_url(rockspec.source.url) | 158 | local protocol, pathname = dir.split_url(rockspec.source.url) |
159 | local vccs = rockspec.source.vccs | 159 | if protocol == "http" or protocol == "https" or protocol == "ftp" or protocol == "file" then |
160 | if vccs ~= nil and ( protocol == "http" or protocol == "https" or protocol == "ftp" or protocol == "file" ) then | ||
161 | rockspec.source.file = rockspec.source.file or dir.base_name(rockspec.source.url) | 160 | rockspec.source.file = rockspec.source.file or dir.base_name(rockspec.source.url) |
162 | end | 161 | end |
163 | rockspec.source.protocol, rockspec.source.pathname = protocol, pathname | 162 | rockspec.source.protocol, rockspec.source.pathname = protocol, pathname |
@@ -294,15 +293,13 @@ function fetch_sources(rockspec, extract, dest_dir) | |||
294 | assert(type(dest_dir) == "string" or not dest_dir) | 293 | assert(type(dest_dir) == "string" or not dest_dir) |
295 | 294 | ||
296 | local protocol = rockspec.source.protocol | 295 | local protocol = rockspec.source.protocol |
297 | local vccs = rockspec.source.vccs | ||
298 | |||
299 | local ok, proto | 296 | local ok, proto |
300 | if vccs == nil and ( protocol == "http" or protocol == "https" or protocol == "ftp" or protocol == "file" ) then | 297 | if protocol == "http" or protocol == "https" or protocol == "ftp" or protocol == "file" then |
301 | proto = require("luarocks.fetch") | 298 | proto = require("luarocks.fetch") |
302 | else | 299 | else |
303 | ok, proto = pcall(require, "luarocks.fetch."..vccs or protocol) | 300 | ok, proto = pcall(require, "luarocks.fetch."..protocol) |
304 | if not ok then | 301 | if not ok then |
305 | return nil, "Unknown protocol "..proto | 302 | return nil, "Unknown protocol "..protocol |
306 | end | 303 | end |
307 | end | 304 | end |
308 | 305 | ||
diff --git a/src/luarocks/fetch/hg.lua b/src/luarocks/fetch/hg.lua index 5c1575ba..a08520a5 100644 --- a/src/luarocks/fetch/hg.lua +++ b/src/luarocks/fetch/hg.lua | |||
@@ -19,12 +19,15 @@ function get_sources(rockspec, extract, dest_dir) | |||
19 | 19 | ||
20 | local hg_cmd = rockspec.variables.HG | 20 | local hg_cmd = rockspec.variables.HG |
21 | local name_version = rockspec.name .. "-" .. rockspec.version | 21 | local name_version = rockspec.name .. "-" .. rockspec.version |
22 | local module = dir.base_name(rockspec.source.url) | 22 | -- Strip off special hg:// protocol type |
23 | local url = rockspec.source.url:gsub("^hg://", "") | ||
23 | 24 | ||
24 | local command = {hg_cmd, "clone", "--startrev HEAD", rockspec.source.url, module} | 25 | local module = dir.base_name(url) |
26 | |||
27 | local command = {hg_cmd, "clone", url, module} | ||
25 | local tag_or_branch = rockspec.source.tag or rockspec.source.branch | 28 | local tag_or_branch = rockspec.source.tag or rockspec.source.branch |
26 | if tag_or_branch then | 29 | if tag_or_branch then |
27 | command = {hg_cmd, "clone", "--startrev HEAD", "--rev", rockspec.source.url, module} | 30 | command = {hg_cmd, "clone", "--rev", url, module} |
28 | end | 31 | end |
29 | local store_dir | 32 | local store_dir |
30 | if not dest_dir then | 33 | if not dest_dir then |
diff --git a/src/luarocks/type_check.lua b/src/luarocks/type_check.lua index 87617bcd..0e4a73af 100644 --- a/src/luarocks/type_check.lua +++ b/src/luarocks/type_check.lua | |||
@@ -38,7 +38,6 @@ rockspec_types = { | |||
38 | md5 = "string", | 38 | md5 = "string", |
39 | file = "string", | 39 | file = "string", |
40 | dir = "string", | 40 | dir = "string", |
41 | vccs = "string", | ||
42 | tag = "string", | 41 | tag = "string", |
43 | branch = "string", | 42 | branch = "string", |
44 | module = "string", | 43 | module = "string", |