Fix flake update check

This commit is contained in:
Eelco Dolstra 2020-01-29 22:53:03 +01:00
parent 68e0ca608f
commit 88b44b1e94
5 changed files with 23 additions and 3 deletions

View File

@ -280,11 +280,13 @@ static std::string diffLockFiles(const LockedInputs & oldLocks, const LockedInpu
res += fmt(" removed '%s'\n", concatStringsSep("/", i->first));
++i;
} 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",
concatStringsSep("/", i->first),
i->second->ref,
j->second->ref);
}
++i;
++j;
}

View File

@ -83,7 +83,7 @@ struct GitInput : Input
auto other2 = dynamic_cast<const GitInput *>(&other);
return
other2
&& url.url == other2->url.url
&& url == other2->url
&& rev == other2->rev
&& ref == other2->ref;
}
@ -361,6 +361,8 @@ struct GitInputScheme : InputScheme
auto input = std::make_unique<GitInput>(url);
input->url.query.clear();
for (auto &[name, value] : url.query) {
if (name == "rev") {
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);
input->ref = value;
}
else input->url.query.insert_or_assign(name, value);
}
return input;

View File

@ -29,7 +29,7 @@ struct MercurialInput : Input
auto other2 = dynamic_cast<const MercurialInput *>(&other);
return
other2
&& url.url == other2->url.url
&& url == other2->url
&& rev == other2->rev
&& ref == other2->ref;
}
@ -255,6 +255,8 @@ struct MercurialInputScheme : InputScheme
auto input = std::make_unique<MercurialInput>(url);
input->url.query.clear();
for (auto &[name, value] : url.query) {
if (name == "rev") {
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);
input->ref = value;
}
else input->url.query.insert_or_assign(name, value);
}
return input;

View File

@ -127,4 +127,14 @@ std::string ParsedURL::to_string() const
+ (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;
}
}

View File

@ -15,6 +15,8 @@ struct ParsedURL
std::string fragment;
std::string to_string() const;
bool operator ==(const ParsedURL & other) const;
};
MakeError(BadURL, Error);