mirror of
https://github.com/ckaczor/vscode-gitlens.git
synced 2026-02-12 11:08:34 -05:00
Compare commits
9 Commits
v5.0.0-bet
...
v5.0.0
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
11eacb27a1 | ||
|
|
543d39246f | ||
|
|
6837414f22 | ||
|
|
ea6fdbaaf2 | ||
|
|
ccc29e3dfc | ||
|
|
48814d4213 | ||
|
|
c3dd83cf3c | ||
|
|
77482f4930 | ||
|
|
503b2a3785 |
51
CHANGELOG.md
51
CHANGELOG.md
@@ -4,13 +4,13 @@ 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.2] - 2017-09-12
|
## [5.0.0] - 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
|
||||||
|
|
||||||
- `Repository View` - provides a full repository explorer
|
- `Repository View` - provides a full repository explorer
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
- `Repository Status` node — provides the status of the repository
|
- `Repository Status` node — provides the status of the repository
|
||||||
- Provides the name of the current branch, its upstream tracking branch (if available), and its upstream status (if available)
|
- Provides the name of the current branch, its upstream tracking branch (if available), and its upstream status (if available)
|
||||||
@@ -26,29 +26,30 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
|
|||||||
- Indicates which branch is the current branch and optionally shows the remote tracking branch
|
- Indicates which branch is the current branch and optionally shows the remote tracking branch
|
||||||
- Expand each branch to easily see its revision (commit) history
|
- Expand each branch to easily see its revision (commit) history
|
||||||
- Expand each revision (commit) to quickly see the set of files changed, complete with status indicators for adds, changes, renames, and deletes
|
- Expand each revision (commit) to quickly see the set of files changed, complete with status indicators for adds, changes, renames, and deletes
|
||||||
- Provides a context menu on each changed file with `Open Changes`, `Open Changes with Working Tree`, `Open File`, `Open Revision`, `Open File in Remote`, `Open Revision in Remote`, `Apply Changes`, and `Show Commit File Details` commands
|
- Provides a context menu on each changed file with `Open Changes`, `Open Changes with Working Tree`, `Open File`, `Open Revision`, `Open File in Remote`, `Open Revision in Remote`, `Apply Changes`, `Show File History`, and `Show Commit File Details` commands
|
||||||
- Provides a context menu on each revision (commit) with `Open Commit in Remote`, `Copy Commit ID to Clipboard`, `Copy Commit Message to Clipboard`, `Open Files`, `Open Revisions`, `Show Commit Details`, and `Refresh` commands
|
- Provides a context menu on each revision (commit) with `Open Commit in Remote`, `Open All Changes`, `Open All Changes with Working Tree`, `Open Files`, `Open Revisions`, `Copy Commit ID to Clipboard`, `Copy Commit Message to Clipboard`, `Show Commit Details`, and `Refresh` commands
|
||||||
- Provides a context menu on each branch with `Open Branch in Remote`, and `Refresh` commands
|
- Provides a context menu on each branch with `Open Branch in Remote`, and `Refresh` commands
|
||||||
- Provides a context menu with `Open Branches in Remote`, and `Refresh` commands
|
- Provides a context menu with `Open Branches in Remote`, and `Refresh` commands
|
||||||
|
|
||||||
- `Remotes` node — provides a list of remotes
|
- `Remotes` node — provides a list of remotes
|
||||||
|
- Indicates the direction of the remote (fetch, push, both), remote service (if applicable), and repository path
|
||||||
- Expand each remote to see its list of branches
|
- Expand each remote to see its list of branches
|
||||||
- Expand each branch to easily see its revision (commit) history
|
- Expand each branch to easily see its revision (commit) history
|
||||||
- Expand each revision (commit) to quickly see the set of files changed, complete with status indicators for adds, changes, renames, and deletes
|
- Expand each revision (commit) to quickly see the set of files changed, complete with status indicators for adds, changes, renames, and deletes
|
||||||
- Provides a context menu on each changed file with `Open Changes`, `Open Changes with Working Tree`, `Open File`, `Open Revision`, `Open File in Remote`, `Open Revision in Remote`, `Apply Changes`, and `Show Commit File Details` commands
|
- Provides a context menu on each changed file with `Open Changes`, `Open Changes with Working Tree`, `Open File`, `Open Revision`, `Open File in Remote`, `Open Revision in Remote`, `Apply Changes`, and `Show Commit File Details` commands
|
||||||
- Provides a context menu on each revision (commit) with `Open Commit in Remote`, `Copy Commit ID to Clipboard`, `Copy Commit Message to Clipboard`, `Open Files`, `Open Revisions`, `Show Commit Details`, and `Refresh` commands
|
- Provides a context menu on each revision (commit) with `Open Commit in Remote`, `Open All Changes`, `Open All Changes with Working Tree`, `Open Files`, `Open Revisions`, `Copy Commit ID to Clipboard`, `Copy Commit Message to Clipboard`,`Show Commit Details`, and `Refresh` commands
|
||||||
- Provides a context menu on each remote with `Open Branches in Remote`, `Open Repository in Remote`, and `Refresh` commands
|
- Provides a context menu on each remote with `Open Branches in Remote`, `Open Repository in Remote`, and `Refresh` commands
|
||||||
- Provides a context menu with a `Refresh` command
|
- Provides a context menu with a `Refresh` command
|
||||||
|
|
||||||
- `Stashes` node — provides a list of stashed changes
|
- `Stashes` node — provides a list of stashed changes
|
||||||
- Expand each stash to quickly see the set of files stashed, complete with status indicators for adds, changes, renames, and deletes
|
- Expand each stash to quickly see the set of files stashed, complete with status indicators for adds, changes, renames, and deletes
|
||||||
- Provides a context menu with `Stash Changes`, and `Refresh` commands
|
- Provides a context menu with `Stash Changes`, and `Refresh` commands
|
||||||
- Provides a context menu on each stash with `Apply Stashed Changes` (confirmation required), `Delete Stashed Changes` (confirmation required), `Copy Commit Message to Clipboard`, `Open Files`, `Open Revisions`, and `Refresh` commands
|
- Provides a context menu on each stash with `Apply Stashed Changes` (confirmation required), `Delete Stashed Changes` (confirmation required), `Open All Changes`, `Open All Changes with Working Tree`, `Open Files`, `Open Revisions`, `Copy Commit Message to Clipboard`, and `Refresh` commands
|
||||||
- Provides a context menu on each stashed file with `Open Changes`, `Open Changes with Working Tree`, `Open File`, `Open Revision`, `Open File in Remote`, `Apply Changes`, and `Show File History` commands
|
- Provides a context menu on each stashed file with `Apply Changes`, `Open Changes`, `Open Changes with Working Tree`, `Open File`, `Open Revision`, `Open File in Remote`, and `Show File History` commands
|
||||||
|
|
||||||
- `History View` - provides the revision history of the active file
|
- `History View` - provides the revision history of the active file
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
- Automatically updates to track the active editor
|
- Automatically updates to track the active editor
|
||||||
- Provides a context menu with `Open File`, `Open File in Remote`, and `Refresh` commands
|
- Provides a context menu with `Open File`, `Open File in Remote`, and `Refresh` commands
|
||||||
@@ -57,13 +58,19 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
|
|||||||
- Quickly switch between views using the `Switch to Repository View` or `Switch to History View` commands
|
- Quickly switch between views using the `Switch to Repository View` or `Switch to History View` commands
|
||||||
- Provides toolbar commands to `Search Commits`, `Switch to Repository View` or `Switch to History View`, and `Refresh`
|
- Provides toolbar commands to `Search Commits`, `Switch to Repository View` or `Switch to History View`, and `Refresh`
|
||||||
|
|
||||||
- Adds command-links to the `details` hover annotation
|
- Adds all-new interactivity to the hover annotations
|
||||||
- Clicking the commit id will run the `Show Commit Details` command (`gitlens.showQuickCommitDetails`)
|
|
||||||
- Adds command-links to the `changes` hover annotation
|

