From 6a4d1f42228a47b74f5542e09d132515d6ef19ba Mon Sep 17 00:00:00 2001 From: sylvanaar Date: Sat, 3 Sep 2011 02:01:33 -0400 Subject: change the hg provider to use the hg:// protocol for backwards compatibility. add HG to the default vars --- src/luarocks/cfg.lua | 1 + src/luarocks/fetch.lua | 11 ++++------- src/luarocks/fetch/hg.lua | 9 ++++++--- src/luarocks/type_check.lua | 1 - 4 files changed, 11 insertions(+), 11 deletions(-) (limited to 'src') 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 = { GIT = "git", SSCM = "sscm", SVN = "svn", + HG = "hg", RSYNC = "rsync", 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) end local protocol, pathname = dir.split_url(rockspec.source.url) - local vccs = rockspec.source.vccs - if vccs ~= nil and ( protocol == "http" or protocol == "https" or protocol == "ftp" or protocol == "file" ) then + if protocol == "http" or protocol == "https" or protocol == "ftp" or protocol == "file" then rockspec.source.file = rockspec.source.file or dir.base_name(rockspec.source.url) end rockspec.source.protocol, rockspec.source.pathname = protocol, pathname @@ -294,15 +293,13 @@ function fetch_sources(rockspec, extract, dest_dir) assert(type(dest_dir) == "string" or not dest_dir) local protocol = rockspec.source.protocol - local vccs = rockspec.source.vccs - local ok, proto - if vccs == nil and ( protocol == "http" or protocol == "https" or protocol == "ftp" or protocol == "file" ) then + if protocol == "http" or protocol == "https" or protocol == "ftp" or protocol == "file" then proto = require("luarocks.fetch") else - ok, proto = pcall(require, "luarocks.fetch."..vccs or protocol) + ok, proto = pcall(require, "luarocks.fetch."..protocol) if not ok then - return nil, "Unknown protocol "..proto + return nil, "Unknown protocol "..protocol end end 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) local hg_cmd = rockspec.variables.HG local name_version = rockspec.name .. "-" .. rockspec.version - local module = dir.base_name(rockspec.source.url) + -- Strip off special hg:// protocol type + local url = rockspec.source.url:gsub("^hg://", "") - local command = {hg_cmd, "clone", "--startrev HEAD", rockspec.source.url, module} + local module = dir.base_name(url) + + local command = {hg_cmd, "clone", url, module} local tag_or_branch = rockspec.source.tag or rockspec.source.branch if tag_or_branch then - command = {hg_cmd, "clone", "--startrev HEAD", "--rev", rockspec.source.url, module} + command = {hg_cmd, "clone", "--rev", url, module} end local store_dir 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 = { md5 = "string", file = "string", dir = "string", - vccs = "string", tag = "string", branch = "string", module = "string", -- cgit v1.2.3-55-g6feb