Browse Source

Adds add remote cmd when there are no remotes

main
Eric Amodio 4 years ago
parent
commit
4c7051c3ac
4 changed files with 27 additions and 15 deletions
  1. +1
    -0
      CHANGELOG.md
  2. +14
    -9
      package.json
  3. +10
    -6
      src/views/nodes/branchTrackingStatusNode.ts
  4. +2
    -0
      src/views/nodes/viewNode.ts

+ 1
- 0
CHANGELOG.md View File

@ -9,6 +9,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
### Added
- Adds a new _Quick Open File History_ command to all places where _Open File History_ already exists — closes [#1156](https://github.com/eamodio/vscode-gitlens/issues/1156)
- Adds _Add Remote_ command to the branch status in the _Branches_, _Commits_, and _Repositories_ views when there are no Git remotes configured
## [11.1.3] - 2021-01-05

+ 14
- 9
package.json View File

@ -6987,22 +6987,22 @@
},
{
"command": "gitlens.views.publishBranch",
"when": "!gitlens:readonly && viewItem =~ /gitlens:branch\\b(?!.*?\\b\\+tracking\\b)/",
"when": "gitlens:hasRemotes && !gitlens:readonly && viewItem =~ /gitlens:branch\\b(?!.*?\\b\\+tracking\\b)/",
"group": "inline@8"
},
{
"command": "gitlens.views.push",
"when": "!gitlens:readonly && viewItem =~ /gitlens:branch\\b(?=.*?\\b\\+ahead\\b)(?!.*?\\b\\+behind\\b)/",
"when": "gitlens:hasRemotes && !gitlens:readonly && viewItem =~ /gitlens:branch\\b(?=.*?\\b\\+ahead\\b)(?!.*?\\b\\+behind\\b)/",
"group": "inline@8"
},
{
"command": "gitlens.views.pull",
"when": "!gitlens:readonly && viewItem =~ /gitlens:branch\\b(?=.*?\\b\\+behind\\b)/",
"when": "gitlens:hasRemotes && !gitlens:readonly && viewItem =~ /gitlens:branch\\b(?=.*?\\b\\+behind\\b)/",
"group": "inline@8"
},
{
"command": "gitlens.views.fetch",
"when": "!gitlens:readonly && viewItem =~ /gitlens:branch\\b(?!.*?\\b\\+ahead\\b)(?!.*?\\b\\+behind\\b)/",
"when": "gitlens:hasRemotes && !gitlens:readonly && viewItem =~ /gitlens:branch\\b(?=.*?\\b\\+tracking\\b)(?!.*?\\b\\+ahead\\b)(?!.*?\\b\\+behind\\b)/",
"group": "inline@8"
},
{
@ -7012,7 +7012,7 @@
},
{
"command": "gitlens.views.pushToCommit",
"when": "!gitlens:readonly && viewItem =~ /gitlens:commit\\b(?=.*?\\b\\+current\\b)(?=.*?\\b\\+unpublished\\b)/",
"when": "gitlens:hasRemotes && !gitlens:readonly && viewItem =~ /gitlens:commit\\b(?=.*?\\b\\+current\\b)(?=.*?\\b\\+unpublished\\b)/",
"group": "inline@96"
},
{
@ -7651,24 +7651,29 @@
"group": "8_gitlens_actions_@2"
},
{
"command": "gitlens.views.addRemote",
"when": "!gitlens:hasRemotes && !gitlens:readonly && viewItem =~ /gitlens:status(\\-branch)?:upstream:none/",
"group": "inline@1"
},
{
"command": "gitlens.views.publishBranch",
"when": "gitlens:hasRemotes && !gitlens:readonly && viewItem == gitlens:status:upstream:none",
"when": "gitlens:hasRemotes && !gitlens:readonly && viewItem =~ /gitlens:status(\\-branch)?:upstream:none/",
"group": "inline@1"
},
{
"command": "gitlens.views.push",
"when": "gitlens:hasRemotes && !gitlens:readonly && viewItem == gitlens:status:upstream:ahead",
"when": "gitlens:hasRemotes && !gitlens:readonly && viewItem =~ /gitlens:status(\\-branch)?:upstream:ahead/",
"group": "inline@1",
"alt": "gitlens.views.pushWithForce"
},
{
"command": "gitlens.views.pull",
"when": "gitlens:hasRemotes && !gitlens:readonly && viewItem == gitlens:status:upstream:behind",
"when": "gitlens:hasRemotes && !gitlens:readonly && viewItem =~ /gitlens:status(\\-branch)?:upstream:behind/",
"group": "inline@1"
},
{
"command": "gitlens.views.fetch",
"when": "gitlens:hasRemotes && !gitlens:readonly && viewItem =~ /gitlens:status:upstream:(?!none)/",
"when": "gitlens:hasRemotes && !gitlens:readonly && viewItem =~ /gitlens:status(\\-branch)?:upstream:(?!none)/",
"group": "inline@2"
},
{

+ 10
- 6
src/views/nodes/branchTrackingStatusNode.ts View File

@ -216,15 +216,16 @@ export class BranchTrackingStatusNode extends ViewNode impleme
}${remote?.provider?.name ? ` on ${remote.provider.name}` : ''}`;
collapsibleState = TreeItemCollapsibleState.None;
contextValue = this.root ? ContextValues.StatusSameAsUpstream : undefined;
contextValue = this.root
? ContextValues.StatusSameAsUpstream
: ContextValues.BranchStatusSameAsUpstream;
icon = new ThemeIcon('cloud');
break;
}
case 'none': {
const providers = GitRemote.getHighlanderProviders(
await Container.git.getRemotes(this.branch.repoPath),
);
const remotes = await Container.git.getRemotes(this.branch.repoPath);
const providers = GitRemote.getHighlanderProviders(remotes);
const providerName = providers?.length ? providers[0].name : undefined;
label = `Publish ${this.branch.name} to ${providerName ?? 'a remote'}`;
@ -233,8 +234,11 @@ export class BranchTrackingStatusNode extends ViewNode impleme
}`;
collapsibleState = TreeItemCollapsibleState.None;
contextValue = this.root ? ContextValues.StatusNoUpstream : undefined;
icon = new ThemeIcon('cloud-upload', new ThemeColor('gitlens.viewChangesToPushIconColor'));
contextValue = this.root ? ContextValues.StatusNoUpstream : ContextValues.BranchStatusNoUpstream;
icon = new ThemeIcon(
'cloud-upload',
remotes.length ? new ThemeColor('gitlens.viewChangesToPushIconColor') : undefined,
);
break;
}

+ 2
- 0
src/views/nodes/viewNode.ts View File

@ -21,6 +21,8 @@ export enum ContextValues {
Branches = 'gitlens:branches',
BranchStatusAheadOfUpstream = 'gitlens:status-branch:upstream:ahead',
BranchStatusBehindUpstream = 'gitlens:status-branch:upstream:behind',
BranchStatusNoUpstream = 'gitlens:status-branch:upstream:none',
BranchStatusSameAsUpstream = 'gitlens:status-branch:upstream:same',
BranchStatusFiles = 'gitlens:status-branch:files',
Commit = 'gitlens:commit',
Commits = 'gitlens:commits',

Loading…
Cancel
Save