mirror of
https://github.com/NixOS/nix.git
synced 2025-11-21 01:39:36 +01:00
Add option --commit-lock-file
This commit is contained in:
parent
e2213d77a2
commit
9d7fb62db6
7 changed files with 42 additions and 27 deletions
|
|
@ -62,8 +62,10 @@ struct Input : std::enable_shared_from_this<Input>
|
|||
|
||||
virtual std::optional<Path> getSourcePath() const { return {}; }
|
||||
|
||||
// FIXME: should merge with getSourcePath().
|
||||
virtual void markChangedFile(std::string_view file) const { assert(false); }
|
||||
virtual void markChangedFile(
|
||||
std::string_view file,
|
||||
std::optional<std::string> commitMsg) const
|
||||
{ assert(false); }
|
||||
|
||||
virtual void clone(const Path & destDir) const
|
||||
{
|
||||
|
|
|
|||
|
|
@ -169,17 +169,17 @@ struct GitInput : Input
|
|||
return url.path;
|
||||
return {};
|
||||
}
|
||||
|
||||
void markChangedFile(std::string_view file) const override
|
||||
void markChangedFile(std::string_view file, std::optional<std::string> commitMsg) const override
|
||||
{
|
||||
auto sourcePath = getSourcePath();
|
||||
assert(sourcePath);
|
||||
|
||||
runProgram("git", true,
|
||||
{ "-C", *sourcePath, "add",
|
||||
"--force",
|
||||
"--intent-to-add",
|
||||
std::string(file)
|
||||
});
|
||||
{ "-C", *sourcePath, "add", "--force", "--intent-to-add", std::string(file) });
|
||||
|
||||
if (commitMsg)
|
||||
runProgram("git", true,
|
||||
{ "-C", *sourcePath, "commit", std::string(file), "-m", *commitMsg });
|
||||
}
|
||||
|
||||
std::pair<bool, std::string> getActualUrl() const
|
||||
|
|
|
|||
|
|
@ -84,15 +84,18 @@ struct MercurialInput : Input
|
|||
return {};
|
||||
}
|
||||
|
||||
void markChangedFile(std::string_view file) const override
|
||||
void markChangedFile(std::string_view file, std::optional<std::string> commitMsg) const override
|
||||
{
|
||||
auto sourcePath = getSourcePath();
|
||||
assert(sourcePath);
|
||||
|
||||
// FIXME: shut up if file is already tracked.
|
||||
runProgram("hg", true,
|
||||
{ "add",
|
||||
*sourcePath + "/" + std::string(file)
|
||||
});
|
||||
{ "add", *sourcePath + "/" + std::string(file) });
|
||||
|
||||
if (commitMsg)
|
||||
runProgram("hg", true,
|
||||
{ "commit", *sourcePath + "/" + std::string(file), "-m", *commitMsg });
|
||||
}
|
||||
|
||||
std::pair<bool, std::string> getActualUrl() const
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue