mirror of
https://github.com/NixOS/nix.git
synced 2024-11-26 16:52:27 +00:00
fetchMercurial: Use inputFromAttrs()
This commit is contained in:
parent
2f9789c2e6
commit
1290411c2d
@ -54,15 +54,14 @@ static void prim_fetchMercurial(EvalState & state, const Pos & pos, Value * * ar
|
|||||||
if (evalSettings.pureEval && !rev)
|
if (evalSettings.pureEval && !rev)
|
||||||
throw Error("in pure evaluation mode, 'fetchMercurial' requires a Mercurial revision");
|
throw Error("in pure evaluation mode, 'fetchMercurial' requires a Mercurial revision");
|
||||||
|
|
||||||
auto parsedUrl = parseURL(
|
fetchers::Attrs attrs;
|
||||||
url.find("://") != std::string::npos
|
attrs.insert_or_assign("type", "hg");
|
||||||
? "hg+" + url
|
attrs.insert_or_assign("url", url.find("://") != std::string::npos ? url : "file://" + url);
|
||||||
: "hg+file://" + url);
|
if (ref) attrs.insert_or_assign("ref", *ref);
|
||||||
if (rev) parsedUrl.query.insert_or_assign("rev", rev->gitRev());
|
if (rev) attrs.insert_or_assign("rev", rev->gitRev());
|
||||||
if (ref) parsedUrl.query.insert_or_assign("ref", *ref);
|
auto input = fetchers::inputFromAttrs(attrs);
|
||||||
// FIXME: use name
|
|
||||||
auto input = fetchers::inputFromURL(parsedUrl);
|
|
||||||
|
|
||||||
|
// FIXME: use name
|
||||||
auto [tree, input2] = input->fetchTree(state.store);
|
auto [tree, input2] = input->fetchTree(state.store);
|
||||||
|
|
||||||
state.mkAttrs(v, 8);
|
state.mkAttrs(v, 8);
|
||||||
|
Loading…
Reference in New Issue
Block a user