Skip to content
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

Make compatibility with GitExtensions v4.1 & Gerrit server v3.7.0 #74

Merged
merged 3 commits into from
Sep 22, 2023

Conversation

poupounetjoyeux
Copy link
Contributor

@poupounetjoyeux poupounetjoyeux commented Sep 17, 2023

Fix missing method implementation OsShellUtil.OpenUrlInDefaultBrowse exception:

  • Due to the move of GitCommands

Fix the parsing of the remote command lines output to retrieve the gerrit change URI:

  • Keep the legacy parsing using 'New Changes' line
  • Following gerrit v3.7.0 remote outputs modifications take care of '[NEW]' at the end of line
  • Use a global regex on the command line ouput to retrieve the change URI in both cases
  • Add a unit test with both use cases with command outputs test resource files

Update the README to indicate supported version (master-branch needs to be updated at release time depending of the new version the plugin will take)

PR Checklist

Please check if your PR fulfills the following requirements:

  • Tests for the changes have been added (for bug fixes / features)

PR Type

What kind of change does this PR introduce?

  • Bugfix

What is the current behavior?

The current behaviour is an exception with GitExtensions v4.1 when opening the change URI after publishing it
It's also to have the new change URI poping up with the GerritServer v3.7.0

Issue Number: N/A

What is the new behavior?

The plugin correctly open new changes URIs in GitExtensions v4.1 and with GerritServer v3.7.0

Does this PR introduce a breaking change?

  • No

Other information

Like last time : I used this plugin every day and could be cool if we can have a quick release of it to have the benefits of the v4.1 of GitExtensions 😇

… exception

 - Due to the move of GitCommands

Fix the parsing of the remote command lines output to retrieve the gerrit change URI
 - Keep the legacy parsing using 'New Changes' line
 - Following gerrit v3.7.0 remote outputs modifications take care of '[NEW]' at the end of line
 - Use a global regex on the command line ouput to retrieve the change URI in bot cases
 - Add a unit test with both use cases with command outputs test resource files

Update the README to indicates supported version (master-branch needs to be updated at release time depending of the new version the plugin will take)
Copy link
Member

@RussKie RussKie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Comment on lines 20 to 34
<None Update="TestResources\NewChange_GerritLegacy.txt">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="TestResources\NewChange_GerritNew.txt">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="TestResources\UnparsableUri.txt">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="TestResources\UpdatedChange_GerritNew.txt">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="TestResources\UpdatedChange_GerritLegacy.txt">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<None Update="TestResources\NewChange_GerritLegacy.txt">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="TestResources\NewChange_GerritNew.txt">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="TestResources\UnparsableUri.txt">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="TestResources\UpdatedChange_GerritNew.txt">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="TestResources\UpdatedChange_GerritLegacy.txt">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="TestResources\*.txt">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@@ -27,6 +28,26 @@ internal static class GerritUtil
var fetchUrl = GetFetchUrl(module, remote);

return await RunGerritCommandAsync(owner, module, command, fetchUrl, remote, stdIn).ConfigureAwait(false);
}

public static bool HadNewChange(string commandPrompt, out string changeUri)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Assert that commandPrompt isn't null or empty.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Copy link
Collaborator

@lekhmanrus lekhmanrus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@poupounetjoyeux
Copy link
Contributor Author

poupounetjoyeux commented Sep 19, 2023

With pleasure,
just noticed that GitExtensions.GerritPlugin.csproj.user will need to be updated at release time also to match GitExtensions v4.1 sources 😉
Sorry for the miss

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants