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

Add ability to Copy to Clipboard, similar to commit context menu from left panel #6339

Merged
merged 1 commit into from Oct 11, 2020
Merged

Conversation

ghost
Copy link

@ghost ghost commented Mar 3, 2019

Fixes #6304

Proposed changes

  • Create and add to context menu on the left panel CopyContextMenuItem

Screenshots

Before

15825c7a-f60b-4df4-ac95-607621232487 png

After

475142ba-b6f2-4d2a-bee5-d81db495e385 png

Test methodology

Manually


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

@codecov
Copy link

codecov bot commented Mar 3, 2019

Codecov Report

Merging #6339 into master will increase coverage by 0.00%.
The diff coverage is 75.00%.

@@           Coverage Diff           @@
##           master    #6339   +/-   ##
=======================================
  Coverage   55.10%   55.11%           
=======================================
  Files         899      899           
  Lines       64756    64776   +20     
  Branches    11627    11629    +2     
=======================================
+ Hits        35685    35699   +14     
- Misses      26340    26344    +4     
- Partials     2731     2733    +2     
Flag Coverage Δ
#production 42.03% <75.00%> (+0.01%) ⬆️
#tests 94.80% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Copy link
Member

@gerhardol gerhardol left a comment

Choose a reason for hiding this comment

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

Seem OK (except for tooltip removal), not tested

GitUI/BranchTreePanel/RepoObjectsTree.Designer.cs Outdated Show resolved Hide resolved
@RussKie
Copy link
Member

RussKie commented Mar 19, 2019

I've checked out your revision. There are some visual artifacts:
image
image

  • Git Extensions 3.1.0
  • Build 3191d22
  • Git 2.19.0.windows.1
  • Microsoft Windows NT 10.0.17134.0
  • .NET Framework 4.7.3260.0
  • DPI 144dpi (150% scaling)

@RussKie RussKie changed the title Add ability to Copy to Clipboard, similar to commit context menu from left panel WIP: Add ability to Copy to Clipboard, similar to commit context menu from left panel Mar 19, 2019
@RussKie RussKie added this to the 4.0 milestone Nov 17, 2019
@RussKie RussKie modified the milestones: 3.4, 4.0 May 18, 2020
@ghost ghost self-assigned this May 18, 2020
@ghost
Copy link
Author

ghost commented Aug 30, 2020

For discussion in #8414

We can get git revision on user request.
At the moment of opening the menu. This will be similar to running a command in the console.

public GitRevision GetRevision([CanBeNull] ObjectId objectId = null, bool shortFormat = false, bool loadRefs = false)

Or we can add "GetRevisions" method with commands.

git show branch1 branch2 [list others] --format=%H%n%T%n%P%n%aN%n%aE%n%at%n%cN%n%cE%n%ct%n%e%n --no-patch

image

And add revision information on tree build

private async Task<Nodes> LoadNodesAsync(CancellationToken token)
{
    await TaskScheduler.Default;
    token.ThrowIfCancellationRequested();

    var branchNames = Module.GetRefs(tags: false, branches: true, noLocks: true).Select(b => b.Name);
    return FillBranchTree(branchNames, token);
}

After

var branchNames = Module.GetRefs(tags: false, branches: true, noLocks: true).Select(b => b.Name);

Most likely there is a way to combine both commands.


In the current solution, the situation is similar with hidden branches - it shows the last selected one.

@ghost
Copy link
Author

ghost commented Aug 31, 2020

Also for discussion #8414

Text = displayText.TrimEnd('\r', '\n')

For fix

image

@RussKie
Copy link
Member

RussKie commented Sep 7, 2020

Also for discussion #8414

Text = displayText.TrimEnd('\r', '\n')

For fix

Yes, I think we'll have to do this 👍

For discussion in #8414

We can get git revision on user request.
At the moment of opening the menu. This will be similar to running a command in the console.

