-
-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Get FLEx model version from repo and store in metadata #1082
base: develop
Are you sure you want to change the base?
Changes from 4 commits
b88aa58
9c276b9
3b5ee77
30c2c20
d9df3ea
088fb71
21d089e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -267,6 +267,22 @@ | |
return null; | ||
} | ||
|
||
public async Task<int?> GetModelVersionOfFlexProject(ProjectCode code, CancellationToken token = default) | ||
{ | ||
var result = await ExecuteHgCommandServerCommand(code, "flexmodelversion", token); | ||
var text = await result.ReadAsStringAsync(token); | ||
try | ||
{ | ||
var json = JsonDocument.Parse(text); | ||
return json.RootElement.GetProperty("modelversion").GetInt32(); | ||
} | ||
catch | ||
{ | ||
if (int.TryParse(text, out var num)) return num; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fallback in case a future FLEx or Chorus update decides to make this a simple text file containing the number instead of JSON. Probably not needed; can remove if you think I should remove it. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah let's remove it as it's planning for something that might never happen |
||
} | ||
return null; | ||
} | ||
|
||
public Task RevertRepo(ProjectCode code, string revHash) | ||
{ | ||
throw new NotImplementedException(); | ||
|
@@ -430,7 +446,7 @@ | |
{ | ||
var hash = await GetTipHash(code, timeoutSource.Token); | ||
var isEmpty = hash == AllZeroHash; | ||
done = expectedState switch | ||
Check warning on line 449 in backend/LexBoxApi/Services/HgService.cs GitHub Actions / Build API / publish-api
|
||
{ | ||
RepoEmptyState.Empty => isEmpty, | ||
RepoEmptyState.NonEmpty => !isEmpty | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this is needed as we already know the project exists because we were able to find a project ID from the code. Which means we can skip the project query entirely