From 42b0b53f0c1fe688139dd09bf4759ce661a516de Mon Sep 17 00:00:00 2001 From: Eric Amodio Date: Mon, 12 Oct 2020 02:42:47 -0400 Subject: [PATCH] Moves pr node to be first, if exists Moves compare node to be next Changes compare node label to start with Compare --- src/views/nodes/branchNode.ts | 30 ++++++++++++++---------------- src/views/nodes/compareBranchNode.ts | 13 ++++--------- 2 files changed, 18 insertions(+), 25 deletions(-) diff --git a/src/views/nodes/branchNode.ts b/src/views/nodes/branchNode.ts index e441290..3b7d3ae 100644 --- a/src/views/nodes/branchNode.ts +++ b/src/views/nodes/branchNode.ts @@ -123,7 +123,15 @@ export class BranchNode ]); if (log == null) return [new MessageNode(this.view, this, 'No commits could be found.')]; + if (pr != null) { + children.push(new PullRequestNode(this.view, this, pr, this.branch)); + } + if (this.options.showTracking) { + if (this.options.showComparison !== false && this.view instanceof CommitsView) { + children.push(new CompareBranchNode(this.uri, this.view, this, this.branch)); + } + const status = { ref: this.branch.ref, repoPath: this.branch.repoPath, @@ -136,32 +144,22 @@ export class BranchNode children.push( new BranchTrackingStatusNode(this.view, this, this.branch, status, 'same', this.root), ); - } - - if (status.state.ahead) { + } else if (status.state.ahead) { children.push( new BranchTrackingStatusNode(this.view, this, this.branch, status, 'ahead', this.root), ); - } - if (status.state.behind) { - children.push( - new BranchTrackingStatusNode(this.view, this, this.branch, status, 'behind', this.root), - ); + if (status.state.behind) { + children.push( + new BranchTrackingStatusNode(this.view, this, this.branch, status, 'behind', this.root), + ); + } } } else if (this.root) { children.push( new BranchTrackingStatusNode(this.view, this, this.branch, status, 'none', this.root), ); } - - if (pr != null) { - children.push(new PullRequestNode(this.view, this, pr, this.branch)); - } - - if (this.options.showComparison !== false && this.view instanceof CommitsView) { - children.push(new CompareBranchNode(this.uri, this.view, this, this.branch)); - } } else if (pr != null) { children.push(new PullRequestNode(this.view, this, pr, this.branch)); } diff --git a/src/views/nodes/compareBranchNode.ts b/src/views/nodes/compareBranchNode.ts index d115bfe..745a0c7 100644 --- a/src/views/nodes/compareBranchNode.ts +++ b/src/views/nodes/compareBranchNode.ts @@ -93,15 +93,10 @@ export class CompareBranchNode extends ViewNode } with `; state = TreeItemCollapsibleState.None; } else { - label = `${this.branch.name}${this.compareWithWorkingTree ? ' (working)' : ''}`; - description = `${GlyphChars.ArrowLeftRightLong}${GlyphChars.Space} ${GitRevision.shorten( - this._compareWith.ref, - { - strings: { - working: 'Working Tree', - }, - }, - )}`; + label = `Compare ${this.branch.name}${this.compareWithWorkingTree ? ' (working)' : ''}`; + description = `with ${GitRevision.shorten(this._compareWith.ref, { + strings: { working: 'Working Tree' }, + })}`; state = TreeItemCollapsibleState.Collapsed; }