|
||||||
- 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`)
|
- Adds the following command-links to the `details` hover annotation
|
||||||
- Adds support for custom remote services - see [#120](https://github.com/eamodio/vscode-gitlens/issues/120)
|
- Clicking the commit id will run the `Show Commit Details` command (`gitlens.showQuickCommitDetails`)
|
||||||
- Adds support for the Bitbucket Server (previously called Stash) remote service - see [#120](https://github.com/eamodio/vscode-gitlens/issues/120)
|
- Adds the following command-links to the `changes` hover annotation
|
||||||
|
- 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`)
|
||||||
|
|
||||||
|
- Adds support for remote services with custom domains -- closes [#120](https://github.com/eamodio/vscode-gitlens/issues/120)
|
||||||
|
- Adds support for the Bitbucket Server (previously called Stash) remote service -- closes [#120](https://github.com/eamodio/vscode-gitlens/issues/120)
|
||||||
|
- Adds `gitlens.blame.ignoreWhitespace` setting to specify whether or not to ignore whitespace when comparing revisions during blame operations -- closes [#138](https://github.com/eamodio/vscode-gitlens/issues/138)
|
||||||
- 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
|
||||||
@@ -96,7 +103,6 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
|
|||||||
- Fixes an issue where double hover annotations could be shown on blank lines
|
- 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 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
|
- Fixes an issue where remotes are queried more than once on startup
|
||||||
|
|
||||||
@@ -159,9 +165,6 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
|
|||||||
## [4.3.0] - 2017-07-03
|
## [4.3.0] - 2017-07-03
|
||||||
## Added
|
## Added
|
||||||
- Adds `Git Stashes` custom view to the Explorer activity
|
- Adds `Git Stashes` custom view to the Explorer activity
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
- Shows all of the stashed changes in the repository
|
- Shows all of the stashed changes in the repository
|
||||||
- Provides toolbar buttons to `Stash Changes` and `Refresh`
|
- Provides toolbar buttons to `Stash Changes` and `Refresh`
|
||||||
- Provides a context menu with `Apply Stashed Changes` and `Delete Stashed Changes` commands - both require a confirmation
|
- Provides a context menu with `Apply Stashed Changes` and `Delete Stashed Changes` commands - both require a confirmation
|
||||||
@@ -224,7 +227,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
|
|||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
- Fixes excessive memory usage when parsing diffs
|
- Fixes excessive memory usage when parsing diffs
|
||||||
- Fixes extra newline in multiline commit messages
|
- Fixes extra newline in multi-line commit messages
|
||||||
- Fixes (again) [#33](https://github.com/eamodio/vscode-gitlens/issues/33) - Commit messages can causes markdown formatting in hovers
|
- Fixes (again) [#33](https://github.com/eamodio/vscode-gitlens/issues/33) - Commit messages can causes markdown formatting in hovers
|
||||||
|
|
||||||
## [4.0.1] - 2017-06-09
|
## [4.0.1] - 2017-06-09
|
||||||
@@ -308,7 +311,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
|
|||||||
### Added
|
### Added
|
||||||
- Improves performance
|
- Improves performance
|
||||||
- Reduces the number of git calls on known "untrackables"
|
- Reduces the number of git calls on known "untrackables"
|
||||||
- Caches many more git commands to reduce git command roundtrips and parsing
|
- Caches many more git commands to reduce git command round-trips and parsing
|
||||||
- Increases the debounce (delay) on cursor movement to reduce lag when navigating around a file
|
- Increases the debounce (delay) on cursor movement to reduce lag when navigating around a file
|
||||||
- Adds diff information (the line's previous version) into the active line hover when the current line is uncommitted
|
- Adds diff information (the line's previous version) into the active line hover when the current line is uncommitted
|
||||||
- Adds `gitlens.statusBar.alignment` settings to control the alignment of the status bar -- thanks to [PR #72](https://github.com/eamodio/vscode-gitlens/pull/72) by Zack Schuster ([@zackschuster](https://github.com/zackschuster))!
|
- Adds `gitlens.statusBar.alignment` settings to control the alignment of the status bar -- thanks to [PR #72](https://github.com/eamodio/vscode-gitlens/pull/72) by Zack Schuster ([@zackschuster](https://github.com/zackschuster))!
|
||||||
@@ -499,7 +502,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
|
|||||||
### Fixed
|
### Fixed
|
||||||
- Fixes issue with `gitlens.diffWithPrevious` command execution via code lens when the code lens was not at the document/file level
|
- Fixes issue with `gitlens.diffWithPrevious` command execution via code lens when the code lens was not at the document/file level
|
||||||
- Fixes issue where full shas were displayed on the file/blame history explorers
|
- Fixes issue where full shas were displayed on the file/blame history explorers
|
||||||
- Fixes [#30](https://github.com/eamodio/vscode-gitlens/issues/30) - Diff with Working Tree fails from repo/commit quickpick list if file was renamed (and the commit was before the rename)
|
- Fixes [#30](https://github.com/eamodio/vscode-gitlens/issues/30) - Diff with Working Tree fails from repo/commit quick pick list if file was renamed (and the commit was before the rename)
|
||||||
- Fixes various other quick pick menu command issues when a file was renamed
|
- Fixes various other quick pick menu command issues when a file was renamed
|
||||||
- Fixes various issues when caching is disabled
|
- Fixes various issues when caching is disabled
|
||||||
- Fixes issues with parsing commits history
|
- Fixes issues with parsing commits history
|
||||||
@@ -602,7 +605,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
|
|||||||
|
|
||||||
## [2.9.0]
|
## [2.9.0]
|
||||||
### Changed
|
### Changed
|
||||||
- To accomodate the realization that blame information is invalid when a file has unsaved changes, the following behavior changes have been made
|
- To accommodate the realization that blame information is invalid when a file has unsaved changes, the following behavior changes have been made
|
||||||
- Status bar blame information will hide
|
- Status bar blame information will hide
|
||||||
- Code lens change to a `Cannot determine...` message and become unclickable
|
- Code lens change to a `Cannot determine...` message and become unclickable
|
||||||
- Many menu choices and commands will hide
|
- Many menu choices and commands will hide
|
||||||
@@ -640,7 +643,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
|
|||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
- Fixes [#34](https://github.com/eamodio/vscode-gitlens/issues/34) - Open file should open the selected version of the file
|
- Fixes [#34](https://github.com/eamodio/vscode-gitlens/issues/34) - Open file should open the selected version of the file
|
||||||
- Fixes some issue where some editors opened by the quickpick would not be opened in preview tabs
|
- Fixes some issue where some editors opened by the quick pick would not be opened in preview tabs
|
||||||
- Fixes issue where copy to clipboard commands would fail if there was no active editor
|
- Fixes issue where copy to clipboard commands would fail if there was no active editor
|
||||||
- Fixes issue where active line annotations would show for opened versioned files
|
- Fixes issue where active line annotations would show for opened versioned files
|
||||||
- Fixes issue where code lens compare commands on opened versioned files would fail
|
- Fixes issue where code lens compare commands on opened versioned files would fail
|
||||||
|
|||||||
54
README.md
54
README.md
@@ -1,7 +1,7 @@
|
|||||||
[](https://marketplace.visualstudio.com/items?itemName=eamodio.gitlens)
|
[](https://marketplace.visualstudio.com/items?itemName=eamodio.gitlens)
|
||||||
[](https://marketplace.visualstudio.com/items?itemName=eamodio.gitlens)
|
[](https://marketplace.visualstudio.com/items?itemName=eamodio.gitlens)
|
||||||
[](https://marketplace.visualstudio.com/items?itemName=eamodio.gitlens)
|
[](https://marketplace.visualstudio.com/items?itemName=eamodio.gitlens)
|
||||||
[](https://join.slack.com/t/vscode-gitlens/shared_invite/MjIxOTgxNDE3NzM0LTE1MDE2Nzk1MTgtMjkwMmZjMzcxNQ)
|
[](https://join.slack.com/t/vscode-gitlens/shared_invite/MjIxOTgxNDE3NzM0LTE1MDE2Nzk1MTgtMjkwMmZjMzcxNQ)
|
||||||
|
|
||||||
# GitLens
|
# GitLens
|
||||||
|
|
||||||
@@ -10,7 +10,7 @@ GitLens **supercharges** the built-in Visual Studio Code Git capabilities. It he
|
|||||||
GitLens provides an unobtrusive blame annotation at the end of the current line, a status bar item showing the commit information (author and date, by default) of the current line, code lens showing the most recent commit and # of authors of the file and/or code block, and many commands for exploring commits and histories, comparing and navigating revisions, stash access, repository status, and more. GitLens is also [highly customizable](#extension-settings) to meet your specific needs — find code lens intrusive or the current line blame annotation distracting — no problem, it is easy to [turn them off or change how they behave](#extension-settings).
|
GitLens provides an unobtrusive blame annotation at the end of the current line, a status bar item showing the commit information (author and date, by default) of the current line, code lens showing the most recent commit and # of authors of the file and/or code block, and many commands for exploring commits and histories, comparing and navigating revisions, stash access, repository status, and more. GitLens is also [highly customizable](#extension-settings) to meet your specific needs — find code lens intrusive or the current line blame annotation distracting — no problem, it is easy to [turn them off or change how they behave](#extension-settings).
|
||||||
|
|
||||||
### Preview — featuring blame annotations, code lens, status bar details, quick pick menus for navigation and exploration, compare with previous, and more
|
### Preview — featuring blame annotations, code lens, status bar details, quick pick menus for navigation and exploration, compare with previous, and more
|
||||||

|

|
||||||
|
|
||||||
## Features
|
## Features
|
||||||
|
|
||||||
@@ -18,7 +18,7 @@ GitLens provides an unobtrusive blame annotation at the end of the current line,
|
|||||||
|
|
||||||
- Adds an unobtrusive, highly [customizable](#line-blame-annotation-settings) and [themeable](#theme-settings), **Git blame annotation** to the end of the current line ([optional](#line-blame-annotation-settings), on by default)
|
- Adds an unobtrusive, highly [customizable](#line-blame-annotation-settings) and [themeable](#theme-settings), **Git blame annotation** to the end of the current line ([optional](#line-blame-annotation-settings), on by default)
|
||||||
|
|
||||||

|

|
||||||
- Contains the author, date, and message of the line's most recent commit, by [default](#line-blame-annotation-settings)
|
- Contains the author, date, and message of the line's most recent commit, by [default](#line-blame-annotation-settings)
|
||||||
- Adds a `details` hover annotation to the current line annotation, which provides more commit details ([optional](#line-blame-annotation-settings), on by default)
|
- Adds a `details` hover annotation to the current line annotation, which provides more commit details ([optional](#line-blame-annotation-settings), on by default)
|
||||||
- Clicking the commit id will run the `Show Commit Details` command (`gitlens.showQuickCommitDetails`)
|
- Clicking the commit id will run the `Show Commit Details` command (`gitlens.showQuickCommitDetails`)
|
||||||
@@ -26,11 +26,11 @@ GitLens provides an unobtrusive blame annotation at the end of the current line,
|
|||||||
- 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 on-demand, beautiful, highly [customizable](#file-blame-annotation-settings) and [themeable](#theme-settings), **Git blame annotations** of the whole file
|
- Adds on-demand, beautiful, highly [customizable](#file-blame-annotation-settings) and [themeable](#theme-settings), **Git blame annotations** of the whole file
|
||||||
|
|
||||||

|

|
||||||
- Choose between `gutter` (default) and `hover` [annotation styles](#file-blame-annotation-settings)
|
- Choose between `gutter` (default) and `hover` [annotation styles](#file-blame-annotation-settings)
|
||||||
- Contains the commit message and date, by [default](#file-blame-annotation-settings)
|
- Contains the commit message and date, by [default](#file-blame-annotation-settings)
|
||||||
- Adds a `details` hover annotation to the line's annotation, which provides more commit details ([optional](#file-blame-annotation-settings), on by default)
|
- Adds a `details` hover annotation to the line's annotation, which provides more commit details ([optional](#file-blame-annotation-settings), on by default)
|
||||||
@@ -41,7 +41,7 @@ GitLens provides an unobtrusive blame annotation at the end of the current line,
|
|||||||
|
|
||||||
- Adds [customizable](#status-bar-settings) **blame information** about the current line to the **status bar** ([optional](#status-bar-settings), on by default)
|
- Adds [customizable](#status-bar-settings) **blame information** about the current line to the **status bar** ([optional](#status-bar-settings), on by default)
|
||||||
|
|
||||||

|

|
||||||
- Contains the commit author and date, by [default](#status-bar-settings)
|
- Contains the commit author and date, by [default](#status-bar-settings)
|
||||||
- Clicking the status bar item will, by [default](#status-bar-settings), show a **commit details quick pick menu** with commands for comparing, navigating and exploring commits, and more
|
- Clicking the status bar item will, by [default](#status-bar-settings), show a **commit details quick pick menu** with commands for comparing, navigating and exploring commits, and more
|
||||||
- Provides [customizable](#status-bar-settings) click behavior — choose between one of the following
|
- Provides [customizable](#status-bar-settings) click behavior — choose between one of the following
|
||||||
@@ -77,7 +77,7 @@ GitLens provides an unobtrusive blame annotation at the end of the current line,
|
|||||||
|
|
||||||
- Adds **code lens** to the top of the file and on code blocks ([optional](#code-lens-settings), on by default)
|
- Adds **code lens** to the top of the file and on code blocks ([optional](#code-lens-settings), on by default)
|
||||||
|
|
||||||

|

|
||||||
- **Recent Change** — author and date of the most recent commit for the file or code block
|
- **Recent Change** — author and date of the most recent commit for the file or code block
|
||||||
- Clicking the code lens will, by [default](#code-lens-settings), show a **commit file details quick pick menu** with commands for comparing, navigating and exploring commits, and more
|
- Clicking the code lens will, by [default](#code-lens-settings), show a **commit file details quick pick menu** with commands for comparing, navigating and exploring commits, and more
|
||||||
- **Authors** — number of authors of the file or code block and the most prominent author (if there is more than one)
|
- **Authors** — number of authors of the file or code block and the most prominent author (if there is more than one)
|
||||||
@@ -122,7 +122,7 @@ GitLens provides an unobtrusive blame annotation at the end of the current line,
|
|||||||
|
|
||||||
- `Repository View` - provides a full repository explorer
|
- `Repository View` - provides a full repository explorer
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
- `Repository Status` node — provides the status of the repository
|
- `Repository Status` node — provides the status of the repository
|
||||||
- Provides the name of the current branch, its upstream tracking branch (if available), and its upstream status (if available)
|
- Provides the name of the current branch, its upstream tracking branch (if available), and its upstream status (if available)
|
||||||
@@ -139,28 +139,30 @@ GitLens provides an unobtrusive blame annotation at the end of the current line,
|
|||||||
- Expand each branch to easily see its revision (commit) history
|
- Expand each branch to easily see its revision (commit) history
|
||||||
- Expand each revision (commit) to quickly see the set of files changed, complete with status indicators for adds, changes, renames, and deletes
|
- Expand each revision (commit) to quickly see the set of files changed, complete with status indicators for adds, changes, renames, and deletes
|
||||||
- Provides a context menu on each changed file with `Open Changes`, `Open Changes with Working Tree`, `Open File`, `Open Revision`, `Open File in Remote`, `Open Revision in Remote`, `Apply Changes`, and `Show Commit File Details` commands
|
- Provides a context menu on each changed file with `Open Changes`, `Open Changes with Working Tree`, `Open File`, `Open Revision`, `Open File in Remote`, `Open Revision in Remote`, `Apply Changes`, and `Show Commit File Details` commands
|
||||||
- Provides a context menu on each revision (commit) with `Open Commit in Remote`, `Copy Commit ID to Clipboard`, `Copy Commit Message to Clipboard`, `Open Files`, `Open Revisions`, `Show Commit Details`, and `Refresh` commands
|
|
||||||
|
- Provides a context menu on each revision (commit) with `Open Commit in Remote`, `Open All Changes`, `Open All Changes with Working Tree`, `Open Files`, `Open Revisions`, `Copy Commit ID to Clipboard`, `Copy Commit Message to Clipboard`, `Show Commit Details`, and `Refresh` commands
|
||||||
- Provides a context menu on each branch with `Open Branch in Remote`, and `Refresh` commands
|
- Provides a context menu on each branch with `Open Branch in Remote`, and `Refresh` commands
|
||||||
- Provides a context menu with `Open Branches in Remote`, and `Refresh` commands
|
- Provides a context menu with `Open Branches in Remote`, and `Refresh` commands
|
||||||
|
|
||||||
- `Remotes` node — provides a list of remotes
|
- `Remotes` node — provides a list of remotes
|
||||||
|
- Indicates the direction of the remote (fetch, push, both), remote service (if applicable), and repository path
|
||||||
- Expand each remote to see its list of branches
|
- Expand each remote to see its list of branches
|
||||||
- Expand each branch to easily see its revision (commit) history
|
- Expand each branch to easily see its revision (commit) history
|
||||||
- Expand each revision (commit) to quickly see the set of files changed, complete with status indicators for adds, changes, renames, and deletes
|
- Expand each revision (commit) to quickly see the set of files changed, complete with status indicators for adds, changes, renames, and deletes
|
||||||
- Provides a context menu on each changed file with `Open Changes`, `Open Changes with Working Tree`, `Open File`, `Open Revision`, `Open File in Remote`, `Open Revision in Remote`, `Apply Changes`, and `Show Commit File Details` commands
|
- Provides a context menu on each changed file with `Open Changes`, `Open Changes with Working Tree`, `Open File`, `Open Revision`, `Open File in Remote`, `Open Revision in Remote`, `Apply Changes`, `Show File History`, and `Show Commit File Details` commands
|
||||||
- Provides a context menu on each revision (commit) with `Open Commit in Remote`, `Copy Commit ID to Clipboard`, `Copy Commit Message to Clipboard`, `Open Files`, `Open Revisions`, `Show Commit Details`, and `Refresh` commands
|
- Provides a context menu on each revision (commit) with `Open Commit in Remote`, `Open All Changes`, `Open All Changes with Working Tree`, `Open Files`, `Open Revisions`, `Copy Commit ID to Clipboard`, `Copy Commit Message to Clipboard`,`Show Commit Details`, and `Refresh` commands
|
||||||
- Provides a context menu on each remote with `Open Branches in Remote`, `Open Repository in Remote`, and `Refresh` commands
|
- Provides a context menu on each remote with `Open Branches in Remote`, `Open Repository in Remote`, and `Refresh` commands
|
||||||
- Provides a context menu with a `Refresh` command
|
- Provides a context menu with a `Refresh` command
|
||||||
|
|
||||||
- `Stashes` node — provides a list of stashed changes
|
- `Stashes` node — provides a list of stashed changes
|
||||||
- Expand each stash to quickly see the set of files stashed, complete with status indicators for adds, changes, renames, and deletes
|
- Expand each stash to quickly see the set of files stashed, complete with status indicators for adds, changes, renames, and deletes
|
||||||
- Provides a context menu with `Stash Changes`, and `Refresh` commands
|
- Provides a context menu with `Stash Changes`, and `Refresh` commands
|
||||||
- Provides a context menu on each stash with `Apply Stashed Changes` (confirmation required), `Delete Stashed Changes` (confirmation required), `Copy Commit Message to Clipboard`, `Open Files`, `Open Revisions`, and `Refresh` commands
|
- Provides a context menu on each stash with `Apply Stashed Changes` (confirmation required), `Delete Stashed Changes` (confirmation required), `Open All Changes`, `Open All Changes with Working Tree`, `Open Files`, `Open Revisions`, `Copy Commit Message to Clipboard`, and `Refresh` commands
|
||||||
- Provides a context menu on each stashed file with `Open Changes`, `Open Changes with Working Tree`, `Open File`, `Open Revision`, `Open File in Remote`, `Apply Changes`, and `Show File History` commands
|
- Provides a context menu on each stashed file with `Apply Changes`, `Open Changes`, `Open Changes with Working Tree`, `Open File`, `Open Revision`, `Open File in Remote`, and `Show File History` commands
|
||||||
|
|
||||||
- `History View` - provides the revision history of the active file
|
- `History View` - provides the revision history of the active file
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
- Automatically updates to track the active editor
|
- Automatically updates to track the active editor
|
||||||
- Provides a context menu with `Open File`, `Open File in Remote`, and `Refresh` commands
|
- Provides a context menu with `Open File`, `Open File in Remote`, and `Refresh` commands
|
||||||
@@ -172,7 +174,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**
|
- Also supports [remote services with custom domains](#custom-remotes-settings), such as **BitBucket, Bitbucket Server (previously called Stash), GitHub, GitHub Enterprise, 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
|
||||||
@@ -181,7 +183,7 @@ GitLens provides an unobtrusive blame annotation at the end of the current line,
|
|||||||
|
|
||||||
- Adds a `Show Current Branch History` command (`gitlens.showQuickRepoHistory`) with a shortcut of `shift+alt+h` to show a paged **branch history quick pick menu** of the current branch for exploring its commit history
|
- Adds a `Show Current Branch History` command (`gitlens.showQuickRepoHistory`) with a shortcut of `shift+alt+h` to show a paged **branch history quick pick menu** of the current branch for exploring its commit history
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
- Provides entries to `Show Commit Search` and `Open Branch in <remote-service>` when available
|
- Provides entries to `Show Commit Search` and `Open Branch in <remote-service>` when available
|
||||||
- Navigate back to the previous quick pick menu via `alt+left arrow`, if available
|
- Navigate back to the previous quick pick menu via `alt+left arrow`, if available
|
||||||
@@ -192,7 +194,7 @@ GitLens provides an unobtrusive blame annotation at the end of the current line,
|
|||||||
|
|
||||||
- Adds a `Show File History` command (`gitlens.showQuickFileHistory`) to show a paged **file history quick pick menu** of the active file for exploring its commit history
|
- Adds a `Show File History` command (`gitlens.showQuickFileHistory`) to show a paged **file history quick pick menu** of the active file for exploring its commit history
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
- Provides entries to `Show Branch History` and `Open File in <remote-service>` when available
|
- Provides entries to `Show Branch History` and `Open File in <remote-service>` when available
|
||||||
- Navigate back to the previous quick pick menu via `alt+left arrow`, if available
|
- Navigate back to the previous quick pick menu via `alt+left arrow`, if available
|
||||||
@@ -200,7 +202,7 @@ GitLens provides an unobtrusive blame annotation at the end of the current line,
|
|||||||
|
|
||||||
- Adds a `Show Commit Details` command (`gitlens.showQuickCommitDetails`) to show a **commit details quick pick menu** of the most recent commit of the active file
|
- Adds a `Show Commit Details` command (`gitlens.showQuickCommitDetails`) to show a **commit details quick pick menu** of the most recent commit of the active file
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
- Quickly see the set of files changed in the commit, complete with status indicators for adds, changes, renames, and deletes
|
- Quickly see the set of files changed in the commit, complete with status indicators for adds, changes, renames, and deletes
|
||||||
- Provides entries to `Copy to Clipboard`, `Directory Compare`, `Open Changed Files`, `Open File in <remote-service>` when available, and more
|
- Provides entries to `Copy to Clipboard`, `Directory Compare`, `Open Changed Files`, `Open File in <remote-service>` when available, and more
|
||||||
@@ -210,7 +212,7 @@ GitLens provides an unobtrusive blame annotation at the end of the current line,
|
|||||||
|
|
||||||
- Adds a `Show Commit File Details` command (`gitlens.showQuickCommitFileDetails`) with a shortcut of `alt+c` to show a **file commit details quick pick menu** of the most recent commit of the active file
|
- Adds a `Show Commit File Details` command (`gitlens.showQuickCommitFileDetails`) with a shortcut of `alt+c` to show a **file commit details quick pick menu** of the most recent commit of the active file
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
- Provides entries to `Show Commit Details`, `Show File History`, `Compare File with...`, `Copy to Clipboard`, `Open File`, `Open File in <remote-service>` when available, and more
|
- Provides entries to `Show Commit Details`, `Show File History`, `Compare File with...`, `Copy to Clipboard`, `Open File`, `Open File in <remote-service>` when available, and more
|
||||||
- Navigate back to the previous quick pick menu via `alt+left arrow`, if available
|
- Navigate back to the previous quick pick menu via `alt+left arrow`, if available
|
||||||
@@ -218,7 +220,7 @@ GitLens provides an unobtrusive blame annotation at the end of the current line,
|
|||||||
|
|
||||||
- Adds a `Show Repository Status` command (`gitlens.showQuickRepoStatus`) with a shortcut of `alt+s` to show a **repository status quick pick menu** for visualizing the current repository status
|
- Adds a `Show Repository Status` command (`gitlens.showQuickRepoStatus`) with a shortcut of `alt+s` to show a **repository status quick pick menu** for visualizing the current repository status
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
- Quickly see upstream status (if an Git upstream is configured) — complete with ahead and behind information
|
- Quickly see upstream status (if an Git upstream is configured) — complete with ahead and behind information
|
||||||
- If you are ahead of the upstream, an entry will be shown with the number of commits ahead. Choosing it will show a limited **branch history quick pick menu** containing just the commits ahead of the upstream
|
- If you are ahead of the upstream, an entry will be shown with the number of commits ahead. Choosing it will show a limited **branch history quick pick menu** containing just the commits ahead of the upstream
|
||||||
@@ -230,14 +232,14 @@ GitLens provides an unobtrusive blame annotation at the end of the current line,
|
|||||||
|
|
||||||
- Adds a `Show Stashed Changes` command (`gitlens.showQuickStashList`) to show a **stashed changes quick pick menu** for exploring your repository stash history
|
- Adds a `Show Stashed Changes` command (`gitlens.showQuickStashList`) to show a **stashed changes quick pick menu** for exploring your repository stash history
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
- Provides entries to `Stash Changes`
|
- Provides entries to `Stash Changes`
|
||||||
- Navigate back to the previous quick pick menu via `alt+left arrow`, if available
|
- Navigate back to the previous quick pick menu via `alt+left arrow`, if available
|
||||||
|
|
||||||
- Choosing a stash entry shows a **stash details quick pick menu** which is very similar to the **commit details quick pick menu** above
|
- Choosing a stash entry shows a **stash details quick pick menu** which is very similar to the **commit details quick pick menu** above
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
- Quickly see the set of files changed in the stash, complete with status indicators for adds, changes, renames, and deletes
|
- Quickly see the set of files changed in the stash, complete with status indicators for adds, changes, renames, and deletes
|
||||||
- Provides entries to `Copy Message to Clipboard`, `Directory Compare`, and `Open Changed Files`
|
- Provides entries to `Copy Message to Clipboard`, `Directory Compare`, and `Open Changed Files`
|
||||||
@@ -285,7 +287,11 @@ GitLens is highly customizable and provides many configuration settings to allow
|
|||||||
|`gitlens.insiders`|Opts into the insiders channel -- provides access to upcoming features
|
|`gitlens.insiders`|Opts into the insiders channel -- provides access to upcoming features
|
||||||
|`gitlens.outputLevel`|Specifies how much (if any) output will be sent to the GitLens output channel
|
|`gitlens.outputLevel`|Specifies how much (if any) output will be sent to the GitLens output channel
|
||||||
|
|
||||||
### Blame Annotation Settings
|
### Blame Settings
|
||||||
|
|
||||||
|
|Name | Description
|
||||||
|
|-----|------------
|
||||||
|
|`gitlens.blame.ignoreWhitespace`|Specifies whether or not to ignore whitespace when comparing revisions during blame operations
|
||||||
|
|
||||||
#### File Blame Annotation Settings
|
#### File Blame Annotation Settings
|
||||||
|
|
||||||
@@ -355,7 +361,7 @@ GitLens is highly customizable and provides many configuration settings to allow
|
|||||||
|
|
||||||
|Name | Description
|
|Name | Description
|
||||||
|-----|------------
|
|-----|------------
|
||||||
|`gitlens.remotes`|Specifies the custom remote services (code-hosting)"
|
|`gitlens.remotes`|Specifies any custom domains for remote (code-hosting) services<br />Example: ```"gitlens.remotes": [{ "domain": "git.corporate-url.com", "type": "GitHub" }]```
|
||||||
|
|
||||||
### Status Bar Settings
|
### Status Bar Settings
|
||||||
|
|
||||||
|
|||||||
4
images/dark/icon-unfold.svg
Normal file
4
images/dark/icon-unfold.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.5,11l2.5,2.5c0,0.55 -0.45,1 -1,1l-4,0l0,-1l3.5,0l-2,-2l-7,0l-2,2l3.5,0l0,1l-4,0c-0.55,0 -1,-0.45 -1,-1l2.5,-2.5l-2.5,-2.5c0,-0.55 0.45,-1 1,-1l4,0l0,1l-3.5,0l2,2l7,0l2,-2l-3.5,0l0,-1l4,0c0.55,0 1,0.45 1,1l-2.5,2.5l0,0zm-5.5,-1.5l2,0l0,-3l2,0l-3,-3l-3,3l2,0l0,3l0,0zm2,3l-2,0l0,3l-2,0l3,3l3,-3l-2,0l0,-3l0,0z" />
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 467 B |
4
images/light/icon-unfold.svg
Normal file
4
images/light/icon-unfold.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.5,11l2.5,2.5c0,0.55 -0.45,1 -1,1l-4,0l0,-1l3.5,0l-2,-2l-7,0l-2,2l3.5,0l0,1l-4,0c-0.55,0 -1,-0.45 -1,-1l2.5,-2.5l-2.5,-2.5c0,-0.55 0.45,-1 1,-1l4,0l0,1l-3.5,0l2,2l7,0l2,-2l-3.5,0l0,-1l4,0c0.55,0 1,0.45 1,1l-2.5,2.5l0,0zm-5.5,-1.5l2,0l0,-3l2,0l-3,-3l-3,3l2,0l0,3l0,0zm2,3l-2,0l0,3l-2,0l3,3l3,-3l-2,0l0,-3l0,0z" />
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 467 B |
Binary file not shown.
|
Before Width: | Height: | Size: 23 KiB |
2
package-lock.json
generated
2
package-lock.json
generated
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "gitlens",
|
"name": "gitlens",
|
||||||
"version": "5.0.0-beta.2",
|
"version": "5.0.0",
|
||||||
"lockfileVersion": 1,
|
"lockfileVersion": 1,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
|||||||
173
package.json
173
package.json
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "gitlens",
|
"name": "gitlens",
|
||||||
"version": "5.0.0-beta.2",
|
"version": "5.0.0",
|
||||||
"author": {
|
"author": {
|
||||||
"name": "Eric Amodio",
|
"name": "Eric Amodio",
|
||||||
"email": "eamodio@gmail.com"
|
"email": "eamodio@gmail.com"
|
||||||
@@ -172,6 +172,11 @@
|
|||||||
"default": false,
|
"default": false,
|
||||||
"description": "Specifies whether or not to trigger hover annotations over the whole line"
|
"description": "Specifies whether or not to trigger hover annotations over the whole line"
|
||||||
},
|
},
|
||||||
|
"gitlens.blame.ignoreWhitespace": {
|
||||||
|
"type": "boolean",
|
||||||
|
"default": false,
|
||||||
|
"description": "Specifies whether or not to ignore whitespace when comparing revisions during blame operations"
|
||||||
|
},
|
||||||
"gitlens.blame.file.annotationType": {
|
"gitlens.blame.file.annotationType": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"default": "gutter",
|
"default": "gutter",
|
||||||
@@ -474,7 +479,7 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"uniqueItems": true,
|
"uniqueItems": true,
|
||||||
"description": "Specifies the custom remote services (code-hosting)"
|
"description": "Specifies any custom domains for remote (code-hosting) services"
|
||||||
},
|
},
|
||||||
"gitlens.statusBar.enabled": {
|
"gitlens.statusBar.enabled": {
|
||||||
"type": "boolean",
|
"type": "boolean",
|
||||||
@@ -1094,6 +1099,16 @@
|
|||||||
"title": "Open Files",
|
"title": "Open Files",
|
||||||
"category": "GitLens"
|
"category": "GitLens"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"command": "gitlens.gitExplorer.openChangedFileChanges",
|
||||||
|
"title": "Open All Changes",
|
||||||
|
"category": "GitLens"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"command": "gitlens.gitExplorer.openChangedFileChangesWithWorking",
|
||||||
|
"title": "Open All Changes with Working Tree",
|
||||||
|
"category": "GitLens"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"command": "gitlens.gitExplorer.openChangedFileRevisions",
|
"command": "gitlens.gitExplorer.openChangedFileRevisions",
|
||||||
"title": "Open Revisions",
|
"title": "Open Revisions",
|
||||||
@@ -1299,6 +1314,14 @@
|
|||||||
"command": "gitlens.gitExplorer.openChangedFiles",
|
"command": "gitlens.gitExplorer.openChangedFiles",
|
||||||
"when": "false"
|
"when": "false"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"command": "gitlens.gitExplorer.openChangedFileChanges",
|
||||||
|
"when": "false"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"command": "gitlens.gitExplorer.openChangedFileChangesWithWorking",
|
||||||
|
"when": "false"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"command": "gitlens.gitExplorer.openChangedFileRevisions",
|
"command": "gitlens.gitExplorer.openChangedFileRevisions",
|
||||||
"when": "false"
|
"when": "false"
|
||||||
@@ -1504,204 +1527,224 @@
|
|||||||
"view/title": [
|
"view/title": [
|
||||||
{
|
{
|
||||||
"command": "gitlens.showCommitSearch",
|
"command": "gitlens.showCommitSearch",
|
||||||
"when": "gitlens:enabled && view == gitlens.gitExplorer",
|
"when": "view == gitlens.gitExplorer",
|
||||||
"group": "navigation@1"
|
"group": "navigation@1"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"command": "gitlens.gitExplorer.switchToHistoryView",
|
"command": "gitlens.gitExplorer.switchToHistoryView",
|
||||||
"when": "gitlens:enabled && view == gitlens.gitExplorer && gitlens:gitExplorer:view == repository",
|
"when": "view == gitlens.gitExplorer && gitlens:gitExplorer:view == repository",
|
||||||
"group": "navigation@2"
|
"group": "navigation@2"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"command": "gitlens.gitExplorer.switchToRepositoryView",
|
"command": "gitlens.gitExplorer.switchToRepositoryView",
|
||||||
"when": "gitlens:enabled && view == gitlens.gitExplorer && gitlens:gitExplorer:view == history",
|
"when": "view == gitlens.gitExplorer && gitlens:gitExplorer:view == history",
|
||||||
"group": "navigation@3"
|
"group": "navigation@3"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"command": "gitlens.gitExplorer.refresh",
|
"command": "gitlens.gitExplorer.refresh",
|
||||||
"when": "gitlens:enabled && view == gitlens.gitExplorer",
|
"when": "view == gitlens.gitExplorer",
|
||||||
"group": "navigation@4"
|
"group": "navigation@4"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"view/item/context": [
|
"view/item/context": [
|
||||||
{
|
{
|
||||||
"command": "gitlens.openBranchesInRemote",
|
"command": "gitlens.openBranchesInRemote",
|
||||||
"when": "gitlens:enabled && gitlens:hasRemotes && view == gitlens.gitExplorer && viewItem == gitlens:branches:remote",
|
"when": "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:remote",
|
"when": "view == gitlens.gitExplorer && viewItem == gitlens:branch-history:remote",
|
||||||
"group": "1_gitlens@1"
|
"group": "1_gitlens@1"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"command": "gitlens.openCommitInRemote",
|
"command": "gitlens.openCommitInRemote",
|
||||||
"when": "gitlens:enabled && gitlens:hasRemotes && view == gitlens.gitExplorer && viewItem == gitlens:commit",
|
"when": "gitlens:hasRemotes && view == gitlens.gitExplorer && viewItem == gitlens:commit",
|
||||||
"group": "1_gitlens@1"
|
"group": "1_gitlens@1"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"command": "gitlens.copyShaToClipboard",
|
"command": "gitlens.gitExplorer.openChangedFileChanges",
|
||||||
"when": "gitlens:enabled && view == gitlens.gitExplorer && viewItem == gitlens:commit",
|
"when": "view == gitlens.gitExplorer && viewItem == gitlens:commit",
|
||||||
"group": "2_gitlens@1"
|
"group": "2_gitlens@1"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"command": "gitlens.copyMessageToClipboard",
|
"command": "gitlens.gitExplorer.openChangedFileChangesWithWorking",
|
||||||
"when": "gitlens:enabled && view == gitlens.gitExplorer && viewItem == gitlens:commit",
|
"when": "view == gitlens.gitExplorer && viewItem == gitlens:commit",
|
||||||
"group": "2_gitlens@2"
|
"group": "2_gitlens@1"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"command": "gitlens.gitExplorer.openChangedFiles",
|
"command": "gitlens.gitExplorer.openChangedFiles",
|
||||||
"when": "gitlens:enabled && view == gitlens.gitExplorer && viewItem == gitlens:commit",
|
"when": "view == gitlens.gitExplorer && viewItem == gitlens:commit",
|
||||||
"group": "3_gitlens@1"
|
"group": "3_gitlens@1"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"command": "gitlens.gitExplorer.openChangedFileRevisions",
|
"command": "gitlens.gitExplorer.openChangedFileRevisions",
|
||||||
"when": "gitlens:enabled && view == gitlens.gitExplorer && viewItem == gitlens:commit",
|
"when": "view == gitlens.gitExplorer && viewItem == gitlens:commit",
|
||||||
"group": "3_gitlens@2"
|
"group": "3_gitlens@2"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"command": "gitlens.showQuickCommitDetails",
|
"command": "gitlens.copyShaToClipboard",
|
||||||
"when": "gitlens:enabled && view == gitlens.gitExplorer && viewItem == gitlens:commit",
|
"when": "view == gitlens.gitExplorer && viewItem == gitlens:commit",
|
||||||
"group": "4_gitlens@1"
|
"group": "4_gitlens@1"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"command": "gitlens.copyMessageToClipboard",
|
||||||
|
"when": "view == gitlens.gitExplorer && viewItem == gitlens:commit",
|
||||||
|
"group": "4_gitlens@2"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"command": "gitlens.showQuickCommitDetails",
|
||||||
|
"when": "view == gitlens.gitExplorer && viewItem == gitlens:commit",
|
||||||
|
"group": "5_gitlens@1"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"command": "gitlens.gitExplorer.openChanges",
|
"command": "gitlens.gitExplorer.openChanges",
|
||||||
"when": "gitlens:enabled && view == gitlens.gitExplorer && viewItem == gitlens:commit-file",
|
"when": "view == gitlens.gitExplorer && viewItem == gitlens:commit-file",
|
||||||
"group": "1_gitlens@1"
|
"group": "1_gitlens@1"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"command": "gitlens.gitExplorer.openChangesWithWorking",
|
"command": "gitlens.gitExplorer.openChangesWithWorking",
|
||||||
"when": "gitlens:enabled && view == gitlens.gitExplorer && viewItem == gitlens:commit-file",
|
"when": "view == gitlens.gitExplorer && viewItem == gitlens:commit-file",
|
||||||
"group": "1_gitlens@2"
|
"group": "1_gitlens@2"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"command": "gitlens.gitExplorer.openFile",
|
"command": "gitlens.gitExplorer.openFile",
|
||||||
"when": "gitlens:enabled && view == gitlens.gitExplorer && viewItem == gitlens:commit-file",
|
"when": "view == gitlens.gitExplorer && viewItem == gitlens:commit-file",
|
||||||
"group": "2_gitlens@1"
|
"group": "2_gitlens@1"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"command": "gitlens.gitExplorer.openFileRevision",
|
"command": "gitlens.gitExplorer.openFileRevision",
|
||||||
"when": "gitlens:enabled && view == gitlens.gitExplorer && viewItem == gitlens:commit-file",
|
"when": "view == gitlens.gitExplorer && viewItem == gitlens:commit-file",
|
||||||
"group": "2_gitlens@2"
|
"group": "2_gitlens@2"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"command": "gitlens.openFileInRemote",
|
"command": "gitlens.openFileInRemote",
|
||||||
"when": "gitlens:enabled && gitlens:hasRemotes && view == gitlens.gitExplorer && viewItem == gitlens:commit-file",
|
"when": "gitlens:hasRemotes && view == gitlens.gitExplorer && viewItem == gitlens:commit-file",
|
||||||
"group": "3_gitlens@1"
|
"group": "3_gitlens@1"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"command": "gitlens.gitExplorer.openFileRevisionInRemote",
|
"command": "gitlens.gitExplorer.openFileRevisionInRemote",
|
||||||
"when": "gitlens:enabled && gitlens:hasRemotes && view == gitlens.gitExplorer && viewItem == gitlens:commit-file",
|
"when": "gitlens:hasRemotes && view == gitlens.gitExplorer && viewItem == gitlens:commit-file",
|
||||||
"group": "3_gitlens@2"
|
"group": "3_gitlens@2"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"command": "gitlens.gitExplorer.applyChanges",
|
"command": "gitlens.gitExplorer.applyChanges",
|
||||||
"when": "gitlens:enabled && view == gitlens.gitExplorer && viewItem == gitlens:commit-file",
|
"when": "view == gitlens.gitExplorer && viewItem == gitlens:commit-file",
|
||||||
"group": "4_gitlens@1"
|
"group": "4_gitlens@1"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"command": "gitlens.showQuickFileHistory",
|
"command": "gitlens.showQuickFileHistory",
|
||||||
"when": "gitlens:isTracked && view == gitlens.gitExplorer && viewItem == gitlens:commit-file && gitlens:gitExplorer:view == repository",
|
"when": "view == gitlens.gitExplorer && viewItem == gitlens:commit-file && gitlens:gitExplorer:view == repository",
|
||||||
"group": "5_gitlens@1"
|
"group": "5_gitlens@1"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"command": "gitlens.showQuickCommitFileDetails",
|
"command": "gitlens.showQuickCommitFileDetails",
|
||||||
"when": "gitlens:enabled && view == gitlens.gitExplorer && viewItem == gitlens:commit-file",
|
"when": "view == gitlens.gitExplorer && viewItem == gitlens:commit-file",
|
||||||
"group": "5_gitlens@2"
|
"group": "5_gitlens@2"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"command": "gitlens.gitExplorer.openFile",
|
"command": "gitlens.gitExplorer.openFile",
|
||||||
"when": "gitlens:enabled && view == gitlens.gitExplorer && viewItem == gitlens:file-history",
|
"when": "view == gitlens.gitExplorer && viewItem == gitlens:file-history",
|
||||||
"group": "1_gitlens@1"
|
"group": "1_gitlens@1"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"command": "gitlens.openFileInRemote",
|
"command": "gitlens.openFileInRemote",
|
||||||
"when": "gitlens:enabled && gitlens:hasRemotes && view == gitlens.gitExplorer && viewItem == gitlens:file-history",
|
"when": "gitlens:hasRemotes && view == gitlens.gitExplorer && viewItem == gitlens:file-history",
|
||||||
"group": "1_gitlens@2"
|
"group": "1_gitlens@2"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"command": "gitlens.openBranchesInRemote",
|
"command": "gitlens.openBranchesInRemote",
|
||||||
"when": "gitlens:enabled && gitlens:hasRemotes && view == gitlens.gitExplorer && viewItem == gitlens:remote",
|
"when": "gitlens:hasRemotes && view == gitlens.gitExplorer && viewItem == gitlens:remote",
|
||||||
"group": "1_gitlens@1"
|
"group": "1_gitlens@1"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"command": "gitlens.openRepoInRemote",
|
"command": "gitlens.openRepoInRemote",
|
||||||
"when": "gitlens:enabled && gitlens:hasRemotes && view == gitlens.gitExplorer && viewItem == gitlens:remote",
|
"when": "gitlens:hasRemotes && view == gitlens.gitExplorer && viewItem == gitlens:remote",
|
||||||
"group": "1_gitlens@2"
|
"group": "1_gitlens@2"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"command": "gitlens.stashSave",
|
"command": "gitlens.stashSave",
|
||||||
"when": "gitlens:enabled && view == gitlens.gitExplorer && viewItem == gitlens:stashes",
|
"when": "view == gitlens.gitExplorer && viewItem == gitlens:stashes",
|
||||||
"group": "1_gitlens@1"
|
"group": "1_gitlens@1"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"command": "gitlens.stashApply",
|
"command": "gitlens.stashApply",
|
||||||
"when": "gitlens:enabled && view == gitlens.gitExplorer && viewItem == gitlens:stash",
|
"when": "view == gitlens.gitExplorer && viewItem == gitlens:stash",
|
||||||
"group": "1_gitlens@1"
|
"group": "1_gitlens@1"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"command": "gitlens.stashDelete",
|
"command": "gitlens.stashDelete",
|
||||||
"when": "gitlens:enabled && view == gitlens.gitExplorer && viewItem == gitlens:stash",
|
"when": "view == gitlens.gitExplorer && viewItem == gitlens:stash",
|
||||||
"group": "1_gitlens@2"
|
"group": "1_gitlens@2"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"command": "gitlens.copyMessageToClipboard",
|
"command": "gitlens.gitExplorer.openChangedFileChanges",
|
||||||
"when": "gitlens:enabled && view == gitlens.gitExplorer && viewItem == gitlens:stash",
|
"when": "view == gitlens.gitExplorer && viewItem == gitlens:stash",
|
||||||
|
"group": "2_gitlens@1"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"command": "gitlens.gitExplorer.openChangedFileChangesWithWorking",
|
||||||
|
"when": "view == gitlens.gitExplorer && viewItem == gitlens:stash",
|
||||||
"group": "2_gitlens@1"
|
"group": "2_gitlens@1"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"command": "gitlens.gitExplorer.openChangedFiles",
|
"command": "gitlens.gitExplorer.openChangedFiles",
|
||||||
"when": "gitlens:enabled && view == gitlens.gitExplorer && viewItem == gitlens:stash",
|
"when": "view == gitlens.gitExplorer && viewItem == gitlens:stash",
|
||||||
"group": "3_gitlens@1"
|
"group": "3_gitlens@1"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"command": "gitlens.gitExplorer.openChangedFileRevisions",
|
"command": "gitlens.gitExplorer.openChangedFileRevisions",
|
||||||
"when": "gitlens:enabled && view == gitlens.gitExplorer && viewItem == gitlens:stash",
|
"when": "view == gitlens.gitExplorer && viewItem == gitlens:stash",
|
||||||
"group": "3_gitlens@2"
|
"group": "3_gitlens@2"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"command": "gitlens.gitExplorer.openChanges",
|
"command": "gitlens.copyMessageToClipboard",
|
||||||
"when": "gitlens:enabled && view == gitlens.gitExplorer && viewItem == gitlens:stash-file",
|
"when": "view == gitlens.gitExplorer && viewItem == gitlens:stash",
|
||||||
"group": "1_gitlens@1"
|
"group": "4_gitlens@1"
|
||||||
},
|
|
||||||
{
|
|
||||||
"command": "gitlens.gitExplorer.openChangesWithWorking",
|
|
||||||
"when": "gitlens:enabled && view == gitlens.gitExplorer && viewItem == gitlens:stash-file",
|
|
||||||
"group": "1_gitlens@2"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"command": "gitlens.gitExplorer.openFile",
|
|
||||||
"when": "gitlens:enabled && view == gitlens.gitExplorer && viewItem == gitlens:stash-file",
|
|
||||||
"group": "2_gitlens@1"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"command": "gitlens.gitExplorer.openFileRevision",
|
|
||||||
"when": "gitlens:enabled && view == gitlens.gitExplorer && viewItem == gitlens:stash-file",
|
|
||||||
"group": "2_gitlens@2"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"command": "gitlens.openFileInRemote",
|
|
||||||
"when": "gitlens:enabled && gitlens:hasRemotes && view == gitlens.gitExplorer && viewItem == gitlens:stash-file",
|
|
||||||
"group": "3_gitlens@1"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"command": "gitlens.gitExplorer.applyChanges",
|
"command": "gitlens.gitExplorer.applyChanges",
|
||||||
"when": "gitlens:enabled && view == gitlens.gitExplorer && viewItem == gitlens:stash-file",
|
"when": "view == gitlens.gitExplorer && viewItem == gitlens:stash-file",
|
||||||
|
"group": "1_gitlens@1"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"command": "gitlens.gitExplorer.openChanges",
|
||||||
|
"when": "view == gitlens.gitExplorer && viewItem == gitlens:stash-file",
|
||||||
|
"group": "2_gitlens@1"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"command": "gitlens.gitExplorer.openChangesWithWorking",
|
||||||
|
"when": "view == gitlens.gitExplorer && viewItem == gitlens:stash-file",
|
||||||
|
"group": "2_gitlens@2"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"command": "gitlens.gitExplorer.openFile",
|
||||||
|
"when": "view == gitlens.gitExplorer && viewItem == gitlens:stash-file",
|
||||||
|
"group": "3_gitlens@1"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"command": "gitlens.gitExplorer.openFileRevision",
|
||||||
|
"when": "view == gitlens.gitExplorer && viewItem == gitlens:stash-file",
|
||||||
|
"group": "3_gitlens@2"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"command": "gitlens.openFileInRemote",
|
||||||
|
"when": "gitlens:hasRemotes && view == gitlens.gitExplorer && viewItem == gitlens:stash-file",
|
||||||
"group": "4_gitlens@1"
|
"group": "4_gitlens@1"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"command": "gitlens.showQuickFileHistory",
|
"command": "gitlens.showQuickFileHistory",
|
||||||
"when": "gitlens:isTracked && view == gitlens.gitExplorer && viewItem == gitlens:stash-file",
|
"when": "view == gitlens.gitExplorer && viewItem == gitlens:stash-file",
|
||||||
"group": "5_gitlens@1"
|
"group": "5_gitlens@1"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"command": "gitlens.openRepoInRemote",
|
"command": "gitlens.openRepoInRemote",
|
||||||
"when": "gitlens:enabled && gitlens:hasRemotes && view == gitlens.gitExplorer && viewItem == gitlens:status",
|
"when": "gitlens:hasRemotes && view == gitlens.gitExplorer && viewItem == gitlens:status",
|
||||||
"group": "1_gitlens@1"
|
"group": "1_gitlens@1"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"command": "gitlens.gitExplorer.refresh",
|
"command": "gitlens.gitExplorer.refresh",
|
||||||
"when": "gitlens:enabled && view == gitlens.gitExplorer && viewItem != gitlens:commit-file && viewItem != gitlens:stash-file",
|
"when": "view == gitlens.gitExplorer && viewItem != gitlens:commit-file && viewItem != gitlens:stash-file",
|
||||||
"group": "9_gitlens@1"
|
"group": "9_gitlens@1"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -101,26 +101,18 @@ export class DiffWithCommand extends ActiveEditorCommand {
|
|||||||
args.showOptions.selection = new Range(args.line, 0, args.line, 0);
|
args.showOptions.selection = new Range(args.line, 0, args.line, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
let lhsPrefix = '';
|
|
||||||
if (lhs === undefined) {
|
|
||||||
lhsPrefix = 'deleted in ';
|
|
||||||
}
|
|
||||||
else if (args.rhs.sha === GitService.fakeSha) {
|
|
||||||
lhsPrefix = 'added in ';
|
|
||||||
}
|
|
||||||
|
|
||||||
let rhsPrefix = '';
|
let rhsPrefix = '';
|
||||||
if (rhs === undefined) {
|
if (rhs === undefined) {
|
||||||
rhsPrefix = 'deleted in ';
|
rhsPrefix = 'deleted in ';
|
||||||
}
|
}
|
||||||
else if (args.lhs.sha === GitService.fakeSha) {
|
else if (lhs === undefined || args.lhs.sha === GitService.fakeSha) {
|
||||||
rhsPrefix = 'added in ';
|
rhsPrefix = 'added in ';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (args.lhs.title === undefined && args.lhs.sha !== GitService.fakeSha) {
|
if (args.lhs.title === undefined && lhs !== undefined && args.lhs.sha !== GitService.fakeSha) {
|
||||||
args.lhs.title = (args.lhs.sha === '' || GitService.isUncommitted(args.lhs.sha))
|
args.lhs.title = (args.lhs.sha === '' || GitService.isUncommitted(args.lhs.sha))
|
||||||
? `${path.basename(args.lhs.uri.fsPath)}`
|
? `${path.basename(args.lhs.uri.fsPath)}`
|
||||||
: `${path.basename(args.lhs.uri.fsPath)} (${lhsPrefix}${GitService.shortenSha(args.lhs.sha)})`;
|
: `${path.basename(args.lhs.uri.fsPath)} (${GitService.shortenSha(args.lhs.sha)})`;
|
||||||
}
|
}
|
||||||
if (args.rhs.title === undefined && args.rhs.sha !== GitService.fakeSha) {
|
if (args.rhs.title === undefined && args.rhs.sha !== GitService.fakeSha) {
|
||||||
args.rhs.title = (args.rhs.sha === '' || GitService.isUncommitted(args.rhs.sha))
|
args.rhs.title = (args.rhs.sha === '' || GitService.isUncommitted(args.rhs.sha))
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
import { Arrays } from '../system';
|
|
||||||
import { commands, TextEditor, Uri, window } from 'vscode';
|
import { commands, TextEditor, Uri, window } from 'vscode';
|
||||||
import { ActiveEditorCommand, CommandContext, Commands, getCommandUri, isCommandViewContextWithBranch } from './common';
|
import { ActiveEditorCommand, CommandContext, Commands, getCommandUri, isCommandViewContextWithBranch } from './common';
|
||||||
import { GlyphChars } from '../constants';
|
import { GlyphChars } from '../constants';
|
||||||
@@ -52,7 +51,8 @@ export class OpenBranchInRemoteCommand extends ActiveEditorCommand {
|
|||||||
if (args.branch === undefined) return undefined;
|
if (args.branch === undefined) return undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
const remotes = Arrays.uniqueBy(await this.git.getRemotes(repoPath), _ => _.url, _ => !!_.provider);
|
const remotes = (await this.git.getRemotes(repoPath)).filter(r => r.provider !== undefined);
|
||||||
|
|
||||||
return commands.executeCommand(Commands.OpenInRemote, uri, {
|
return commands.executeCommand(Commands.OpenInRemote, uri, {
|
||||||
resource: {
|
resource: {
|
||||||
type: 'branch',
|
type: 'branch',
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
import { Arrays } from '../system';
|
|
||||||
import { commands, TextEditor, Uri, window } from 'vscode';
|
import { commands, TextEditor, Uri, window } from 'vscode';
|
||||||
import { ActiveEditorCommand, CommandContext, Commands, getCommandUri, isCommandViewContextWithRemote } from './common';
|
import { ActiveEditorCommand, CommandContext, Commands, getCommandUri, isCommandViewContextWithRemote } from './common';
|
||||||
import { GitService, GitUri } from '../gitService';
|
import { GitService, GitUri } from '../gitService';
|
||||||
@@ -34,7 +33,7 @@ export class OpenBranchesInRemoteCommand extends ActiveEditorCommand {
|
|||||||
if (!repoPath) return undefined;
|
if (!repoPath) return undefined;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const remotes = Arrays.uniqueBy(await this.git.getRemotes(repoPath), r => r.url, r => !!r.provider);
|
const remotes = (await this.git.getRemotes(repoPath)).filter(r => r.provider !== undefined);
|
||||||
|
|
||||||
return commands.executeCommand(Commands.OpenInRemote, uri, {
|
return commands.executeCommand(Commands.OpenInRemote, uri, {
|
||||||
resource: {
|
resource: {
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
import { Arrays } from '../system';
|
|
||||||
import { commands, TextEditor, Uri, window } from 'vscode';
|
import { commands, TextEditor, Uri, window } from 'vscode';
|
||||||
import { ActiveEditorCommand, CommandContext, Commands, getCommandUri, isCommandViewContextWithCommit } from './common';
|
import { ActiveEditorCommand, CommandContext, Commands, getCommandUri, isCommandViewContextWithCommit } from './common';
|
||||||
import { GitBlameCommit, GitService, GitUri } from '../gitService';
|
import { GitBlameCommit, GitService, GitUri } from '../gitService';
|
||||||
@@ -53,7 +52,8 @@ export class OpenCommitInRemoteCommand extends ActiveEditorCommand {
|
|||||||
args.sha = commit.sha;
|
args.sha = commit.sha;
|
||||||
}
|
}
|
||||||
|
|
||||||
const remotes = Arrays.uniqueBy(await this.git.getRemotes(gitUri.repoPath), _ => _.url, _ => !!_.provider);
|
const remotes = (await this.git.getRemotes(gitUri.repoPath)).filter(r => r.provider !== undefined);
|
||||||
|
|
||||||
return commands.executeCommand(Commands.OpenInRemote, uri, {
|
return commands.executeCommand(Commands.OpenInRemote, uri, {
|
||||||
resource: {
|
resource: {
|
||||||
type: 'commit',
|
type: 'commit',
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
import { Arrays } from '../system';
|
|
||||||
import { commands, Range, TextEditor, Uri, window } from 'vscode';
|
import { commands, Range, TextEditor, Uri, window } from 'vscode';
|
||||||
import { ActiveEditorCommand, CommandContext, Commands, getCommandUri, isCommandViewContextWithCommit } from './common';
|
import { ActiveEditorCommand, CommandContext, Commands, getCommandUri, isCommandViewContextWithBranch, isCommandViewContextWithCommit } from './common';
|
||||||
import { GitService, GitUri } from '../gitService';
|
import { GitService, GitUri } from '../gitService';
|
||||||
import { Logger } from '../logger';
|
import { Logger } from '../logger';
|
||||||
import { OpenInRemoteCommandArgs } from './openInRemote';
|
import { OpenInRemoteCommandArgs } from './openInRemote';
|
||||||
|
|
||||||
export interface OpenFileInRemoteCommandArgs {
|
export interface OpenFileInRemoteCommandArgs {
|
||||||
|
branch?: string;
|
||||||
range?: boolean;
|
range?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -20,6 +20,9 @@ export class OpenFileInRemoteCommand extends ActiveEditorCommand {
|
|||||||
if (isCommandViewContextWithCommit(context)) {
|
if (isCommandViewContextWithCommit(context)) {
|
||||||
args = { ...args };
|
args = { ...args };
|
||||||
args.range = false;
|
args.range = false;
|
||||||
|
if (isCommandViewContextWithBranch(context)) {
|
||||||
|
args.branch = context.node.branch !== undefined ? context.node.branch.name : undefined;
|
||||||
|
}
|
||||||
return this.execute(context.editor, context.node.commit.uri, args);
|
return this.execute(context.editor, context.node.commit.uri, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -33,18 +36,23 @@ export class OpenFileInRemoteCommand extends ActiveEditorCommand {
|
|||||||
const gitUri = await GitUri.fromUri(uri, this.git);
|
const gitUri = await GitUri.fromUri(uri, this.git);
|
||||||
if (!gitUri.repoPath) return undefined;
|
if (!gitUri.repoPath) return undefined;
|
||||||
|
|
||||||
const branch = await this.git.getBranch(gitUri.repoPath);
|
if (args.branch === undefined) {
|
||||||
|
const branch = await this.git.getBranch(gitUri.repoPath);
|
||||||
|
if (branch !== undefined) {
|
||||||
|
args.branch = branch.name;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const remotes = Arrays.uniqueBy(await this.git.getRemotes(gitUri.repoPath), _ => _.url, _ => !!_.provider);
|
const remotes = (await this.git.getRemotes(gitUri.repoPath)).filter(r => r.provider !== undefined);
|
||||||
const range = (args.range && editor !== undefined)
|
const range = (args.range && editor !== undefined)
|
||||||
? new Range(editor.selection.start.with({ line: editor.selection.start.line + 1 }), editor.selection.end.with({ line: editor.selection.end.line + 1 }))
|
? new Range(editor.selection.start.with({ line: editor.selection.start.line + 1 }), editor.selection.end.with({ line: editor.selection.end.line + 1 }))
|
||||||
: undefined;
|
: undefined;
|
||||||
|
|
||||||
return commands.executeCommand(Commands.OpenInRemote, uri, {
|
return commands.executeCommand(Commands.OpenInRemote, uri, {
|
||||||
resource: {
|
resource: {
|
||||||
type: 'file',
|
type: gitUri.sha === undefined ? 'file' : 'revision',
|
||||||
branch: branch === undefined ? 'Current' : branch.name,
|
branch: args.branch === undefined ? 'Current' : args.branch,
|
||||||
fileName: gitUri.getRelativePath(),
|
fileName: gitUri.getRelativePath(),
|
||||||
range: range,
|
range: range,
|
||||||
sha: gitUri.sha
|
sha: gitUri.sha
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
import { Arrays } from '../system';
|
|
||||||
import { commands, TextEditor, Uri, window } from 'vscode';
|
import { commands, TextEditor, Uri, window } from 'vscode';
|
||||||
import { ActiveEditorCommand, CommandContext, Commands, getCommandUri, isCommandViewContextWithRemote } from './common';
|
import { ActiveEditorCommand, CommandContext, Commands, getCommandUri, isCommandViewContextWithRemote } from './common';
|
||||||
import { GitService, GitUri } from '../gitService';
|
import { GitService, GitUri } from '../gitService';
|
||||||
@@ -34,7 +33,7 @@ export class OpenRepoInRemoteCommand extends ActiveEditorCommand {
|
|||||||
if (!repoPath) return undefined;
|
if (!repoPath) return undefined;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const remotes = Arrays.uniqueBy(await this.git.getRemotes(repoPath), r => r.url, r => !!r.provider);
|
const remotes = (await this.git.getRemotes(repoPath)).filter(r => r.provider !== undefined);
|
||||||
|
|
||||||
return commands.executeCommand(Commands.OpenInRemote, uri, {
|
return commands.executeCommand(Commands.OpenInRemote, uri, {
|
||||||
resource: {
|
resource: {
|
||||||
|
|||||||
@@ -275,6 +275,8 @@ export interface IConfig {
|
|||||||
};
|
};
|
||||||
|
|
||||||
blame: {
|
blame: {
|
||||||
|
ignoreWhitespace: boolean;
|
||||||
|
|
||||||
file: {
|
file: {
|
||||||
annotationType: FileAnnotationType;
|
annotationType: FileAnnotationType;
|
||||||
lineHighlight: {
|
lineHighlight: {
|
||||||
|
|||||||
@@ -77,6 +77,7 @@ export type GlyphChars = '\u21a9' |
|
|||||||
'\u2937' |
|
'\u2937' |
|
||||||
'\u2190' |
|
'\u2190' |
|
||||||
'\u2194' |
|
'\u2194' |
|
||||||
|
'\u2192' |
|
||||||
'\u21e8' |
|
'\u21e8' |
|
||||||
'\u2191' |
|
'\u2191' |
|
||||||
'\u2713' |
|
'\u2713' |
|
||||||
@@ -91,6 +92,7 @@ export const GlyphChars = {
|
|||||||
ArrowDropRight: '\u2937' as GlyphChars,
|
ArrowDropRight: '\u2937' as GlyphChars,
|
||||||
ArrowLeft: '\u2190' as GlyphChars,
|
ArrowLeft: '\u2190' as GlyphChars,
|
||||||
ArrowLeftRight: '\u2194' as GlyphChars,
|
ArrowLeftRight: '\u2194' as GlyphChars,
|
||||||
|
ArrowRight: '\u2192' as GlyphChars,
|
||||||
ArrowRightHollow: '\u21e8' as GlyphChars,
|
ArrowRightHollow: '\u21e8' as GlyphChars,
|
||||||
ArrowUp: '\u2191' as GlyphChars,
|
ArrowUp: '\u2191' as GlyphChars,
|
||||||
Check: '\u2713' as GlyphChars,
|
Check: '\u2713' as GlyphChars,
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ export * from './parsers/blameParser';
|
|||||||
export * from './parsers/branchParser';
|
export * from './parsers/branchParser';
|
||||||
export * from './parsers/diffParser';
|
export * from './parsers/diffParser';
|
||||||
export * from './parsers/logParser';
|
export * from './parsers/logParser';
|
||||||
|
export * from './parsers/remoteParser';
|
||||||
export * from './parsers/stashParser';
|
export * from './parsers/stashParser';
|
||||||
export * from './parsers/statusParser';
|
export * from './parsers/statusParser';
|
||||||
export * from './remotes/provider';
|
export * from './remotes/provider';
|
||||||
@@ -176,15 +177,17 @@ export class Git {
|
|||||||
|
|
||||||
// Git commands
|
// Git commands
|
||||||
|
|
||||||
static blame(repoPath: string | undefined, fileName: string, sha?: string, startLine?: number, endLine?: number) {
|
static blame(repoPath: string | undefined, fileName: string, sha?: string, options: { ignoreWhitespace?: boolean, startLine?: number, endLine?: number } = {}) {
|
||||||
const [file, root] = Git.splitPath(fileName, repoPath);
|
const [file, root] = Git.splitPath(fileName, repoPath);
|
||||||
|
|
||||||
const params = [`blame`, `--root`, `--incremental`];
|
const params = [`blame`, `--root`, `--incremental`];
|
||||||
|
|
||||||
if (startLine != null && endLine != null) {
|
if (options.ignoreWhitespace) {
|
||||||
params.push(`-L ${startLine},${endLine}`);
|
params.push('-w');
|
||||||
|
}
|
||||||
|
if (options.startLine != null && options.endLine != null) {
|
||||||
|
params.push(`-L ${options.startLine},${options.endLine}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sha) {
|
if (sha) {
|
||||||
params.push(sha);
|
params.push(sha);
|
||||||
}
|
}
|
||||||
@@ -358,7 +361,8 @@ export class Git {
|
|||||||
return await gitCommand(opts, 'show', args);
|
return await gitCommand(opts, 'show', args);
|
||||||
}
|
}
|
||||||
catch (ex) {
|
catch (ex) {
|
||||||
if (/Path \'.*?\' does not exist in/.test(ex && ex.toString())) {
|
const msg = ex && ex.toString();
|
||||||
|
if (/Path \'.*?\' does not exist in/.test(msg) || /Path \'.*?\' exists on disk, but not in /.test(msg)) {
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
import { Disposable, Event, EventEmitter, TextDocument, TextDocumentChangeEvent, TextEditor, window, workspace } from 'vscode';
|
import { Disposable, Event, EventEmitter, TextDocument, TextDocumentChangeEvent, TextEditor, window, workspace } from 'vscode';
|
||||||
import { TextDocumentComparer } from '../comparers';
|
import { TextDocumentComparer } from '../comparers';
|
||||||
import { CommandContext, setCommandContext } from '../constants';
|
import { CommandContext, setCommandContext } from '../constants';
|
||||||
import { GitService, GitUri } from '../gitService';
|
import { GitService, GitUri, RepoChangedReasons } from '../gitService';
|
||||||
import { Logger } from '../logger';
|
import { Logger } from '../logger';
|
||||||
|
|
||||||
export interface BlameabilityChangeEvent {
|
export interface BlameabilityChangeEvent {
|
||||||
@@ -32,6 +32,7 @@ export class GitContextTracker extends Disposable {
|
|||||||
subscriptions.push(workspace.onDidChangeConfiguration(this._onConfigurationChanged, this));
|
subscriptions.push(workspace.onDidChangeConfiguration(this._onConfigurationChanged, this));
|
||||||
subscriptions.push(workspace.onDidSaveTextDocument(this._onTextDocumentSaved, this));
|
subscriptions.push(workspace.onDidSaveTextDocument(this._onTextDocumentSaved, this));
|
||||||
subscriptions.push(this.git.onDidBlameFail(this._onBlameFailed, this));
|
subscriptions.push(this.git.onDidBlameFail(this._onBlameFailed, this));
|
||||||
|
subscriptions.push(this.git.onDidChangeRepo(this._onRepoChanged, this));
|
||||||
|
|
||||||
this._disposable = Disposable.from(...subscriptions);
|
this._disposable = Disposable.from(...subscriptions);
|
||||||
|
|
||||||
@@ -54,6 +55,13 @@ export class GitContextTracker extends Disposable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async _onRepoChanged(reasons: RepoChangedReasons[]) {
|
||||||
|
if (!reasons.includes(RepoChangedReasons.Remotes)) return;
|
||||||
|
|
||||||
|
const gitUri = this._editor === undefined ? undefined : await GitUri.fromUri(this._editor.document.uri, this.git);
|
||||||
|
this._updateContextHasRemotes(gitUri);
|
||||||
|
}
|
||||||
|
|
||||||
private _onActiveTextEditorChanged(editor: TextEditor | undefined) {
|
private _onActiveTextEditorChanged(editor: TextEditor | undefined) {
|
||||||
this._editor = editor;
|
this._editor = editor;
|
||||||
this._updateContext(this._gitEnabled ? editor : undefined);
|
this._updateContext(this._gitEnabled ? editor : undefined);
|
||||||
|
|||||||
@@ -5,23 +5,9 @@ export type GitRemoteType = 'fetch' | 'push';
|
|||||||
|
|
||||||
export class GitRemote {
|
export class GitRemote {
|
||||||
|
|
||||||
name: string;
|
|
||||||
url: string;
|
|
||||||
type: GitRemoteType;
|
|
||||||
|
|
||||||
provider?: RemoteProvider;
|
provider?: RemoteProvider;
|
||||||
|
|
||||||
constructor(remote: string) {
|
constructor(public readonly repoPath: string, public readonly name: string, public readonly url: string, public readonly domain: string, public readonly path: string, public readonly types: GitRemoteType[]) {
|
||||||
remote = remote.trim();
|
this.provider = RemoteProviderFactory.getRemoteProvider(this.domain, this.path);
|
||||||
|
|
||||||
const [name, info] = remote.split('\t');
|
|
||||||
this.name = name;
|
|
||||||
|
|
||||||
const [url, typeInfo] = info.split(' ');
|
|
||||||
this.url = url;
|
|
||||||
|
|
||||||
this.type = typeInfo.substring(1, typeInfo.length - 1) as GitRemoteType;
|
|
||||||
|
|
||||||
this.provider = RemoteProviderFactory.getRemoteProvider(this.url);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
50
src/git/parsers/remoteParser.ts
Normal file
50
src/git/parsers/remoteParser.ts
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
'use strict';
|
||||||
|
import { GitRemote } from './../git';
|
||||||
|
import { GitRemoteType } from '../models/remote';
|
||||||
|
|
||||||
|
const remoteRegex = /^(.*)\t(.*)\s\((.*)\)$/gm;
|
||||||
|
const urlRegex = /^(?:git:\/\/(.*?)\/|https:\/\/(.*?)\/|http:\/\/(.*?)\/|git@(.*):|ssh:\/\/(?:.*@)?(.*?)(?::.*?)?\/)(.*)$/;
|
||||||
|
|
||||||
|
export class GitRemoteParser {
|
||||||
|
|
||||||
|
static parse(data: string, repoPath: string): GitRemote[] {
|
||||||
|
if (!data) return [];
|
||||||
|
|
||||||
|
const remotes: GitRemote[] = [];
|
||||||
|
const groups = Object.create(null);
|
||||||
|
|
||||||
|
let match: RegExpExecArray | null = null;
|
||||||
|
do {
|
||||||
|
match = remoteRegex.exec(data);
|
||||||
|
if (match == null) break;
|
||||||
|
|
||||||
|
const url = match[2];
|
||||||
|
|
||||||
|
const [domain, path] = this.parseGitUrl(url);
|
||||||
|
|
||||||
|
let remote: GitRemote | undefined = groups[url];
|
||||||
|
if (remote === undefined) {
|
||||||
|
remote = new GitRemote(repoPath, match[1], url, domain, path, [match[3] as GitRemoteType]);
|
||||||
|
remotes.push(remote);
|
||||||
|
groups[url] = remote;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
remote.types.push(match[3] as GitRemoteType);
|
||||||
|
}
|
||||||
|
} while (match != null);
|
||||||
|
|
||||||
|
if (!remotes.length) return [];
|
||||||
|
|
||||||
|
return remotes;
|
||||||
|
}
|
||||||
|
|
||||||
|
static parseGitUrl(url: string): [string, string] {
|
||||||
|
const match = urlRegex.exec(url);
|
||||||
|
if (match == null) return ['', ''];
|
||||||
|
|
||||||
|
return [
|
||||||
|
match[1] || match[2] || match[3] || match[4] || match[5],
|
||||||
|
match[6].replace(/\.git\/?$/, '')
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
import { ExtensionContext, workspace } from 'vscode';
|
import { Objects } from '../../system';
|
||||||
|
import { Event, EventEmitter, ExtensionContext, workspace } from 'vscode';
|
||||||
import { BitbucketService } from './bitbucket';
|
import { BitbucketService } from './bitbucket';
|
||||||
import { BitbucketServerService } from './bitbucket-server';
|
import { BitbucketServerService } from './bitbucket-server';
|
||||||
import { CustomRemoteType, IConfig, IRemotesConfig } from '../../configuration';
|
import { CustomRemoteType, IConfig, IRemotesConfig } from '../../configuration';
|
||||||
@@ -9,22 +10,9 @@ import { GitLabService } from './gitlab';
|
|||||||
import { Logger } from '../../logger';
|
import { Logger } from '../../logger';
|
||||||
import { RemoteProvider } from './provider';
|
import { RemoteProvider } from './provider';
|
||||||
import { VisualStudioService } from './visualStudio';
|
import { VisualStudioService } from './visualStudio';
|
||||||
import { Objects } from '../../system';
|
|
||||||
|
|
||||||
export { RemoteProvider };
|
export { RemoteProvider };
|
||||||
|
|
||||||
const UrlRegex = /^(?:git:\/\/(.*?)\/|https:\/\/(.*?)\/|http:\/\/(.*?)\/|git@(.*):|ssh:\/\/(?:.*@)?(.*?)(?::.*?)?\/)(.*)$/;
|
|
||||||
|
|
||||||
function getCustomProvider(type: CustomRemoteType) {
|
|
||||||
switch (type) {
|
|
||||||
case CustomRemoteType.Bitbucket: return (domain: string, path: string) => new BitbucketService(domain, path, true);
|
|
||||||
case CustomRemoteType.BitbucketServer: return (domain: string, path: string) => new BitbucketServerService(domain, path, true);
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
const defaultProviderMap = new Map<string, (domain: string, path: string) => RemoteProvider>([
|
const defaultProviderMap = new Map<string, (domain: string, path: string) => RemoteProvider>([
|
||||||
['bitbucket.org', (domain: string, path: string) => new BitbucketService(domain, path)],
|
['bitbucket.org', (domain: string, path: string) => new BitbucketService(domain, path)],
|
||||||
['github.com', (domain: string, path: string) => new GitHubService(domain, path)],
|
['github.com', (domain: string, path: string) => new GitHubService(domain, path)],
|
||||||
@@ -32,48 +20,29 @@ const defaultProviderMap = new Map<string, (domain: string, path: string) => Rem
|
|||||||
['visualstudio.com', (domain: string, path: string) => new VisualStudioService(domain, path)]
|
['visualstudio.com', (domain: string, path: string) => new VisualStudioService(domain, path)]
|
||||||
]);
|
]);
|
||||||
|
|
||||||
let providerMap: Map<string, (domain: string, path: string) => RemoteProvider>;
|
|
||||||
let remotesCfg: IRemotesConfig[];
|
|
||||||
|
|
||||||
function onConfigurationChanged() {
|
|
||||||
const cfg = workspace.getConfiguration().get<IConfig>(ExtensionKey);
|
|
||||||
if (cfg === undefined) return;
|
|
||||||
|
|
||||||
if (!Objects.areEquivalent(cfg.remotes, remotesCfg)) {
|
|
||||||
providerMap = new Map(defaultProviderMap);
|
|
||||||
|
|
||||||
remotesCfg = cfg.remotes;
|
|
||||||
if (remotesCfg != null && remotesCfg.length > 0) {
|
|
||||||
for (const svc of remotesCfg) {
|
|
||||||
const provider = getCustomProvider(svc.type);
|
|
||||||
if (provider === undefined) continue;
|
|
||||||
|
|
||||||
providerMap.set(svc.domain.toLowerCase(), provider);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export class RemoteProviderFactory {
|
export class RemoteProviderFactory {
|
||||||
|
|
||||||
static configure(context: ExtensionContext) {
|
private static _providerMap: Map<string, (domain: string, path: string) => RemoteProvider>;
|
||||||
context.subscriptions.push(workspace.onDidChangeConfiguration(onConfigurationChanged));
|
private static _remotesCfg: IRemotesConfig[];
|
||||||
onConfigurationChanged();
|
|
||||||
|
private static _onDidChange = new EventEmitter<void>();
|
||||||
|
public static get onDidChange(): Event<void> {
|
||||||
|
return this._onDidChange.event;
|
||||||
}
|
}
|
||||||
|
|
||||||
static getRemoteProvider(url: string): RemoteProvider | undefined {
|
static configure(context: ExtensionContext) {
|
||||||
|
context.subscriptions.push(workspace.onDidChangeConfiguration(() => this.onConfigurationChanged()));
|
||||||
|
this.onConfigurationChanged(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
static getRemoteProvider(domain: string, path: string): RemoteProvider | undefined {
|
||||||
try {
|
try {
|
||||||
const match = UrlRegex.exec(url);
|
let key = domain.toLowerCase();
|
||||||
if (match == null) return undefined;
|
if (key.endsWith('visualstudio.com')) {
|
||||||
|
key = 'visualstudio.com';
|
||||||
|
}
|
||||||
|
|
||||||
const domain = match[1] || match[2] || match[3] || match[4] || match[5];
|
const creator = this._providerMap.get(key);
|
||||||
const path = match[6].replace(/\.git\/?$/, '');
|
|
||||||
|
|
||||||
const key = domain.toLowerCase().endsWith('visualstudio.com')
|
|
||||||
? 'visualstudio.com'
|
|
||||||
: domain;
|
|
||||||
|
|
||||||
const creator = providerMap.get(key.toLowerCase());
|
|
||||||
if (creator === undefined) return undefined;
|
if (creator === undefined) return undefined;
|
||||||
|
|
||||||
return creator(domain, path);
|
return creator(domain, path);
|
||||||
@@ -83,4 +52,37 @@ export class RemoteProviderFactory {
|
|||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static onConfigurationChanged(silent: boolean = false) {
|
||||||
|
const cfg = workspace.getConfiguration().get<IConfig>(ExtensionKey);
|
||||||
|
if (cfg === undefined) return;
|
||||||
|
|
||||||
|
if (!Objects.areEquivalent(cfg.remotes, this._remotesCfg)) {
|
||||||
|
this._providerMap = new Map(defaultProviderMap);
|
||||||
|
|
||||||
|
this._remotesCfg = cfg.remotes;
|
||||||
|
if (this._remotesCfg != null && this._remotesCfg.length > 0) {
|
||||||
|
for (const svc of this._remotesCfg) {
|
||||||
|
const provider = this.getCustomProvider(svc.type);
|
||||||
|
if (provider === undefined) continue;
|
||||||
|
|
||||||
|
this._providerMap.set(svc.domain.toLowerCase(), provider);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!silent) {
|
||||||
|
this._onDidChange.fire();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static getCustomProvider(type: CustomRemoteType) {
|
||||||
|
switch (type) {
|
||||||
|
case CustomRemoteType.Bitbucket: return (domain: string, path: string) => new BitbucketService(domain, path, true);
|
||||||
|
case CustomRemoteType.BitbucketServer: return (domain: string, path: string) => new BitbucketServerService(domain, path, true);
|
||||||
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -3,7 +3,8 @@ import { Functions, Iterables, Objects } from './system';
|
|||||||
import { Disposable, Event, EventEmitter, FileSystemWatcher, Location, Position, Range, TextDocument, TextDocumentChangeEvent, TextEditor, Uri, workspace } from 'vscode';
|
import { Disposable, Event, EventEmitter, FileSystemWatcher, Location, Position, Range, TextDocument, TextDocumentChangeEvent, TextEditor, Uri, workspace } from 'vscode';
|
||||||
import { IConfig } from './configuration';
|
import { IConfig } from './configuration';
|
||||||
import { DocumentSchemes, ExtensionKey, GlyphChars } from './constants';
|
import { DocumentSchemes, ExtensionKey, GlyphChars } from './constants';
|
||||||
import { Git, GitAuthor, GitBlame, GitBlameCommit, GitBlameLine, GitBlameLines, GitBlameParser, GitBranch, GitBranchParser, GitCommit, GitDiff, GitDiffChunkLine, GitDiffParser, GitLog, GitLogCommit, GitLogParser, GitRemote, GitStash, GitStashParser, GitStatus, GitStatusFile, GitStatusParser, IGit, setDefaultEncoding } from './git/git';
|
import { RemoteProviderFactory } from './git/remotes/factory';
|
||||||
|
import { Git, GitAuthor, GitBlame, GitBlameCommit, GitBlameLine, GitBlameLines, GitBlameParser, GitBranch, GitBranchParser, GitCommit, GitDiff, GitDiffChunkLine, GitDiffParser, GitLog, GitLogCommit, GitLogParser, GitRemote, GitRemoteParser, GitStash, GitStashParser, GitStatus, GitStatusFile, GitStatusParser, IGit, setDefaultEncoding } from './git/git';
|
||||||
import { GitUri, IGitCommitInfo, IGitUriData } from './git/gitUri';
|
import { GitUri, IGitCommitInfo, IGitUriData } from './git/gitUri';
|
||||||
import { Logger } from './logger';
|
import { Logger } from './logger';
|
||||||
import * as fs from 'fs';
|
import * as fs from 'fs';
|
||||||
@@ -64,8 +65,9 @@ export const GitRepoSearchBy = {
|
|||||||
Sha: 'sha' as GitRepoSearchBy
|
Sha: 'sha' as GitRepoSearchBy
|
||||||
};
|
};
|
||||||
|
|
||||||
export type RepoChangedReasons = 'stash' | 'unknown';
|
export type RepoChangedReasons = 'remotes' | 'stash' | 'unknown';
|
||||||
export const RepoChangedReasons = {
|
export const RepoChangedReasons = {
|
||||||
|
Remotes: 'remotes' as RepoChangedReasons,
|
||||||
Stash: 'stash' as RepoChangedReasons,
|
Stash: 'stash' as RepoChangedReasons,
|
||||||
Unknown: 'unknown' as RepoChangedReasons
|
Unknown: 'unknown' as RepoChangedReasons
|
||||||
};
|
};
|
||||||
@@ -113,6 +115,7 @@ export class GitService extends Disposable {
|
|||||||
const subscriptions: Disposable[] = [];
|
const subscriptions: Disposable[] = [];
|
||||||
|
|
||||||
subscriptions.push(workspace.onDidChangeConfiguration(this._onConfigurationChanged, this));
|
subscriptions.push(workspace.onDidChangeConfiguration(this._onConfigurationChanged, this));
|
||||||
|
subscriptions.push(RemoteProviderFactory.onDidChange(this._onRemoteProviderChanged, this));
|
||||||
|
|
||||||
this._disposable = Disposable.from(...subscriptions);
|
this._disposable = Disposable.from(...subscriptions);
|
||||||
}
|
}
|
||||||
@@ -190,7 +193,19 @@ export class GitService extends Disposable {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const ignoreWhitespace = this.config && this.config.blame.ignoreWhitespace;
|
||||||
|
|
||||||
this.config = cfg;
|
this.config = cfg;
|
||||||
|
|
||||||
|
if (this.config.blame.ignoreWhitespace !== ignoreWhitespace) {
|
||||||
|
this._gitCache.clear();
|
||||||
|
this._fireGitCacheChange();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private _onRemoteProviderChanged() {
|
||||||
|
this._remotesCache.clear();
|
||||||
|
this._fireRepoChange(RepoChangedReasons.Remotes);
|
||||||
}
|
}
|
||||||
|
|
||||||
private _onTextDocumentChanged(e: TextDocumentChangeEvent) {
|
private _onTextDocumentChanged(e: TextDocumentChangeEvent) {
|
||||||
@@ -420,7 +435,7 @@ export class GitService extends Disposable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const data = await Git.blame(root, file, uri.sha);
|
const data = await Git.blame(root, file, uri.sha, { ignoreWhitespace: this.config.blame.ignoreWhitespace });
|
||||||
const blame = GitBlameParser.parse(data, root, file);
|
const blame = GitBlameParser.parse(data, root, file);
|
||||||
return blame;
|
return blame;
|
||||||
}
|
}
|
||||||
@@ -469,7 +484,7 @@ export class GitService extends Disposable {
|
|||||||
const fileName = uri.fsPath;
|
const fileName = uri.fsPath;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const data = await Git.blame(uri.repoPath, fileName, uri.sha, line + 1, line + 1);
|
const data = await Git.blame(uri.repoPath, fileName, uri.sha, { ignoreWhitespace: this.config.blame.ignoreWhitespace, startLine: line + 1, endLine: line + 1 });
|
||||||
const blame = GitBlameParser.parse(data, uri.repoPath, fileName);
|
const blame = GitBlameParser.parse(data, uri.repoPath, fileName);
|
||||||
if (blame === undefined) return undefined;
|
if (blame === undefined) return undefined;
|
||||||
|
|
||||||
@@ -895,7 +910,7 @@ export class GitService extends Disposable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const data = await Git.remote(repoPath);
|
const data = await Git.remote(repoPath);
|
||||||
const remotes = data.split('\n').filter(_ => !!_).map(_ => new GitRemote(_));
|
const remotes = GitRemoteParser.parse(data, repoPath);
|
||||||
if (this.UseCaching) {
|
if (this.UseCaching) {
|
||||||
this._remotesCache.set(repoPath, remotes);
|
this._remotesCache.set(repoPath, remotes);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
import { Arrays, Iterables, Strings } from '../system';
|
import { Iterables, Strings } from '../system';
|
||||||
import { CancellationTokenSource, QuickPickOptions, Uri, window } from 'vscode';
|
import { CancellationTokenSource, QuickPickOptions, Uri, window } from 'vscode';
|
||||||
import { Commands, ShowCommitSearchCommandArgs, ShowQuickBranchHistoryCommandArgs } from '../commands';
|
import { Commands, ShowCommitSearchCommandArgs, ShowQuickBranchHistoryCommandArgs } from '../commands';
|
||||||
import { CommandQuickPickItem, CommitQuickPickItem, getQuickPickIgnoreFocusOut, showQuickPickProgress } from './common';
|
import { CommandQuickPickItem, CommitQuickPickItem, getQuickPickIgnoreFocusOut, showQuickPickProgress } from './common';
|
||||||
@@ -35,7 +35,7 @@ export class BranchHistoryQuickPick {
|
|||||||
} as ShowQuickBranchHistoryCommandArgs
|
} as ShowQuickBranchHistoryCommandArgs
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const remotes = Arrays.uniqueBy(await git.getRemotes((uri && uri.repoPath) || git.repoPath), _ => _.url, _ => !!_.provider);
|
const remotes = (await git.getRemotes((uri && uri.repoPath) || git.repoPath)).filter(r => r.provider !== undefined);
|
||||||
if (remotes.length) {
|
if (remotes.length) {
|
||||||
items.splice(0, 0, new OpenRemotesCommandQuickPickItem(remotes, {
|
items.splice(0, 0, new OpenRemotesCommandQuickPickItem(remotes, {
|
||||||
type: 'branch',
|
type: 'branch',
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
import { Arrays, Iterables, Strings } from '../system';
|
import { Iterables, Strings } from '../system';
|
||||||
import { commands, QuickPickOptions, TextDocumentShowOptions, Uri, window } from 'vscode';
|
import { commands, QuickPickOptions, TextDocumentShowOptions, Uri, window } from 'vscode';
|
||||||
import { Commands, CopyMessageToClipboardCommandArgs, CopyShaToClipboardCommandArgs, DiffDirectoryCommandCommandArgs, DiffWithPreviousCommandArgs, ShowQuickCommitDetailsCommandArgs, StashApplyCommandArgs, StashDeleteCommandArgs } from '../commands';
|
import { Commands, CopyMessageToClipboardCommandArgs, CopyShaToClipboardCommandArgs, DiffDirectoryCommandCommandArgs, DiffWithPreviousCommandArgs, ShowQuickCommitDetailsCommandArgs, StashApplyCommandArgs, StashDeleteCommandArgs } from '../commands';
|
||||||
import { CommandQuickPickItem, getQuickPickIgnoreFocusOut, KeyCommandQuickPickItem, OpenFileCommandQuickPickItem, OpenFilesCommandQuickPickItem, QuickPickItem } from './common';
|
import { CommandQuickPickItem, getQuickPickIgnoreFocusOut, KeyCommandQuickPickItem, OpenFileCommandQuickPickItem, OpenFilesCommandQuickPickItem, QuickPickItem } from './common';
|
||||||
@@ -153,7 +153,7 @@ export class CommitDetailsQuickPick {
|
|||||||
]));
|
]));
|
||||||
|
|
||||||
if (!stash) {
|
if (!stash) {
|
||||||
const remotes = Arrays.uniqueBy(await git.getRemotes(commit.repoPath), _ => _.url, _ => !!_.provider);
|
const remotes = (await git.getRemotes(commit.repoPath)).filter(r => r.provider !== undefined);
|
||||||
if (remotes.length) {
|
if (remotes.length) {
|
||||||
items.splice(index++, 0, new OpenRemotesCommandQuickPickItem(remotes, {
|
items.splice(index++, 0, new OpenRemotesCommandQuickPickItem(remotes, {
|
||||||
type: 'commit',
|
type: 'commit',
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
import { Arrays, Iterables, Strings } from '../system';
|
import { Iterables, Strings } from '../system';
|
||||||
import { QuickPickItem, QuickPickOptions, Uri, window } from 'vscode';
|
import { QuickPickItem, QuickPickOptions, Uri, window } from 'vscode';
|
||||||
import { Commands, CopyMessageToClipboardCommandArgs, CopyShaToClipboardCommandArgs, DiffWithPreviousCommandArgs, DiffWithWorkingCommandArgs, ShowQuickCommitDetailsCommandArgs, ShowQuickCommitFileDetailsCommandArgs, ShowQuickFileHistoryCommandArgs } from '../commands';
|
import { Commands, CopyMessageToClipboardCommandArgs, CopyShaToClipboardCommandArgs, DiffWithPreviousCommandArgs, DiffWithWorkingCommandArgs, ShowQuickCommitDetailsCommandArgs, ShowQuickCommitFileDetailsCommandArgs, ShowQuickFileHistoryCommandArgs } from '../commands';
|
||||||
import { CommandQuickPickItem, getQuickPickIgnoreFocusOut, KeyCommandQuickPickItem, OpenFileCommandQuickPickItem } from './common';
|
import { CommandQuickPickItem, getQuickPickIgnoreFocusOut, KeyCommandQuickPickItem, OpenFileCommandQuickPickItem } from './common';
|
||||||
@@ -125,7 +125,7 @@ export class CommitFileDetailsQuickPick {
|
|||||||
}
|
}
|
||||||
items.push(new OpenCommitFileRevisionCommandQuickPickItem(commit));
|
items.push(new OpenCommitFileRevisionCommandQuickPickItem(commit));
|
||||||
|
|
||||||
const remotes = Arrays.uniqueBy(await git.getRemotes(commit.repoPath), _ => _.url, _ => !!_.provider);
|
const remotes = (await git.getRemotes(commit.repoPath)).filter(r => r.provider !== undefined);
|
||||||
if (remotes.length) {
|
if (remotes.length) {
|
||||||
if (commit.workingFileName && commit.status !== 'D') {
|
if (commit.workingFileName && commit.status !== 'D') {
|
||||||
const branch = await git.getBranch(commit.repoPath || git.repoPath);
|
const branch = await git.getBranch(commit.repoPath || git.repoPath);
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
import { Arrays, Iterables, Strings } from '../system';
|
import { Iterables, Strings } from '../system';
|
||||||
import { CancellationTokenSource, QuickPickOptions, Uri, window } from 'vscode';
|
import { CancellationTokenSource, QuickPickOptions, Uri, window } from 'vscode';
|
||||||
import { Commands, ShowQuickCurrentBranchHistoryCommandArgs, ShowQuickFileHistoryCommandArgs } from '../commands';
|
import { Commands, ShowQuickCurrentBranchHistoryCommandArgs, ShowQuickFileHistoryCommandArgs } from '../commands';
|
||||||
import { CommandQuickPickItem, CommitQuickPickItem, getQuickPickIgnoreFocusOut, showQuickPickProgress } from './common';
|
import { CommandQuickPickItem, CommitQuickPickItem, getQuickPickIgnoreFocusOut, showQuickPickProgress } from './common';
|
||||||
@@ -136,7 +136,7 @@ export class FileHistoryQuickPick {
|
|||||||
]));
|
]));
|
||||||
}
|
}
|
||||||
|
|
||||||
const remotes = Arrays.uniqueBy(await git.getRemotes(uri.repoPath!), _ => _.url, _ => !!_.provider);
|
const remotes = (await git.getRemotes(uri.repoPath!)).filter(r => r.provider !== undefined);
|
||||||
if (remotes.length) {
|
if (remotes.length) {
|
||||||
items.splice(index++, 0, new OpenRemotesCommandQuickPickItem(remotes, {
|
items.splice(index++, 0, new OpenRemotesCommandQuickPickItem(remotes, {
|
||||||
type: 'revision',
|
type: 'revision',
|
||||||
|
|||||||
@@ -1,6 +1,15 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
export namespace Arrays {
|
export namespace Arrays {
|
||||||
|
export function groupBy<T>(array: T[], accessor: (item: T) => any): T[] {
|
||||||
|
return array.reduce((previous, current) => {
|
||||||
|
const value = accessor(current);
|
||||||
|
previous[value] = previous[value] || [];
|
||||||
|
previous[value].push(current);
|
||||||
|
return previous;
|
||||||
|
}, Object.create(null));
|
||||||
|
}
|
||||||
|
|
||||||
export function uniqueBy<T>(array: T[], accessor: (item: T) => any, predicate?: (item: T) => boolean): T[] {
|
export function uniqueBy<T>(array: T[], accessor: (item: T) => any, predicate?: (item: T) => boolean): T[] {
|
||||||
const uniqueValues = Object.create(null);
|
const uniqueValues = Object.create(null);
|
||||||
return array.filter(_ => {
|
return array.filter(_ => {
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ export class BranchHistoryNode extends ExplorerNode {
|
|||||||
const log = await this.git.getLogForRepo(this.uri.repoPath!, this.branch.name, this.maxCount);
|
const log = await this.git.getLogForRepo(this.uri.repoPath!, this.branch.name, this.maxCount);
|
||||||
if (log === undefined) return [];
|
if (log === undefined) return [];
|
||||||
|
|
||||||
const children = 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, this.branch));
|
||||||
if (!log.truncated) return [...children];
|
if (!log.truncated) return [...children];
|
||||||
|
|
||||||
return [...children, new ShowAllCommitsNode(this, this.context)];
|
return [...children, new ShowAllCommitsNode(this, this.context)];
|
||||||
|
|||||||
@@ -2,14 +2,14 @@
|
|||||||
import { Command, ExtensionContext, TreeItem, TreeItemCollapsibleState, Uri } from 'vscode';
|
import { Command, ExtensionContext, TreeItem, TreeItemCollapsibleState, Uri } from 'vscode';
|
||||||
import { Commands, DiffWithPreviousCommandArgs } from '../commands';
|
import { Commands, DiffWithPreviousCommandArgs } from '../commands';
|
||||||
import { ExplorerNode, ResourceType } from './explorerNode';
|
import { ExplorerNode, ResourceType } from './explorerNode';
|
||||||
import { getGitStatusIcon, GitCommit, GitService, GitUri, IGitStatusFile, StatusFileFormatter } from '../gitService';
|
import { getGitStatusIcon, GitBranch, GitCommit, GitService, GitUri, IGitStatusFile, StatusFileFormatter } from '../gitService';
|
||||||
import * as path from 'path';
|
import * as path from 'path';
|
||||||
|
|
||||||
export class CommitFileNode extends ExplorerNode {
|
export class CommitFileNode extends ExplorerNode {
|
||||||
|
|
||||||
readonly resourceType: ResourceType = 'gitlens:commit-file';
|
readonly resourceType: ResourceType = 'gitlens:commit-file';
|
||||||
|
|
||||||
constructor(public readonly status: IGitStatusFile, public commit: GitCommit, protected readonly context: ExtensionContext, protected readonly git: GitService) {
|
constructor(public readonly status: IGitStatusFile, public commit: GitCommit, protected readonly context: ExtensionContext, protected readonly git: GitService, public readonly branch?: GitBranch) {
|
||||||
super(new GitUri(Uri.file(path.resolve(commit.repoPath, status.fileName)), { repoPath: commit.repoPath, fileName: status.fileName, sha: commit.sha }));
|
super(new GitUri(Uri.file(path.resolve(commit.repoPath, status.fileName)), { repoPath: commit.repoPath, fileName: status.fileName, sha: commit.sha }));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,14 +4,14 @@ import { Command, ExtensionContext, TreeItem, TreeItemCollapsibleState } from 'v
|
|||||||
import { Commands, DiffWithPreviousCommandArgs } from '../commands';
|
import { Commands, DiffWithPreviousCommandArgs } from '../commands';
|
||||||
import { CommitFileNode } from './commitFileNode';
|
import { CommitFileNode } from './commitFileNode';
|
||||||
import { ExplorerNode, ResourceType } from './explorerNode';
|
import { ExplorerNode, ResourceType } from './explorerNode';
|
||||||
import { CommitFormatter, getGitStatusIcon, GitLogCommit, GitService, GitUri, ICommitFormatOptions } from '../gitService';
|
import { CommitFormatter, getGitStatusIcon, GitBranch, GitLogCommit, GitService, GitUri, ICommitFormatOptions } from '../gitService';
|
||||||
import * as path from 'path';
|
import * as path from 'path';
|
||||||
|
|
||||||
export class CommitNode extends ExplorerNode {
|
export class CommitNode extends ExplorerNode {
|
||||||
|
|
||||||
readonly resourceType: ResourceType = 'gitlens:commit';
|
readonly resourceType: ResourceType = 'gitlens:commit';
|
||||||
|
|
||||||
constructor(public readonly commit: GitLogCommit, private readonly template: string, protected readonly context: ExtensionContext, protected readonly git: GitService) {
|
constructor(public readonly commit: GitLogCommit, private readonly template: string, protected readonly context: ExtensionContext, protected readonly git: GitService, public readonly branch?: GitBranch) {
|
||||||
super(new GitUri(commit.uri, commit));
|
super(new GitUri(commit.uri, commit));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -24,7 +24,7 @@ export class CommitNode extends ExplorerNode {
|
|||||||
const commit = Iterables.first(log.commits.values());
|
const commit = Iterables.first(log.commits.values());
|
||||||
if (commit === undefined) return [];
|
if (commit === undefined) return [];
|
||||||
|
|
||||||
return [...Iterables.map(commit.fileStatuses, s => new CommitFileNode(s, commit, this.context, this.git))];
|
return [...Iterables.map(commit.fileStatuses, s => new CommitFileNode(s, commit, this.context, this.git, this.branch))];
|
||||||
}
|
}
|
||||||
|
|
||||||
getTreeItem(): TreeItem {
|
getTreeItem(): TreeItem {
|
||||||
|
|||||||
@@ -73,8 +73,8 @@ export class PagerNode extends ExplorerNode {
|
|||||||
item.contextValue = this.resourceType;
|
item.contextValue = this.resourceType;
|
||||||
item.command = this.getCommand();
|
item.command = this.getCommand();
|
||||||
item.iconPath = {
|
item.iconPath = {
|
||||||
dark: this.context.asAbsolutePath('images/dark/icon-sync.svg'),
|
dark: this.context.asAbsolutePath('images/dark/icon-unfold.svg'),
|
||||||
light: this.context.asAbsolutePath('images/light/icon-sync.svg')
|
light: this.context.asAbsolutePath('images/light/icon-unfold.svg')
|
||||||
};
|
};
|
||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
import { Functions, Objects } from '../system';
|
import { Functions, Objects } from '../system';
|
||||||
import { commands, Event, EventEmitter, ExtensionContext, TextDocumentShowOptions, TextEditor, TreeDataProvider, TreeItem, Uri, window, workspace } from 'vscode';
|
import { commands, Event, EventEmitter, ExtensionContext, TextDocumentShowOptions, TextEditor, TreeDataProvider, TreeItem, Uri, window, workspace } from 'vscode';
|
||||||
import { Commands, DiffWithPreviousCommandArgs, DiffWithWorkingCommandArgs, openEditor, OpenFileInRemoteCommandArgs } from '../commands';
|
import { Commands, DiffWithCommandArgs, DiffWithCommandArgsRevision, DiffWithPreviousCommandArgs, DiffWithWorkingCommandArgs, openEditor, OpenFileInRemoteCommandArgs } from '../commands';
|
||||||
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';
|
||||||
@@ -49,6 +49,8 @@ export class GitExplorer implements TreeDataProvider<ExplorerNode> {
|
|||||||
commands.registerCommand('gitlens.gitExplorer.openFileRevision', this.openFileRevision, this);
|
commands.registerCommand('gitlens.gitExplorer.openFileRevision', this.openFileRevision, this);
|
||||||
commands.registerCommand('gitlens.gitExplorer.openFileRevisionInRemote', this.openFileRevisionInRemote, this);
|
commands.registerCommand('gitlens.gitExplorer.openFileRevisionInRemote', this.openFileRevisionInRemote, this);
|
||||||
commands.registerCommand('gitlens.gitExplorer.openChangedFiles', this.openChangedFiles, this);
|
commands.registerCommand('gitlens.gitExplorer.openChangedFiles', this.openChangedFiles, this);
|
||||||
|
commands.registerCommand('gitlens.gitExplorer.openChangedFileChanges', this.openChangedFileChanges, this);
|
||||||
|
commands.registerCommand('gitlens.gitExplorer.openChangedFileChangesWithWorking', this.openChangedFileChangesWithWorking, this);
|
||||||
commands.registerCommand('gitlens.gitExplorer.openChangedFileRevisions', this.openChangedFileRevisions, this);
|
commands.registerCommand('gitlens.gitExplorer.openChangedFileRevisions', this.openChangedFileRevisions, this);
|
||||||
commands.registerCommand('gitlens.gitExplorer.applyChanges', this.applyChanges, this);
|
commands.registerCommand('gitlens.gitExplorer.applyChanges', this.applyChanges, this);
|
||||||
|
|
||||||
@@ -190,6 +192,29 @@ export class GitExplorer implements TreeDataProvider<ExplorerNode> {
|
|||||||
return openEditor(options.uri || GitService.toGitContentUri(node.uri), options.showOptions || { preserveFocus: true, preview: false });
|
return openEditor(options.uri || GitService.toGitContentUri(node.uri), options.showOptions || { preserveFocus: true, preview: false });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private async openChangedFileChanges(node: CommitNode | StashNode, options: TextDocumentShowOptions = { preserveFocus: false, preview: false }) {
|
||||||
|
const repoPath = node.commit.repoPath;
|
||||||
|
const uris = node.commit.fileStatuses
|
||||||
|
.map(s => GitUri.fromFileStatus(s, repoPath));
|
||||||
|
for (const uri of uris) {
|
||||||
|
await this.openDiffWith(repoPath,
|
||||||
|
{ uri: uri, sha: node.commit.previousSha !== undefined ? node.commit.previousSha : GitService.fakeSha },
|
||||||
|
{ uri: uri, sha: node.commit.sha }, options);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private async openChangedFileChangesWithWorking(node: CommitNode | StashNode, options: TextDocumentShowOptions = { preserveFocus: false, preview: false }) {
|
||||||
|
const repoPath = node.commit.repoPath;
|
||||||
|
const uris = node.commit.fileStatuses
|
||||||
|
.filter(s => s.status !== 'D')
|
||||||
|
.map(s => GitUri.fromFileStatus(s, repoPath));
|
||||||
|
for (const uri of uris) {
|
||||||
|
await this.openDiffWith(repoPath,
|
||||||
|
{ uri: uri, sha: node.commit.sha },
|
||||||
|
{ uri: uri, sha: '' }, options);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private async openChangedFiles(node: CommitNode | StashNode, options: TextDocumentShowOptions = { preserveFocus: false, preview: false }) {
|
private async openChangedFiles(node: CommitNode | StashNode, options: TextDocumentShowOptions = { preserveFocus: false, preview: false }) {
|
||||||
const repoPath = node.commit.repoPath;
|
const repoPath = node.commit.repoPath;
|
||||||
const uris = node.commit.fileStatuses.filter(s => s.status !== 'D').map(s => GitUri.fromFileStatus(s, repoPath));
|
const uris = node.commit.fileStatuses.filter(s => s.status !== 'D').map(s => GitUri.fromFileStatus(s, repoPath));
|
||||||
@@ -207,6 +232,16 @@ export class GitExplorer implements TreeDataProvider<ExplorerNode> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private async openDiffWith(repoPath: string, lhs: DiffWithCommandArgsRevision, rhs: DiffWithCommandArgsRevision, options: TextDocumentShowOptions = { preserveFocus: false, preview: false }) {
|
||||||
|
const diffArgs: DiffWithCommandArgs = {
|
||||||
|
repoPath: repoPath,
|
||||||
|
lhs: lhs,
|
||||||
|
rhs: rhs,
|
||||||
|
showOptions: options
|
||||||
|
};
|
||||||
|
return commands.executeCommand(Commands.DiffWith, diffArgs);
|
||||||
|
}
|
||||||
|
|
||||||
private async openFileRevisionInRemote(node: CommitNode | StashNode) {
|
private async openFileRevisionInRemote(node: CommitNode | StashNode) {
|
||||||
return commands.executeCommand(Commands.OpenFileInRemote, new GitUri(node.commit.uri, node.commit), { range: false } as OpenFileInRemoteCommandArgs);
|
return commands.executeCommand(Commands.OpenFileInRemote, new GitUri(node.commit.uri, node.commit), { range: false } as OpenFileInRemoteCommandArgs);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
import { Iterables } from '../system';
|
import { Iterables } from '../system';
|
||||||
import { ExtensionContext, TreeItem, TreeItemCollapsibleState } from 'vscode';
|
import { ExtensionContext, TreeItem, TreeItemCollapsibleState } from 'vscode';
|
||||||
import { BranchHistoryNode } from './branchHistoryNode';
|
import { BranchHistoryNode } from './branchHistoryNode';
|
||||||
|
import { GlyphChars } from '../constants';
|
||||||
import { ExplorerNode, ResourceType } from './explorerNode';
|
import { ExplorerNode, ResourceType } from './explorerNode';
|
||||||
import { GitRemote, GitService, GitUri } from '../gitService';
|
import { GitRemote, GitService, GitUri } from '../gitService';
|
||||||
|
|
||||||
@@ -22,7 +23,26 @@ export class RemoteNode extends ExplorerNode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getTreeItem(): TreeItem {
|
getTreeItem(): TreeItem {
|
||||||
const item = new TreeItem(this.remote.name, TreeItemCollapsibleState.Collapsed);
|
const fetch = this.remote.types.includes('push');
|
||||||
|
const push = this.remote.types.includes('push');
|
||||||
|
|
||||||
|
let separator;
|
||||||
|
if (fetch && push) {
|
||||||
|
separator = GlyphChars.ArrowLeftRight;
|
||||||
|
}
|
||||||
|
else if (fetch) {
|
||||||
|
separator = GlyphChars.ArrowLeft;
|
||||||
|
}
|
||||||
|
else if (push) {
|
||||||
|
separator = GlyphChars.ArrowRight;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
separator = GlyphChars.Dash;
|
||||||
|
}
|
||||||
|
|
||||||
|
const label = `${this.remote.name} ${GlyphChars.Space}${separator}${GlyphChars.Space} ${(this.remote.provider !== undefined) ? this.remote.provider.name : this.remote.domain} ${GlyphChars.Space}${GlyphChars.Dot}${GlyphChars.Space} ${this.remote.path}`;
|
||||||
|
|
||||||
|
const item = new TreeItem(label, TreeItemCollapsibleState.Collapsed);
|
||||||
item.contextValue = this.resourceType;
|
item.contextValue = this.resourceType;
|
||||||
|
|
||||||
// item.iconPath = {
|
// item.iconPath = {
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
import { Arrays, Iterables } from '../system';
|
import { Iterables } from '../system';
|
||||||
import { ExtensionContext, TreeItem, TreeItemCollapsibleState } from 'vscode';
|
import { ExtensionContext, TreeItem, TreeItemCollapsibleState } from 'vscode';
|
||||||
import { ExplorerNode, MessageNode, ResourceType } from './explorerNode';
|
import { ExplorerNode, MessageNode, ResourceType } from './explorerNode';
|
||||||
import { GitService, GitUri } from '../gitService';
|
import { GitService, GitUri } from '../gitService';
|
||||||
@@ -14,7 +14,7 @@ export class RemotesNode extends ExplorerNode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async getChildren(): Promise<ExplorerNode[]> {
|
async getChildren(): Promise<ExplorerNode[]> {
|
||||||
const remotes = Arrays.uniqueBy(await this.git.getRemotes(this.uri.repoPath!), r => r.url, r => !!r.provider);
|
const remotes = await this.git.getRemotes(this.uri.repoPath!);
|
||||||
if (remotes === undefined || remotes.length === 0) return [new MessageNode('No remotes configured')];
|
if (remotes === undefined || remotes.length === 0) return [new MessageNode('No remotes configured')];
|
||||||
|
|
||||||
remotes.sort((a, b) => a.name.localeCompare(b.name));
|
remotes.sort((a, b) => a.name.localeCompare(b.name));
|
||||||
|
|||||||
Reference in New Issue
Block a user