libexpr/builtins: Document fetchMercurial

Change-Id: Ic849bd6dd10374b717d3fc257da25208f2c45525
This commit is contained in:
Tom Hubrecht
2025-11-23 08:58:17 +01:00
parent 3cf5ad0164
commit ea99f26b25
4 changed files with 51 additions and 8 deletions
+48
View File
@@ -0,0 +1,48 @@
---
name: fetchMercurial
args: [args]
renameInGlobalScope: false
---
Fetch a Mercurial repository. *args* can be a URL, in which case the default
branch of the repo at that URL is fetched. Otherwise, it can be an
attribute with the following attributes (all except `url` optional):
- `url`
The URL of the repo.
- `name` (default: `"source"`)
The name of the directory the repo should be exported to in the store.
- `rev`
The revision to fetch.
This is typically a commit hash.
> **Note**
>
> Currently, `rev` can either contain a revision or a branch/tag name.
The return value is an attrset containing the following keys:
- `outPath` (`string`)
Resulting store path of the fetch process.
- `branch` (`string`)
The branch of the fetch repository.
- `rev` (`string`)
The revision that was fetched.
- `revCount` (`int`)
The number of revsets for this branch.
- `shortRev` (`string`)
The first *12* characters of `rev`.
+1
View File
@@ -11,6 +11,7 @@ struct Value;
void prim_addDrvOutputDependencies(EvalState & state, Value * * args, Value & v);
void prim_fetchTree(EvalState & state, Value * * args, Value & v);
void prim_fetchGit(EvalState & state, Value * * args, Value & v);
void prim_fetchMercurial(EvalState & state, Value ** args, Value & v);
void prim_fetchTarball(EvalState & state, Value * * args, Value & v);
void prim_fetchurl(EvalState & state, Value * * args, Value & v);
void prim_fromTOML(EvalState & state, Value * * args, Value & v);
+1
View File
@@ -77,6 +77,7 @@ builtin_definitions = files(
'builtins/elem.md',
'builtins/elemAt.md',
'builtins/fetchGit.md',
'builtins/fetchMercurial.md',
'builtins/fetchTarball.md',
'builtins/fetchTree.md',
'builtins/fetchurl.md',
+1 -8
View File
@@ -5,7 +5,7 @@
namespace nix {
static void prim_fetchMercurial(EvalState & state, Value * * args, Value & v)
void prim_fetchMercurial(EvalState & state, Value ** args, Value & v)
{
std::string url;
std::optional<Hash> rev;
@@ -102,11 +102,4 @@ static void prim_fetchMercurial(EvalState & state, Value * * args, Value & v)
state.ctx.paths.allowPath(tree.storePath);
}
static RegisterPrimOp r_fetchMercurial({
.name = "fetchMercurial",
.arity = 1,
.fun = prim_fetchMercurial
});
}