-
Notifications
You must be signed in to change notification settings - Fork 915
Choose between multiple remotes instead of showing an error #8922
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
base: master
Are you sure you want to change the base?
Changes from all commits
3980e6d
49f6dd9
206eb74
7320033
dfc9ce9
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 |
|---|---|---|
|
|
@@ -129,7 +129,11 @@ public void setRemote (GitRemoteConfig remote) { | |
| } | ||
|
|
||
| public void fillRemoteBranches (final Map<String, GitBranch> branches) { | ||
| fillRemoteBranches(Collections.<String,GitBranch>emptyMap(), Collections.<String,GitBranch>emptyMap()); | ||
| fillRemoteBranches(branches, null); | ||
| } | ||
|
|
||
| public void fillRemoteBranches (final Map<String, GitBranch> branches, final GitBranch branchToSelect) { | ||
| fillRemoteBranchesInternal(Collections.<String,GitBranch>emptyMap(), Collections.<String,GitBranch>emptyMap(), null); | ||
|
Contributor
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. Is the intention here to start with an empty list in any case and then update when loading is done? That might be worth a comment. I was wondering why
Contributor
Author
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. I tested it yes (Maybe I missed a thing, as always. When you pull a branch without upstream, nothing is selected. When you do a pull from upstream, the error came up "no tracked brach specified for local branch....". And if I remove this, nothing is selected anymore on pull from upstrean. It can be, that I need to modify the line 169 - 173.
Contributor
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. Sorry, I don't get it. line 169-173 can't be reached for the marked case. I mean this call: fillRemoteBranchesInternal(Collections.<String,GitBranch>emptyMap(), Collections.<String,GitBranch>emptyMap(), null);This will basicly execute (the maps are empty, so all loops in List<BranchMapping> l = new ArrayList<BranchMapping>(0);
Set<String> displayedBranches = new HashSet<String>(0);
this.branches.setBranches(l);
stateChanged(new ChangeEvent(this));I read this as "reset the item selector into a clean state".
Contributor
Author
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. Yes, at the end, it is just to make everything set to the default. The null value. If the branchToSelect is set, line 175 is reached. Everything else, is for the default behaviour. |
||
| new GitProgressSupport.NoOutputLogging() { | ||
| @Override | ||
| protected void perform () { | ||
|
|
@@ -140,14 +144,14 @@ protected void perform () { | |
| EventQueue.invokeLater(new Runnable () { | ||
| @Override | ||
| public void run () { | ||
| fillRemoteBranches(branches, localBranches); | ||
| fillRemoteBranchesInternal(branches, localBranches, branchToSelect); | ||
| } | ||
| }); | ||
| } | ||
| }.start(Git.getInstance().getRequestProcessor(repository), repository, NbBundle.getMessage(PullBranchesStep.class, "MSG_FetchBranchesPanel.loadingLocalBranches")); //NOI18N | ||
| } | ||
|
|
||
| private void fillRemoteBranches (Map<String, GitBranch> branches, Map<String, GitBranch> localBranches) { | ||
| private void fillRemoteBranchesInternal (Map<String, GitBranch> branches, Map<String, GitBranch> localBranches, GitBranch branchToSelect) { | ||
| List<BranchMapping> l = new ArrayList<BranchMapping>(branches.size()); | ||
| Set<String> displayedBranches = new HashSet<String>(localBranches.size()); | ||
| for (GitBranch branch : localBranches.values()) { | ||
|
|
@@ -163,9 +167,14 @@ private void fillRemoteBranches (Map<String, GitBranch> branches, Map<String, Gi | |
| GitBranch localBranch = localBranches.get(branchName); | ||
| boolean preselected = localBranch != null && (!localBranch.getId().equals(branch.getId()) // is a modification | ||
| // or is the tracked branch - should be offered primarily | ||
| || currentBranch != null | ||
| && currentBranch.getTrackedBranch() != null | ||
| || currentBranch != null | ||
| && currentBranch.getTrackedBranch() != null | ||
| && currentBranch.getTrackedBranch().getName().equals(localBranch.getName())); | ||
|
|
||
| if (branchToSelect != null && branch.getName().equals(branchToSelect.getName())) { | ||
| preselected = true; | ||
| } | ||
|
|
||
| l.add(new BranchMapping(branch.getName(), branch.getId(), localBranch, remote, preselected)); | ||
| } | ||
| for (GitBranch branch : localBranches.values()) { | ||
|
|
||
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.
Am I correct in assuming, that this not called on the EDT?
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.
If this is the hint then thx for this. It never gets into the finally block, beause of another thread is cancelling this. The magic happens in GitUtils.java:886.
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.
runWithoutIndexingcan't have part in this. It is inside thetry-block, so the finally still must be executed (try-block is line 170-236, finally is lines 240-256). I'm not aware of ways to skip execution of a finally block.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.
It could be, that runWithoutindexing is not part here, but I set breakpoints and see, that only the finally block inside of the runWithoutIndexing is executed, after this , no other finally block is reached. So the inner finally block is reached, the outer not. This is why I'm confused. As said, my assumption is something with different threads?