mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-23 14:36:16 +02:00
Fix flake update check
This commit is contained in:
parent
68e0ca608f
commit
88b44b1e94
5 changed files with 23 additions and 3 deletions
|
@ -280,11 +280,13 @@ static std::string diffLockFiles(const LockedInputs & oldLocks, const LockedInpu
|
||||||
res += fmt(" removed '%s'\n", concatStringsSep("/", i->first));
|
res += fmt(" removed '%s'\n", concatStringsSep("/", i->first));
|
||||||
++i;
|
++i;
|
||||||
} else {
|
} else {
|
||||||
if (!(i->second->ref == j->second->ref))
|
if (!(i->second->ref == j->second->ref)) {
|
||||||
|
assert(i->second->ref.to_string() != j->second->ref.to_string());
|
||||||
res += fmt(" updated '%s': '%s' -> '%s'\n",
|
res += fmt(" updated '%s': '%s' -> '%s'\n",
|
||||||
concatStringsSep("/", i->first),
|
concatStringsSep("/", i->first),
|
||||||
i->second->ref,
|
i->second->ref,
|
||||||
j->second->ref);
|
j->second->ref);
|
||||||
|
}
|
||||||
++i;
|
++i;
|
||||||
++j;
|
++j;
|
||||||
}
|
}
|
||||||
|
|
|
@ -83,7 +83,7 @@ struct GitInput : Input
|
||||||
auto other2 = dynamic_cast<const GitInput *>(&other);
|
auto other2 = dynamic_cast<const GitInput *>(&other);
|
||||||
return
|
return
|
||||||
other2
|
other2
|
||||||
&& url.url == other2->url.url
|
&& url == other2->url
|
||||||
&& rev == other2->rev
|
&& rev == other2->rev
|
||||||
&& ref == other2->ref;
|
&& ref == other2->ref;
|
||||||
}
|
}
|
||||||
|
@ -361,6 +361,8 @@ struct GitInputScheme : InputScheme
|
||||||
|
|
||||||
auto input = std::make_unique<GitInput>(url);
|
auto input = std::make_unique<GitInput>(url);
|
||||||
|
|
||||||
|
input->url.query.clear();
|
||||||
|
|
||||||
for (auto &[name, value] : url.query) {
|
for (auto &[name, value] : url.query) {
|
||||||
if (name == "rev") {
|
if (name == "rev") {
|
||||||
if (!std::regex_match(value, revRegex))
|
if (!std::regex_match(value, revRegex))
|
||||||
|
@ -372,6 +374,7 @@ struct GitInputScheme : InputScheme
|
||||||
throw BadURL("Git URL '%s' contains an invalid branch/tag name", url.url);
|
throw BadURL("Git URL '%s' contains an invalid branch/tag name", url.url);
|
||||||
input->ref = value;
|
input->ref = value;
|
||||||
}
|
}
|
||||||
|
else input->url.query.insert_or_assign(name, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
return input;
|
return input;
|
||||||
|
|
|
@ -29,7 +29,7 @@ struct MercurialInput : Input
|
||||||
auto other2 = dynamic_cast<const MercurialInput *>(&other);
|
auto other2 = dynamic_cast<const MercurialInput *>(&other);
|
||||||
return
|
return
|
||||||
other2
|
other2
|
||||||
&& url.url == other2->url.url
|
&& url == other2->url
|
||||||
&& rev == other2->rev
|
&& rev == other2->rev
|
||||||
&& ref == other2->ref;
|
&& ref == other2->ref;
|
||||||
}
|
}
|
||||||
|
@ -255,6 +255,8 @@ struct MercurialInputScheme : InputScheme
|
||||||
|
|
||||||
auto input = std::make_unique<MercurialInput>(url);
|
auto input = std::make_unique<MercurialInput>(url);
|
||||||
|
|
||||||
|
input->url.query.clear();
|
||||||
|
|
||||||
for (auto &[name, value] : url.query) {
|
for (auto &[name, value] : url.query) {
|
||||||
if (name == "rev") {
|
if (name == "rev") {
|
||||||
if (!std::regex_match(value, revRegex))
|
if (!std::regex_match(value, revRegex))
|
||||||
|
@ -266,6 +268,7 @@ struct MercurialInputScheme : InputScheme
|
||||||
throw BadURL("Mercurial URL '%s' contains an invalid branch/tag name", url.url);
|
throw BadURL("Mercurial URL '%s' contains an invalid branch/tag name", url.url);
|
||||||
input->ref = value;
|
input->ref = value;
|
||||||
}
|
}
|
||||||
|
else input->url.query.insert_or_assign(name, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
return input;
|
return input;
|
||||||
|
|
|
@ -127,4 +127,14 @@ std::string ParsedURL::to_string() const
|
||||||
+ (fragment.empty() ? "" : "#" + percentEncode(fragment));
|
+ (fragment.empty() ? "" : "#" + percentEncode(fragment));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool ParsedURL::operator ==(const ParsedURL & other) const
|
||||||
|
{
|
||||||
|
return
|
||||||
|
scheme == other.scheme
|
||||||
|
&& authority == other.authority
|
||||||
|
&& path == other.path
|
||||||
|
&& query == other.query
|
||||||
|
&& fragment == other.fragment;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,6 +15,8 @@ struct ParsedURL
|
||||||
std::string fragment;
|
std::string fragment;
|
||||||
|
|
||||||
std::string to_string() const;
|
std::string to_string() const;
|
||||||
|
|
||||||
|
bool operator ==(const ParsedURL & other) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
MakeError(BadURL, Error);
|
MakeError(BadURL, Error);
|
||||||
|
|
Loading…
Reference in a new issue