mirror of
https://github.com/ckaczor/vscode-gitlens.git
synced 2026-02-12 11:08:34 -05:00
Compare commits
7 Commits
v5.0.0-bet
...
v5.0.0-bet
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9464f7e79f | ||
|
|
77ae37c54c | ||
|
|
e20ec552b7 | ||
|
|
f911447c5e | ||
|
|
38c44c808d | ||
|
|
655afb358e | ||
|
|
21e0963600 |
@@ -4,7 +4,7 @@ All notable changes to this project will be documented in this file.
|
|||||||
|
|
||||||
The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/).
|
The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/).
|
||||||
|
|
||||||
## [5.0.0-beta] - 2017-09-11
|
## [5.0.0-beta.2] - 2017-09-12
|
||||||
### Added
|
### Added
|
||||||
- Adds an all-new `GitLens` custom view to the Explorer activity
|
- Adds an all-new `GitLens` custom view to the Explorer activity
|
||||||
|
|
||||||
@@ -63,6 +63,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
|
|||||||
- Clicking on `Changes` will run the `Compare File Revisions` command (`gitlens.diffWith`)
|
- Clicking on `Changes` will run the `Compare File Revisions` command (`gitlens.diffWith`)
|
||||||
- Clicking the current and previous commit ids will run the `Show Commit Details` command (`gitlens.showQuickCommitDetails`)
|
- Clicking the current and previous commit ids will run the `Show Commit Details` command (`gitlens.showQuickCommitDetails`)
|
||||||
- Adds support for custom remote services - see [#120](https://github.com/eamodio/vscode-gitlens/issues/120)
|
- Adds support for custom remote services - see [#120](https://github.com/eamodio/vscode-gitlens/issues/120)
|
||||||
|
- Adds support for the Bitbucket Server (previously called Stash) remote service - see [#120](https://github.com/eamodio/vscode-gitlens/issues/120)
|
||||||
- Adds `Compare File Revisions` command (`gitlens.diffWith`) - compares the specified file revisions
|
- Adds `Compare File Revisions` command (`gitlens.diffWith`) - compares the specified file revisions
|
||||||
- Adds `Open Branches in Remote` command (`gitlens.openBranchesInRemote`) - opens the branches in the supported remote service
|
- Adds `Open Branches in Remote` command (`gitlens.openBranchesInRemote`) - opens the branches in the supported remote service
|
||||||
- Adds `Stash Changes` command (`gitlens.stashSave`) to the source control group context menu -- can now stash a group of files
|
- Adds `Stash Changes` command (`gitlens.stashSave`) to the source control group context menu -- can now stash a group of files
|
||||||
@@ -92,10 +93,12 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
|
|||||||
- Removes the seeding of the commit search command from the clipboard
|
- Removes the seeding of the commit search command from the clipboard
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
- Fixes an issue where double hover annotations could be shown on blank lines
|
||||||
- Fixes an issue where remote branches couldn't be opened properly in their remote service
|
- Fixes an issue where remote branches couldn't be opened properly in their remote service
|
||||||
- Fixes [#130](https://github.com/eamodio/vscode-gitlens/issues/130) - First-run "Thank you for choosing GitLens! [...]" info message shown on every start up
|
- Fixes [#130](https://github.com/eamodio/vscode-gitlens/issues/130) - First-run "Thank you for choosing GitLens! [...]" info message shown on every start up
|
||||||
- Fixes [#120](https://github.com/eamodio/vscode-gitlens/issues/120) - Feature Request: "Open in Remote" support for custom repositories
|
- Fixes [#120](https://github.com/eamodio/vscode-gitlens/issues/120) - Feature Request: "Open in Remote" support for custom repositories
|
||||||
- Fixes an issue where sometimes diffs (via branch name) wouldn't open properly
|
- Fixes an issue where sometimes diffs (via branch name) wouldn't open properly
|
||||||
|
- Fixes an issue where remotes are queried more than once on startup
|
||||||
|
|
||||||
## [4.4.3] - 2017-08-30
|
## [4.4.3] - 2017-08-30
|
||||||
## Fixed
|
## Fixed
|
||||||
|
|||||||
@@ -172,6 +172,7 @@ GitLens provides an unobtrusive blame annotation at the end of the current line,
|
|||||||
- Adds a `Search Commits` command (`gitlens.showCommitSearch`) with a shortcut of `alt+/` to search for commits by message, author, file(s), or commit id
|
- Adds a `Search Commits` command (`gitlens.showCommitSearch`) with a shortcut of `alt+/` to search for commits by message, author, file(s), or commit id
|
||||||
|
|
||||||
- Adds commands to open files, commits, branches, and the repository in the supported remote services, currently **BitBucket, GitHub, GitLab, and Visual Studio Team Services** — only available if a Git upstream service is configured in the repository
|
- Adds commands to open files, commits, branches, and the repository in the supported remote services, currently **BitBucket, GitHub, GitLab, and Visual Studio Team Services** — only available if a Git upstream service is configured in the repository
|
||||||
|
- Also supports [custom](#custom-remote-settings) remote services, such as **BitBucket, Bitbucket Server (previously called Stash), GitHub, GitLab**
|
||||||
- `Open Branches in Remote` command (`gitlens.openBranchesInRemote`) — opens the branches in the supported remote service
|
- `Open Branches in Remote` command (`gitlens.openBranchesInRemote`) — opens the branches in the supported remote service
|
||||||
- `Open Branch in Remote` command (`gitlens.openBranchInRemote`) — opens the current branch commits in the supported remote service
|
- `Open Branch in Remote` command (`gitlens.openBranchInRemote`) — opens the current branch commits in the supported remote service
|
||||||
- `Open Commit in Remote` command (`gitlens.openCommitInRemote`) — opens the commit revision of the active line in the supported remote service
|
- `Open Commit in Remote` command (`gitlens.openCommitInRemote`) — opens the commit revision of the active line in the supported remote service
|
||||||
@@ -350,7 +351,7 @@ GitLens is highly customizable and provides many configuration settings to allow
|
|||||||
|`gitlens.gitExplorer.stashFormat`|Specifies the format of stashed changes in the `GitLens` custom view<br />Available tokens<br /> ${id} - commit id<br /> ${author} - commit author<br /> ${message} - commit message<br /> ${ago} - relative commit date (e.g. 1 day ago)<br /> ${date} - formatted commit date (format specified by `gitlens.statusBar.dateFormat`)<br /> ${authorAgo} - commit author, relative commit date<br />See https://github.com/eamodio/vscode-gitlens/wiki/Advanced-Formatting for advanced formatting
|
|`gitlens.gitExplorer.stashFormat`|Specifies the format of stashed changes in the `GitLens` custom view<br />Available tokens<br /> ${id} - commit id<br /> ${author} - commit author<br /> ${message} - commit message<br /> ${ago} - relative commit date (e.g. 1 day ago)<br /> ${date} - formatted commit date (format specified by `gitlens.statusBar.dateFormat`)<br /> ${authorAgo} - commit author, relative commit date<br />See https://github.com/eamodio/vscode-gitlens/wiki/Advanced-Formatting for advanced formatting
|
||||||
|`gitlens.gitExplorer.stashFileFormat`|Specifies the format of a stashed file in the `GitLens` custom view<br />Available tokens<br /> ${file} - file name<br /> ${filePath} - file name and path<br /> ${path} - file path
|
|`gitlens.gitExplorer.stashFileFormat`|Specifies the format of a stashed file in the `GitLens` custom view<br />Available tokens<br /> ${file} - file name<br /> ${filePath} - file name and path<br /> ${path} - file path
|
||||||
|
|
||||||
### GitLens Custom Remotes Settings
|
### Custom Remotes Settings
|
||||||
|
|
||||||
|Name | Description
|
|Name | Description
|
||||||
|-----|------------
|
|-----|------------
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="16px" height="22px">
|
<svg width="16" height="22" version="1.1" xmlns="http://www.w3.org/2000/svg">
|
||||||
<path fill="#C5C5C5" d="m14.687501,11.955358l-1.079554,-6.821251c-0.076429,-0.458572 -0.477679,-0.821607 -0.955357,-0.821607l-9.30518,0c-0.477679,0 -0.878929,0.363036 -0.955357,0.821607l-1.079554,6.821251l0,4.776787c0,0.525447 0.429911,0.955357 0.955357,0.955357l11.464288,0c0.525447,0 0.955357,-0.429911 0.955357,-0.955357l0,-4.776787l0,0zm-3.133572,0.525447l-0.420357,0.850268c-0.162411,0.324821 -0.496786,0.535 -0.869375,0.535l-4.547501,0c-0.363036,0 -0.687857,-0.210179 -0.850268,-0.525447l-0.420357,-0.869375c-0.162411,-0.315268 -0.496786,-0.525447 -0.850268,-0.525447l-1.327947,0l0.955357,-6.687501l9.553573,0l0.955357,6.687501l-1.318393,0c-0.372589,0 -0.697411,0.210179 -0.869375,0.525447l0.009554,0.009554z" />
|
<path fill="#C5C5C5" d="m14.687501,11.955358l-1.079554,-6.821251c-0.076429,-0.458572 -0.477679,-0.821607 -0.955357,-0.821607l-9.30518,0c-0.477679,0 -0.878929,0.363036 -0.955357,0.821607l-1.079554,6.821251l0,4.776787c0,0.525447 0.429911,0.955357 0.955357,0.955357l11.464288,0c0.525447,0 0.955357,-0.429911 0.955357,-0.955357l0,-4.776787l0,0zm-3.133572,0.525447l-0.420357,0.850268c-0.162411,0.324821 -0.496786,0.535 -0.869375,0.535l-4.547501,0c-0.363036,0 -0.687857,-0.210179 -0.850268,-0.525447l-0.420357,-0.869375c-0.162411,-0.315268 -0.496786,-0.525447 -0.850268,-0.525447l-1.327947,0l0.955357,-6.687501l9.553573,0l0.955357,6.687501l-1.318393,0c-0.372589,0 -0.697411,0.210179 -0.869375,0.525447l0.009554,0.009554z" />
|
||||||
</svg>
|
</svg>
|
||||||
|
Before Width: | Height: | Size: 893 B After Width: | Height: | Size: 846 B |
4
images/dark/icon-sync.svg
Normal file
4
images/dark/icon-sync.svg
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<svg width="16" height="22" version="1.1" xmlns="http://www.w3.org/2000/svg">
|
||||||
|
<path fill="#C5C5C5" d="m12.24,10.4c0.19,1.28 -0.2,2.62 -1.2,3.6c-1.47,1.45 -3.74,1.63 -5.41,0.54l1.17,-1.14l-4.3,-0.6l0.6,4.2l1.31,-1.26c2.36,1.74 5.7,1.57 7.84,-0.54c1.24,-1.23 1.81,-2.85 1.74,-4.46l-1.75,-0.34l0,0zm-7.28,-2.4c1.47,-1.45 3.74,-1.63 5.41,-0.54l-1.17,1.14l4.3,0.6l-0.6,-4.2l-1.31,1.26c-2.36,-1.74 -5.7,-1.57 -7.85,0.54c-1.24,1.23 -1.8,2.85 -1.73,4.46l1.75,0.35c-0.19,-1.28 0.2,-2.63 1.2,-3.61l0,0z" />
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 546 B |
@@ -1,4 +1,4 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="16px" height="22px">
|
<svg width="16" height="22" version="1.1" xmlns="http://www.w3.org/2000/svg">
|
||||||
<path fill="#424242" d="m14.687501,11.955358l-1.079554,-6.821251c-0.076429,-0.458572 -0.477679,-0.821607 -0.955357,-0.821607l-9.30518,0c-0.477679,0 -0.878929,0.363036 -0.955357,0.821607l-1.079554,6.821251l0,4.776787c0,0.525447 0.429911,0.955357 0.955357,0.955357l11.464288,0c0.525447,0 0.955357,-0.429911 0.955357,-0.955357l0,-4.776787l0,0zm-3.133572,0.525447l-0.420357,0.850268c-0.162411,0.324821 -0.496786,0.535 -0.869375,0.535l-4.547501,0c-0.363036,0 -0.687857,-0.210179 -0.850268,-0.525447l-0.420357,-0.869375c-0.162411,-0.315268 -0.496786,-0.525447 -0.850268,-0.525447l-1.327947,0l0.955357,-6.687501l9.553573,0l0.955357,6.687501l-1.318393,0c-0.372589,0 -0.697411,0.210179 -0.869375,0.525447l0.009554,0.009554z" />
|
<path fill="#424242" d="m14.687501,11.955358l-1.079554,-6.821251c-0.076429,-0.458572 -0.477679,-0.821607 -0.955357,-0.821607l-9.30518,0c-0.477679,0 -0.878929,0.363036 -0.955357,0.821607l-1.079554,6.821251l0,4.776787c0,0.525447 0.429911,0.955357 0.955357,0.955357l11.464288,0c0.525447,0 0.955357,-0.429911 0.955357,-0.955357l0,-4.776787l0,0zm-3.133572,0.525447l-0.420357,0.850268c-0.162411,0.324821 -0.496786,0.535 -0.869375,0.535l-4.547501,0c-0.363036,0 -0.687857,-0.210179 -0.850268,-0.525447l-0.420357,-0.869375c-0.162411,-0.315268 -0.496786,-0.525447 -0.850268,-0.525447l-1.327947,0l0.955357,-6.687501l9.553573,0l0.955357,6.687501l-1.318393,0c-0.372589,0 -0.697411,0.210179 -0.869375,0.525447l0.009554,0.009554z" />
|
||||||
</svg>
|
</svg>
|
||||||
|
Before Width: | Height: | Size: 893 B After Width: | Height: | Size: 846 B |
4
images/light/icon-sync.svg
Normal file
4
images/light/icon-sync.svg
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<svg width="16" height="22" version="1.1" xmlns="http://www.w3.org/2000/svg">
|
||||||
|
<path fill="#424242" d="m12.24,10.4c0.19,1.28 -0.2,2.62 -1.2,3.6c-1.47,1.45 -3.74,1.63 -5.41,0.54l1.17,-1.14l-4.3,-0.6l0.6,4.2l1.31,-1.26c2.36,1.74 5.7,1.57 7.84,-0.54c1.24,-1.23 1.81,-2.85 1.74,-4.46l-1.75,-0.34l0,0zm-7.28,-2.4c1.47,-1.45 3.74,-1.63 5.41,-0.54l-1.17,1.14l4.3,0.6l-0.6,-4.2l-1.31,1.26c-2.36,-1.74 -5.7,-1.57 -7.85,0.54c-1.24,1.23 -1.8,2.85 -1.73,4.46l1.75,0.35c-0.19,-1.28 0.2,-2.63 1.2,-3.61l0,0z" />
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 546 B |
2
package-lock.json
generated
2
package-lock.json
generated
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "gitlens",
|
"name": "gitlens",
|
||||||
"version": "5.0.0-beta",
|
"version": "5.0.0-beta.2",
|
||||||
"lockfileVersion": 1,
|
"lockfileVersion": 1,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "gitlens",
|
"name": "gitlens",
|
||||||
"version": "5.0.0-beta",
|
"version": "5.0.0-beta.2",
|
||||||
"author": {
|
"author": {
|
||||||
"name": "Eric Amodio",
|
"name": "Eric Amodio",
|
||||||
"email": "eamodio@gmail.com"
|
"email": "eamodio@gmail.com"
|
||||||
@@ -461,10 +461,11 @@
|
|||||||
"type": "string",
|
"type": "string",
|
||||||
"enum": [
|
"enum": [
|
||||||
"Bitbucket",
|
"Bitbucket",
|
||||||
|
"BitbucketServer",
|
||||||
"GitHub",
|
"GitHub",
|
||||||
"GitLab"
|
"GitLab"
|
||||||
],
|
],
|
||||||
"description": "Specifies the type of the custom remote service\n `Bitbucket`, `GitHub`, or `GitLab`"
|
"description": "Specifies the type of the custom remote service\n `Bitbucket`, `BitbucketServer`, `GitHub`, or `GitLab`"
|
||||||
},
|
},
|
||||||
"domain": {
|
"domain": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
@@ -1525,12 +1526,12 @@
|
|||||||
"view/item/context": [
|
"view/item/context": [
|
||||||
{
|
{
|
||||||
"command": "gitlens.openBranchesInRemote",
|
"command": "gitlens.openBranchesInRemote",
|
||||||
"when": "gitlens:enabled && gitlens:hasRemotes && view == gitlens.gitExplorer && viewItem == gitlens:branches",
|
"when": "gitlens:enabled && gitlens:hasRemotes && view == gitlens.gitExplorer && viewItem == gitlens:branches:remote",
|
||||||
"group": "1_gitlens@1"
|
"group": "1_gitlens@1"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"command": "gitlens.openBranchInRemote",
|
"command": "gitlens.openBranchInRemote",
|
||||||
"when": "gitlens:enabled && gitlens:hasRemotes && view == gitlens.gitExplorer && viewItem == gitlens:branch-history",
|
"when": "gitlens:enabled && gitlens:hasRemotes && view == gitlens.gitExplorer && viewItem == gitlens:branch-history:remote",
|
||||||
"group": "1_gitlens@1"
|
"group": "1_gitlens@1"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -48,6 +48,7 @@ export type CustomRemoteType =
|
|||||||
'GitLab';
|
'GitLab';
|
||||||
export const CustomRemoteType = {
|
export const CustomRemoteType = {
|
||||||
Bitbucket: 'Bitbucket' as CustomRemoteType,
|
Bitbucket: 'Bitbucket' as CustomRemoteType,
|
||||||
|
BitbucketServer: 'BitbucketServer' as CustomRemoteType,
|
||||||
GitHub: 'GitHub' as CustomRemoteType,
|
GitHub: 'GitHub' as CustomRemoteType,
|
||||||
GitLab: 'GitLab' as CustomRemoteType
|
GitLab: 'GitLab' as CustomRemoteType
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -432,7 +432,7 @@ export class CurrentLineController extends Disposable {
|
|||||||
decoration.range = editor.document.validateRange(new Range(line, showDetailsStartIndex, line, endOfLineIndex));
|
decoration.range = editor.document.validateRange(new Range(line, showDetailsStartIndex, line, endOfLineIndex));
|
||||||
decorationOptions.push(decoration);
|
decorationOptions.push(decoration);
|
||||||
|
|
||||||
if (showDetailsInStartingWhitespace && showDetailsStartIndex !== 0) {
|
if (showDetailsInStartingWhitespace && showDetailsStartIndex !== 0 && decoration.range.end.character !== 0) {
|
||||||
decorationOptions.push(Annotations.withRange(decoration, 0, firstNonWhitespace));
|
decorationOptions.push(Annotations.withRange(decoration, 0, firstNonWhitespace));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -446,7 +446,7 @@ export class CurrentLineController extends Disposable {
|
|||||||
decoration.range = editor.document.validateRange(new Range(line, showChangesStartIndex, line, endOfLineIndex));
|
decoration.range = editor.document.validateRange(new Range(line, showChangesStartIndex, line, endOfLineIndex));
|
||||||
decorationOptions.push(decoration);
|
decorationOptions.push(decoration);
|
||||||
|
|
||||||
if (showChangesInStartingWhitespace && showChangesStartIndex !== 0) {
|
if (showChangesInStartingWhitespace && showChangesStartIndex !== 0 && decoration.range.end.character !== 0) {
|
||||||
decorationOptions.push(Annotations.withRange(decoration, 0, firstNonWhitespace));
|
decorationOptions.push(Annotations.withRange(decoration, 0, firstNonWhitespace));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,7 +38,6 @@ export class GitContextTracker extends Disposable {
|
|||||||
setCommandContext(CommandContext.IsRepository, !!this.git.repoPath);
|
setCommandContext(CommandContext.IsRepository, !!this.git.repoPath);
|
||||||
|
|
||||||
this._onConfigurationChanged();
|
this._onConfigurationChanged();
|
||||||
this._onActiveTextEditorChanged(window.activeTextEditor);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
dispose() {
|
dispose() {
|
||||||
|
|||||||
47
src/git/remotes/bitbucket-server.ts
Normal file
47
src/git/remotes/bitbucket-server.ts
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
'use strict';
|
||||||
|
import { Range } from 'vscode';
|
||||||
|
import { RemoteProvider } from './provider';
|
||||||
|
|
||||||
|
export class BitbucketServerService extends RemoteProvider {
|
||||||
|
|
||||||
|
constructor(public domain: string, public path: string, public custom: boolean = false) {
|
||||||
|
super(domain, path);
|
||||||
|
}
|
||||||
|
|
||||||
|
get name() {
|
||||||
|
return this.formatName('Bitbucket Server');
|
||||||
|
}
|
||||||
|
|
||||||
|
protected get baseUrl() {
|
||||||
|
const [project, repo] = super.splitPath();
|
||||||
|
return `https://${this.domain}/projects/${project}/repos/${repo}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected getUrlForBranches(): string {
|
||||||
|
return `${this.baseUrl}/branches`;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected getUrlForBranch(branch: string): string {
|
||||||
|
return `${this.baseUrl}/commits?until=${branch}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected getUrlForCommit(sha: string): string {
|
||||||
|
return `${this.baseUrl}/commits/${sha}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected getUrlForFile(fileName: string, branch?: string, sha?: string, range?: Range): string {
|
||||||
|
let line = '';
|
||||||
|
if (range) {
|
||||||
|
if (range.start.line === range.end.line) {
|
||||||
|
line = `#${range.start.line}`;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
line = `#${range.start.line}-${range.end.line}`;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (sha) return `${this.baseUrl}/browse/${fileName}?at=${sha}${line}`;
|
||||||
|
if (branch) return `${this.baseUrl}/browse/${fileName}?at=${branch}${line}`;
|
||||||
|
return `${this.baseUrl}/browse/${fileName}${line}`;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -4,12 +4,12 @@ import { RemoteProvider } from './provider';
|
|||||||
|
|
||||||
export class BitbucketService extends RemoteProvider {
|
export class BitbucketService extends RemoteProvider {
|
||||||
|
|
||||||
constructor(public domain: string, public path: string) {
|
constructor(public domain: string, public path: string, public custom: boolean = false) {
|
||||||
super(domain, path);
|
super(domain, path);
|
||||||
}
|
}
|
||||||
|
|
||||||
get name() {
|
get name() {
|
||||||
return 'Bitbucket';
|
return this.formatName('Bitbucket');
|
||||||
}
|
}
|
||||||
|
|
||||||
protected getUrlForBranches(): string {
|
protected getUrlForBranches(): string {
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
import { ExtensionContext, workspace } from 'vscode';
|
import { ExtensionContext, workspace } from 'vscode';
|
||||||
import { BitbucketService } from './bitbucket';
|
import { BitbucketService } from './bitbucket';
|
||||||
|
import { BitbucketServerService } from './bitbucket-server';
|
||||||
import { CustomRemoteType, IConfig, IRemotesConfig } from '../../configuration';
|
import { CustomRemoteType, IConfig, IRemotesConfig } from '../../configuration';
|
||||||
import { ExtensionKey } from '../../constants';
|
import { ExtensionKey } from '../../constants';
|
||||||
import { GitHubService } from './github';
|
import { GitHubService } from './github';
|
||||||
@@ -14,11 +15,12 @@ export { RemoteProvider };
|
|||||||
|
|
||||||
const UrlRegex = /^(?:git:\/\/(.*?)\/|https:\/\/(.*?)\/|http:\/\/(.*?)\/|git@(.*):|ssh:\/\/(?:.*@)?(.*?)(?::.*?)?\/)(.*)$/;
|
const UrlRegex = /^(?:git:\/\/(.*?)\/|https:\/\/(.*?)\/|http:\/\/(.*?)\/|git@(.*):|ssh:\/\/(?:.*@)?(.*?)(?::.*?)?\/)(.*)$/;
|
||||||
|
|
||||||
function getProviderKey(type: CustomRemoteType) {
|
function getCustomProvider(type: CustomRemoteType) {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case CustomRemoteType.Bitbucket: return 'bitbucket.org';
|
case CustomRemoteType.Bitbucket: return (domain: string, path: string) => new BitbucketService(domain, path, true);
|
||||||
case CustomRemoteType.GitHub: return 'github.com';
|
case CustomRemoteType.BitbucketServer: return (domain: string, path: string) => new BitbucketServerService(domain, path, true);
|
||||||
case CustomRemoteType.GitLab: return 'gitlab.com';
|
case CustomRemoteType.GitHub: return (domain: string, path: string) => new GitHubService(domain, path, true);
|
||||||
|
case CustomRemoteType.GitLab: return (domain: string, path: string) => new GitLabService(domain, path, true);
|
||||||
}
|
}
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
@@ -43,10 +45,10 @@ function onConfigurationChanged() {
|
|||||||
remotesCfg = cfg.remotes;
|
remotesCfg = cfg.remotes;
|
||||||
if (remotesCfg != null && remotesCfg.length > 0) {
|
if (remotesCfg != null && remotesCfg.length > 0) {
|
||||||
for (const svc of remotesCfg) {
|
for (const svc of remotesCfg) {
|
||||||
const key = getProviderKey(svc.type);
|
const provider = getCustomProvider(svc.type);
|
||||||
if (key === undefined) continue;
|
if (provider === undefined) continue;
|
||||||
|
|
||||||
providerMap.set(svc.domain.toLowerCase(), providerMap.get(key)!);
|
providerMap.set(svc.domain.toLowerCase(), provider);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,12 +4,12 @@ import { RemoteProvider } from './provider';
|
|||||||
|
|
||||||
export class GitHubService extends RemoteProvider {
|
export class GitHubService extends RemoteProvider {
|
||||||
|
|
||||||
constructor(public domain: string, public path: string) {
|
constructor(public domain: string, public path: string, public custom: boolean = false) {
|
||||||
super(domain, path);
|
super(domain, path);
|
||||||
}
|
}
|
||||||
|
|
||||||
get name() {
|
get name() {
|
||||||
return 'GitHub';
|
return this.formatName('GitHub');
|
||||||
}
|
}
|
||||||
|
|
||||||
protected getUrlForBranches(): string {
|
protected getUrlForBranches(): string {
|
||||||
|
|||||||
@@ -3,11 +3,11 @@ import { GitHubService } from './github';
|
|||||||
|
|
||||||
export class GitLabService extends GitHubService {
|
export class GitLabService extends GitHubService {
|
||||||
|
|
||||||
constructor(public domain: string, public path: string) {
|
constructor(public domain: string, public path: string, public custom: boolean = false) {
|
||||||
super(domain, path);
|
super(domain, path);
|
||||||
}
|
}
|
||||||
|
|
||||||
get name() {
|
get name() {
|
||||||
return 'GitLab';
|
return this.formatName('GitLab');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -26,7 +26,7 @@ export function getNameFromRemoteResource(resource: RemoteResource) {
|
|||||||
|
|
||||||
export abstract class RemoteProvider {
|
export abstract class RemoteProvider {
|
||||||
|
|
||||||
constructor(public domain: string, public path: string) { }
|
constructor(public domain: string, public path: string, public custom: boolean = false) { }
|
||||||
|
|
||||||
abstract get name(): string;
|
abstract get name(): string;
|
||||||
|
|
||||||
@@ -34,6 +34,15 @@ export abstract class RemoteProvider {
|
|||||||
return `https://${this.domain}/${this.path}`;
|
return `https://${this.domain}/${this.path}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected formatName(name: string) {
|
||||||
|
return `${name}${this.custom ? ` (${this.domain})` : ''}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected splitPath(): [string, string] {
|
||||||
|
const index = this.path.indexOf('/');
|
||||||
|
return [ this.path.substring(0, index), this.path.substring(index + 1) ];
|
||||||
|
}
|
||||||
|
|
||||||
protected abstract getUrlForBranches(): string;
|
protected abstract getUrlForBranches(): string;
|
||||||
protected abstract getUrlForBranch(branch: string): string;
|
protected abstract getUrlForBranch(branch: string): string;
|
||||||
protected abstract getUrlForCommit(sha: string): string;
|
protected abstract getUrlForCommit(sha: string): string;
|
||||||
|
|||||||
@@ -3,22 +3,27 @@ import { Iterables } from '../system';
|
|||||||
import { ExtensionContext, TreeItem, TreeItemCollapsibleState } from 'vscode';
|
import { ExtensionContext, TreeItem, TreeItemCollapsibleState } from 'vscode';
|
||||||
import { CommitNode } from './commitNode';
|
import { CommitNode } from './commitNode';
|
||||||
import { GlyphChars } from '../constants';
|
import { GlyphChars } from '../constants';
|
||||||
import { ExplorerNode, ResourceType } from './explorerNode';
|
import { ExplorerNode, ResourceType, ShowAllCommitsNode } from './explorerNode';
|
||||||
import { GitBranch, GitService, GitUri } from '../gitService';
|
import { GitBranch, GitService, GitUri } from '../gitService';
|
||||||
|
|
||||||
export class BranchHistoryNode extends ExplorerNode {
|
export class BranchHistoryNode extends ExplorerNode {
|
||||||
|
|
||||||
readonly resourceType: ResourceType = 'gitlens:branch-history';
|
readonly resourceType: ResourceType = 'gitlens:branch-history';
|
||||||
|
|
||||||
|
maxCount: number | undefined = undefined;
|
||||||
|
|
||||||
constructor(public readonly branch: GitBranch, uri: GitUri, private readonly template: string, protected readonly context: ExtensionContext, protected readonly git: GitService) {
|
constructor(public readonly branch: GitBranch, uri: GitUri, private readonly template: string, protected readonly context: ExtensionContext, protected readonly git: GitService) {
|
||||||
super(uri);
|
super(uri);
|
||||||
}
|
}
|
||||||
|
|
||||||
async getChildren(): Promise<ExplorerNode[]> {
|
async getChildren(): Promise<ExplorerNode[]> {
|
||||||
const log = await this.git.getLogForRepo(this.uri.repoPath!, this.branch.name, 0);
|
const log = await this.git.getLogForRepo(this.uri.repoPath!, this.branch.name, this.maxCount);
|
||||||
if (log === undefined) return [];
|
if (log === undefined) return [];
|
||||||
|
|
||||||
return [...Iterables.map(log.commits.values(), c => new CommitNode(c, this.template, this.context, this.git))];
|
const children = Iterables.map(log.commits.values(), c => new CommitNode(c, this.template, this.context, this.git));
|
||||||
|
if (!log.truncated) return [...children];
|
||||||
|
|
||||||
|
return [...children, new ShowAllCommitsNode(this, this.context)];
|
||||||
}
|
}
|
||||||
|
|
||||||
async getTreeItem(): Promise<TreeItem> {
|
async getTreeItem(): Promise<TreeItem> {
|
||||||
@@ -27,7 +32,7 @@ export class BranchHistoryNode extends ExplorerNode {
|
|||||||
name += ` ${GlyphChars.Space}${GlyphChars.ArrowLeftRight}${GlyphChars.Space} ${this.branch.tracking}`;
|
name += ` ${GlyphChars.Space}${GlyphChars.ArrowLeftRight}${GlyphChars.Space} ${this.branch.tracking}`;
|
||||||
}
|
}
|
||||||
const item = new TreeItem(`${this.branch!.current ? `${GlyphChars.Check} ${GlyphChars.Space}` : ''}${name}`, TreeItemCollapsibleState.Collapsed);
|
const item = new TreeItem(`${this.branch!.current ? `${GlyphChars.Check} ${GlyphChars.Space}` : ''}${name}`, TreeItemCollapsibleState.Collapsed);
|
||||||
item.contextValue = this.resourceType;
|
item.contextValue = this.branch.tracking ? `${this.resourceType}:remote` : this.resourceType;
|
||||||
|
|
||||||
item.iconPath = {
|
item.iconPath = {
|
||||||
dark: this.context.asAbsolutePath('images/dark/icon-branch.svg'),
|
dark: this.context.asAbsolutePath('images/dark/icon-branch.svg'),
|
||||||
|
|||||||
@@ -21,9 +21,13 @@ export class BranchesNode extends ExplorerNode {
|
|||||||
return [...Iterables.filterMap(branches, b => b.remote ? undefined : new BranchHistoryNode(b, this.uri, this.git.config.gitExplorer.commitFormat, this.context, this.git))];
|
return [...Iterables.filterMap(branches, b => b.remote ? undefined : new BranchHistoryNode(b, this.uri, this.git.config.gitExplorer.commitFormat, this.context, this.git))];
|
||||||
}
|
}
|
||||||
|
|
||||||
getTreeItem(): TreeItem {
|
async getTreeItem(): Promise<TreeItem> {
|
||||||
const item = new TreeItem(`Branches`, TreeItemCollapsibleState.Expanded);
|
const item = new TreeItem(`Branches`, TreeItemCollapsibleState.Expanded);
|
||||||
item.contextValue = this.resourceType;
|
|
||||||
|
const remotes = await this.git.getRemotes(this.uri.repoPath!);
|
||||||
|
item.contextValue = (remotes !== undefined && remotes.length > 0)
|
||||||
|
? `${this.resourceType}:remote`
|
||||||
|
: this.resourceType;
|
||||||
|
|
||||||
item.iconPath = {
|
item.iconPath = {
|
||||||
dark: this.context.asAbsolutePath('images/dark/icon-branch.svg'),
|
dark: this.context.asAbsolutePath('images/dark/icon-branch.svg'),
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
import { Command, Event, TreeItem, TreeItemCollapsibleState } from 'vscode';
|
import { Command, ExtensionContext, TreeItem, TreeItemCollapsibleState } from 'vscode';
|
||||||
|
import { GlyphChars } from '../constants';
|
||||||
import { GitUri } from '../gitService';
|
import { GitUri } from '../gitService';
|
||||||
|
import { RefreshNodeCommandArgs } from './gitExplorer';
|
||||||
|
|
||||||
export declare type ResourceType =
|
export declare type ResourceType =
|
||||||
'gitlens:branches' |
|
'gitlens:branches' |
|
||||||
@@ -10,6 +12,7 @@ export declare type ResourceType =
|
|||||||
'gitlens:file-history' |
|
'gitlens:file-history' |
|
||||||
'gitlens:history' |
|
'gitlens:history' |
|
||||||
'gitlens:message' |
|
'gitlens:message' |
|
||||||
|
'gitlens:pager' |
|
||||||
'gitlens:remote' |
|
'gitlens:remote' |
|
||||||
'gitlens:remotes' |
|
'gitlens:remotes' |
|
||||||
'gitlens:repository' |
|
'gitlens:repository' |
|
||||||
@@ -31,10 +34,6 @@ export abstract class ExplorerNode {
|
|||||||
getCommand(): Command | undefined {
|
getCommand(): Command | undefined {
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
onDidChangeTreeData?: Event<ExplorerNode>;
|
|
||||||
|
|
||||||
refresh?(): void;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export class MessageNode extends ExplorerNode {
|
export class MessageNode extends ExplorerNode {
|
||||||
@@ -54,4 +53,46 @@ export class MessageNode extends ExplorerNode {
|
|||||||
item.contextValue = this.resourceType;
|
item.contextValue = this.resourceType;
|
||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export class PagerNode extends ExplorerNode {
|
||||||
|
|
||||||
|
readonly resourceType: ResourceType = 'gitlens:pager';
|
||||||
|
args: RefreshNodeCommandArgs = {};
|
||||||
|
|
||||||
|
constructor(private message: string, private node: ExplorerNode, protected readonly context: ExtensionContext) {
|
||||||
|
super(new GitUri());
|
||||||
|
}
|
||||||
|
|
||||||
|
getChildren(): ExplorerNode[] | Promise<ExplorerNode[]> {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
getTreeItem(): TreeItem | Promise<TreeItem> {
|
||||||
|
const item = new TreeItem(this.message, TreeItemCollapsibleState.None);
|
||||||
|
item.contextValue = this.resourceType;
|
||||||
|
item.command = this.getCommand();
|
||||||
|
item.iconPath = {
|
||||||
|
dark: this.context.asAbsolutePath('images/dark/icon-sync.svg'),
|
||||||
|
light: this.context.asAbsolutePath('images/light/icon-sync.svg')
|
||||||
|
};
|
||||||
|
return item;
|
||||||
|
}
|
||||||
|
|
||||||
|
getCommand(): Command | undefined {
|
||||||
|
return {
|
||||||
|
title: 'Refresh',
|
||||||
|
command: 'gitlens.gitExplorer.refreshNode',
|
||||||
|
arguments: [this.node, this.args]
|
||||||
|
} as Command;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export class ShowAllCommitsNode extends PagerNode {
|
||||||
|
|
||||||
|
args: RefreshNodeCommandArgs = { maxCount: 0 };
|
||||||
|
|
||||||
|
constructor(node: ExplorerNode, context: ExtensionContext) {
|
||||||
|
super(`Show All Commits ${GlyphChars.Space}${GlyphChars.Dash}${GlyphChars.Space} this may take a while`, node, context);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -5,7 +5,7 @@ import { Commands, DiffWithPreviousCommandArgs, DiffWithWorkingCommandArgs, open
|
|||||||
import { UriComparer } from '../comparers';
|
import { UriComparer } from '../comparers';
|
||||||
import { ExtensionKey, IConfig } from '../configuration';
|
import { ExtensionKey, IConfig } from '../configuration';
|
||||||
import { CommandContext, setCommandContext } from '../constants';
|
import { CommandContext, setCommandContext } from '../constants';
|
||||||
import { CommitFileNode, CommitNode, ExplorerNode, HistoryNode, MessageNode, RepositoryNode, StashNode } from './explorerNodes';
|
import { BranchHistoryNode, CommitFileNode, CommitNode, ExplorerNode, HistoryNode, MessageNode, RepositoryNode, StashNode } from './explorerNodes';
|
||||||
import { GitService, GitUri, RepoChangedReasons } from '../gitService';
|
import { GitService, GitUri, RepoChangedReasons } from '../gitService';
|
||||||
|
|
||||||
export * from './explorerNodes';
|
export * from './explorerNodes';
|
||||||
@@ -23,6 +23,10 @@ export interface OpenFileRevisionCommandArgs {
|
|||||||
showOptions?: TextDocumentShowOptions;
|
showOptions?: TextDocumentShowOptions;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface RefreshNodeCommandArgs {
|
||||||
|
maxCount?: number;
|
||||||
|
}
|
||||||
|
|
||||||
export class GitExplorer implements TreeDataProvider<ExplorerNode> {
|
export class GitExplorer implements TreeDataProvider<ExplorerNode> {
|
||||||
|
|
||||||
private _config: IConfig;
|
private _config: IConfig;
|
||||||
@@ -38,6 +42,7 @@ export class GitExplorer implements TreeDataProvider<ExplorerNode> {
|
|||||||
commands.registerCommand('gitlens.gitExplorer.switchToHistoryView', () => this.switchTo(GitExplorerView.History), this);
|
commands.registerCommand('gitlens.gitExplorer.switchToHistoryView', () => this.switchTo(GitExplorerView.History), this);
|
||||||
commands.registerCommand('gitlens.gitExplorer.switchToRepositoryView', () => this.switchTo(GitExplorerView.Repository), this);
|
commands.registerCommand('gitlens.gitExplorer.switchToRepositoryView', () => this.switchTo(GitExplorerView.Repository), this);
|
||||||
commands.registerCommand('gitlens.gitExplorer.refresh', this.refresh, this);
|
commands.registerCommand('gitlens.gitExplorer.refresh', this.refresh, this);
|
||||||
|
commands.registerCommand('gitlens.gitExplorer.refreshNode', this.refreshNode, this);
|
||||||
commands.registerCommand('gitlens.gitExplorer.openChanges', this.openChanges, this);
|
commands.registerCommand('gitlens.gitExplorer.openChanges', this.openChanges, this);
|
||||||
commands.registerCommand('gitlens.gitExplorer.openChangesWithWorking', this.openChangesWithWorking, this);
|
commands.registerCommand('gitlens.gitExplorer.openChangesWithWorking', this.openChangesWithWorking, this);
|
||||||
commands.registerCommand('gitlens.gitExplorer.openFile', this.openFile, this);
|
commands.registerCommand('gitlens.gitExplorer.openFile', this.openFile, this);
|
||||||
@@ -133,6 +138,14 @@ export class GitExplorer implements TreeDataProvider<ExplorerNode> {
|
|||||||
this._onDidChangeTreeData.fire(node);
|
this._onDidChangeTreeData.fire(node);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
refreshNode(node: ExplorerNode, args: RefreshNodeCommandArgs) {
|
||||||
|
if (node instanceof BranchHistoryNode) {
|
||||||
|
node.maxCount = args.maxCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.refresh(node);
|
||||||
|
}
|
||||||
|
|
||||||
switchTo(view: GitExplorerView) {
|
switchTo(view: GitExplorerView) {
|
||||||
if (this._view === view) return;
|
if (this._view === view) return;
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
import { Event, EventEmitter, ExtensionContext, TreeItem, TreeItemCollapsibleState } from 'vscode';
|
import { ExtensionContext, TreeItem, TreeItemCollapsibleState } from 'vscode';
|
||||||
import { ExplorerNode, ResourceType } from './explorerNode';
|
import { ExplorerNode, ResourceType } from './explorerNode';
|
||||||
import { CommitFormatter, GitService, GitStashCommit, GitUri, ICommitFormatOptions } from '../gitService';
|
import { CommitFormatter, GitService, GitStashCommit, GitUri, ICommitFormatOptions } from '../gitService';
|
||||||
import { StashFileNode } from './stashFileNode';
|
import { StashFileNode } from './stashFileNode';
|
||||||
@@ -8,11 +8,6 @@ export class StashNode extends ExplorerNode {
|
|||||||
|
|
||||||
readonly resourceType: ResourceType = 'gitlens:stash';
|
readonly resourceType: ResourceType = 'gitlens:stash';
|
||||||
|
|
||||||
private _onDidChangeTreeData = new EventEmitter<ExplorerNode>();
|
|
||||||
public get onDidChangeTreeData(): Event<ExplorerNode> {
|
|
||||||
return this._onDidChangeTreeData.event;
|
|
||||||
}
|
|
||||||
|
|
||||||
constructor(public readonly commit: GitStashCommit, protected readonly context: ExtensionContext, protected readonly git: GitService) {
|
constructor(public readonly commit: GitStashCommit, protected readonly context: ExtensionContext, protected readonly git: GitService) {
|
||||||
super(new GitUri(commit.uri, commit));
|
super(new GitUri(commit.uri, commit));
|
||||||
}
|
}
|
||||||
@@ -29,8 +24,4 @@ export class StashNode extends ExplorerNode {
|
|||||||
item.contextValue = this.resourceType;
|
item.contextValue = this.resourceType;
|
||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
|
|
||||||
refresh() {
|
|
||||||
this._onDidChangeTreeData.fire();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user