Skip to content

Conversation

RussKie
Copy link
Member

@RussKie RussKie commented Mar 21, 2025

I generally work in repos where maintainers tend to use main trunks instead of own forks, which makes repos very busy. Those repos also tend to have several remotes, which often make finding the right branch a daunting task.
Colouring the remotes makes finding the right remote easier.

Proposed changes

  • Allow customise colors of remotes
  • Reorder name and URL rows in FormRemotes dialog

Key points:

  • The color settings are persisted in <repo>/.gitconfig, where "remote" information is stored.
  • If/whenever the app's color theme is changed, the remotes' colours must be changed manually. No automatic colour adjustment is planned.
  • The feature belongs to the "advanced" feature set, and it is only available when "Show advanced option" is enabled.
    image

Screenshots

Before

image

After

If the color is not set, then only "Set color" button is available:
image

Once a color for a remote is set, then there is an additional button to reset:
image

Test methodology

  • Manual
  • I can look into adding some automated tests if there are no pushback on the implementation.

Test environment(s)

  • GIT
  • Windows

Merge strategy

I agree that the maintainer squash merge this PR (if the commit message is clear).


✒️ I contribute this code under The Developer Certificate of Origin.

@RussKie RussKie requested a review from Copilot March 21, 2025 10:21
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This pull request adds support for customizing remote colors and reorders the URL and Name rows in the FormRemotes dialog. Key changes include:

  • Adding methods in GitModule and IGitModule to get and reset remote colors.
  • Updating the UI in FormRemotes.cs to support the new remote color feature with proper button behavior.
  • Modifying the remote settings save logic and corresponding unit tests to include the optional remote color.

Reviewed Changes

Copilot reviewed 12 out of 15 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/app/GitCommands/Git/GitModule.cs Introduces _remoteColors and GetRemoteColors/ResetRemoteColors methods for caching remote colors.
src/app/GitCommands/Config/SettingKeyString.cs Adds a new setting key for remote color configuration.
src/app/GitUI/CommandsDialogs/FormRemotes.cs Updates the remote configuration dialog to include remote color UI elements and logic.
src/app/GitCommands/Remotes/ConfigFileRemoteSettingsManager.cs Enhances SaveRemote and PopulateRemotes to handle the new remote color property.
tests/app/UnitTests/GitCommands.Tests/Remote/ConfigFileRemoteSettingsManagerTests.cs Updates unit tests to account for the new remote color parameter.
Additional files Various updates to pass the remote colors through to the revision grid UI.
Files not reviewed (3)
  • src/app/GitUI/CommandsDialogs/FormRemotes.Designer.cs: Language not supported
  • src/app/GitUI/CommandsDialogs/FormRemotes.resx: Language not supported
  • src/app/GitUI/Translation/English.xlf: Language not supported

@RussKie RussKie changed the title Swap order of URL and Name rows Allow customise colors of remotes Mar 21, 2025
Copy link
Member

@mstv mstv left a comment

Choose a reason for hiding this comment

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

mainly nits, have not run

@gerhardol
Copy link
Member

  • for the functionality, no review

@RussKie RussKie force-pushed the color_remotes branch 2 times, most recently from a3274b7 to f4ce758 Compare March 23, 2025 13:18
@RussKie RussKie merged commit 0df4e98 into gitextensions:master Mar 23, 2025
4 checks passed
@RussKie RussKie deleted the color_remotes branch March 23, 2025 23:59
@mstv mstv added this to the v5.3 milestone Mar 25, 2025
Comment on lines +159 to +160
using GitModuleTestHelper moduleTestHelper = new();
GitModule gitModule = GetGitModuleWithExecutable(_executable, module: moduleTestHelper.Module);
Copy link
Member

Choose a reason for hiding this comment

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

AI output must be checked thrice! When resolving the MCs, it took long until I noticed that this code makes use of _executable but not of _gitModule.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yep, some of these tests are special...

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.

3 participants