public GitRevision GetRevision([CanBeNull] ObjectId objectId = null, bool shortFormat = false, bool loadRefs = false)

Or we can add "GetRevisions" method with commands.

git show branch1 branch2 [list others] --format=%H%n%T%n%P%n%aN%n%aE%n%at%n%cN%n%cE%n%ct%n%e%n --no-patch

If possible I'd rather reduce a number of commands we run (we run a lot of them as is, some commands are run multiple times during the same operation).
When a user clicks on a node in the left panel, we select the corresponding commit in the revision grid, and from it we have access to the same information if the user were to right click on the grid entry itself.

Pertaining to the discussion in #8414 - if a branch is filtered out of the view, I can't see a good use case where we need to bend over backwards to provide extra information for it. Similar to an inactive remote - there's no information until it is activated and fetched.

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.

👍
Currently blocked by #8434 and #8414 due to pending infra changes.

@RussKie RussKie added the area: left-panel Issues related to the Left Panel label Sep 7, 2020
@ghost
Copy link
Author

ghost commented Sep 7, 2020

Pertaining to the discussion in #8414 - if a branch is filtered out of the view, I can't see a good use case where we need to bend over backwards to provide extra information for it. Similar to an inactive remote - there's no information until it is activated and fetched.

I understand correctly that there is no separation between model and view. Everything is stored in a grid, and after deletion you need to access the repository?

@ghost
Copy link
Author

ghost commented Sep 7, 2020

As I imagine, we have a hash of the commit, and we can get all the necessary information from the model by the hash. (ObjectId)
But that's not how it works now.

@RussKie
Copy link
Member

RussKie commented Sep 8, 2020

I understand correctly that there is no separation between model and view. Everything is stored in a grid, and after deletion you need to access the repository?

Correct, unfortunately there's no separation (and it does bother me). And this makes a lot of thing significantly harder than they should be. E.g. we do a lot of refreshes, which cause flicker, and result in multiple git calls.
Ideally the grid should just bind to an observable list of commits.

@ghost ghost mentioned this pull request Sep 21, 2020
@ghost
Copy link
Author

ghost commented Oct 6, 2020

Removed the display for the hidden node.

image

image

@ghost ghost changed the title WIP: Add ability to Copy to Clipboard, similar to commit context menu from left panel Add ability to Copy to Clipboard, similar to commit context menu from left panel Oct 6, 2020
@ghost ghost requested review from gerhardol and RussKie October 6, 2020 11:13
@RussKie
Copy link
Member

RussKie commented Oct 11, 2020

I ran it locally, and something isn't working 100% but I couldn't quite see from the diff.

When I right click on the latest master (4355746) in the revision grid and select copy commit:
image
I get the following:

Merge pull request #8527 from BrianFreemanAtlanta/RemoveFilesUpdateNameTooLong

updated removeFiles to use GetBatchOutput and added unit tests

When I do the same from the left panel I only get the first line:

Merge pull request #8527 from BrianFreemanAtlanta/RemoveFilesUpdateNameTooLong

@RussKie RussKie added 📭 needs: author feedback More info/confirmation awaited from OP; issues typically get closed after 30 days of inactivity and removed 👓 status: needs review labels Oct 11, 2020
@ghost ghost removed the 📭 needs: author feedback More info/confirmation awaited from OP; issues typically get closed after 30 days of inactivity label Oct 11, 2020
@ghost
Copy link
Author

ghost commented Oct 11, 2020

Changed revisions provider.

copyContextMenuItem.SetRevisionFunc(() => _scriptHost.GetSelectedRevisions());

@RussKie RussKie merged commit 75c7aae into gitextensions:master Oct 11, 2020
@RussKie
Copy link
Member

RussKie commented Oct 11, 2020

Thank you 🎉

This certainly has been a long journey, thank you for sticking around.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: left-panel Issues related to the Left Panel 🖊️ status: cla signed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Branches pane context menu should support Copy to Clipboard, similar to commit context menu
3 participants