Ver a proveniência

Adds rich tooltips to views

Fixes duplicate upstream node issue
Fixes results explorer node refreshing
main
Eric Amodio há 6 anos
ascendente
cometimento
249474139e
31 ficheiros alterados com 449 adições e 191 eliminações
  1. +84
    -72
      CHANGELOG.md
  2. +3
    -3
      README.md
  3. +12
    -7
      package.json
  4. +5
    -5
      src/annotations/annotations.ts
  5. +1
    -1
      src/commands/diffWith.ts
  6. +12
    -3
      src/constants.ts
  7. +14
    -4
      src/git/formatters/commitFormatter.ts
  8. +8
    -2
      src/git/formatters/statusFormatter.ts
  9. +1
    -1
      src/git/git.ts
  10. +8
    -0
      src/git/gitUri.ts
  11. +20
    -0
      src/git/models/branch.ts
  12. +108
    -10
      src/git/models/status.ts
  13. +15
    -16
      src/git/parsers/statusParser.ts
  14. +1
    -1
      src/quickPicks/repoStatusQuickPick.ts
  15. +1
    -0
      src/views/branchFolderNode.ts
  16. +19
    -15
      src/views/branchNode.ts
  17. +26
    -1
      src/views/commitFileNode.ts
  18. +10
    -0
      src/views/commitNode.ts
  19. +1
    -2
      src/views/commitResultsNode.ts
  20. +2
    -10
      src/views/comparisonResultsNode.ts
  21. +3
    -1
      src/views/explorerNode.ts
  22. +1
    -0
      src/views/fileHistoryNode.ts
  23. +1
    -0
      src/views/folderNode.ts
  24. +2
    -1
      src/views/remoteNode.ts
  25. +8
    -0
      src/views/stashNode.ts
  26. +48
    -7
      src/views/statusFileCommitsNode.ts
  27. +4
    -3
      src/views/statusFileNode.ts
  28. +1
    -1
      src/views/statusFilesNode.ts
  29. +10
    -8
      src/views/statusFilesResultsNode.ts
  30. +17
    -14
      src/views/statusNode.ts
  31. +3
    -3
      src/views/statusUpstreamNode.ts

+ 84
- 72
CHANGELOG.md Ver ficheiro

@ -6,20 +6,32 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
## [Unreleased]
### Added
- Adds rich tooltip details to most nodes in the **GitLens** explorer and **GitLens Results** view
- Adds an indicator to the *GitLens* explorer branch history to mark the synchronization point between the local and remote branch (if available)
- Adds `${agoOrDate}` and `${authorAgoOrDate}` tokens to `gitlens.blame.format`, `gitlens.currentLine.format`, `gitlens.explorers.commitFormat`, `gitlens.explorers.stashFormat`, and `gitlens.statusBar.format` settings which will honor the `gitlens.defaultDateStyle` setting — closes [#312](https://github.com/eamodio/vscode-gitlens/issues/312)
- Adds `gitlens.currentLine.scrollable` setting to specify whether the current line blame annotation can be scrolled into view when it is outside the viewport — closes [#149](https://github.com/eamodio/vscode-gitlens/issues/149), [#290](https://github.com/eamodio/vscode-gitlens/issues/290), [#265](https://github.com/eamodio/vscode-gitlens/issues/265)
- Adds *Copy Commit ID to Clipboard* (`gitlens.copyShaToClipboard`) command to changed file nodes in the **GitLens** explorer and **GitLens Results** view
- Adds *Copy Commit Message to Clipboard* (`gitlens.copyMessageToClipboard`) command to changed file nodes in the **GitLens** explorer and **GitLens Results** view
### Changed
- Renames *Compare with Index (HEAD)* (`gitlens.explorers.compareWithHead`) command to *Compare with HEAD* — closes [#309](https://github.com/eamodio/vscode-gitlens/issues/309)
- Renames *Compare Index (HEAD) with Branch or Tag...* (`gitlens.diffHeadWithBranch`) command to *Compare HEAD with Branch or Tag...* — closes [#309](https://github.com/eamodio/vscode-gitlens/issues/309)
### Removed
- Removes the unnecessary *Show File Blame Annotations* (`gitlens.showFileBlame`) command — *Toggle File Blame Annotations* (`gitlens.toggleFileBlame`) provides similar functionality
- Removes the unnecessary *Show Line Blame Annotations* (`gitlens.showLineBlame`) command — *Toggle Line Blame Annotations* (`gitlens.toggleLineBlame`) provides similar functionality
- Removes the *Open Working File* command from the editor toolbar when the built-in *Open File* command is visible
- Removes *Open Working File* command from the editor toolbar when the built-in *Open File* command is visible
- Removes *Compare with HEAD* (`gitlens.explorers.compareWithHead`) command from the current branch since comparing with itself doesn't make sense — closes [#309](https://github.com/eamodio/vscode-gitlens/issues/309)
- Removes *Compare with Working Tree* (`gitlens.explorers.compareWithWorking`) command from the current branch since comparing with itself doesn't make sense — closes [#309](https://github.com/eamodio/vscode-gitlens/issues/309)
- Removes *Compare Compare Ancestry with Working Tree* (`gitlens.explorers.compareAncestryWithWorking`) command from the current branch since comparing with itself doesn't make sense — closes [#309](https://github.com/eamodio/vscode-gitlens/issues/309)
### Fixed
- Fixes [#314](https://github.com/eamodio/vscode-gitlens/issues/314) - Toggle line annotation doesn't work properly
- Fixes [#310](https://github.com/eamodio/vscode-gitlens/issues/310) - "via Terminal" commands need quoting around work directory
- Fixes issues with the active repository in the *GitLens* explorer failed to update properly
- Fixes issues with *Open File*, *Open Revision*, *Show File History* commands and images and other binary files
- Fixes issues with *Open File*, *Open Revision*, and *Show File History* commands and images and other binary files
- Fixes issues preventing nodes in the **GitLens** explorer to expand properly in certain cases
- Fixes issues when refreshing nodes in the **GitLens Results** view
## [8.1.1] - 2018-03-12
### Fixed
@ -227,14 +239,14 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
- Adds `gitlens.annotations.file.gutter.gravatars` setting to specify whether to show gravatar images in the gutter blame annotations
- Adds support for providing blame annotations, code lens, etc on files with unsaved changes — closes [#112](https://github.com/eamodio/vscode-gitlens/issues/112)
- Adds `gitlens.defaultDateStyle` setting to specify how dates will be displayed by default — closes [#89](https://github.com/eamodio/vscode-gitlens/issues/89)
- Adds *Compare with Working Tree* command (`gitlens.explorers.compareWithWorking`) to branch, tag, and revision (commit) nodes in the **GitLens** view to compare the current selection with the current working tree in the **GitLens Results** view
- Adds *Compare Selected Ancestor with Working Tree* command (`gitlens.explorers.compareSelectedAncestorWithWorking`) to branch nodes in the **GitLens** view once another branch within the same repository has been selected to compare the [merge base](https://git-scm.com/docs/git-merge-base) of current and previously selected branches with the working tree in the **GitLens Results** view — closes [#240](https://github.com/eamodio/vscode-gitlens/issues/240)
- Adds *Merge Branch (via Terminal)* command (`gitlens.explorers.terminalMergeBranch`) to branch nodes in the **GitLens** view
- Adds *Rebase (Interactive) Branch (via Terminal)* command (`gitlens.explorers.terminalRebaseBranch`) to branch nodes in the **GitLens** view
- Adds *Cherry Pick Commit (via Terminal)* command (`gitlens.explorers.terminalRebaseBranch`) to revision (commit) nodes in the **GitLens** & **GitLens Results** views
- Adds *Revert Commit (via Terminal)* command (`gitlens.explorers.terminalRevertCommit`) to revision (commit) nodes in the **GitLens** & **GitLens Results** views
- Adds *Create Tag (via Terminal)...* command (`gitlens.explorers.terminalCreateTag`) to branch and revision (commit) nodes in the **GitLens** & **GitLens Results** views
- Adds *Delete Tag (via Terminal)* command (`gitlens.explorers.terminalDeleteTag`) to tag nodes in the **GitLens** view
- Adds *Compare with Working Tree* command (`gitlens.explorers.compareWithWorking`) to branch, tag, and revision (commit) nodes in the **GitLens** explorer to compare the current selection with the current working tree in the **GitLens Results** view
- Adds *Compare Selected Ancestor with Working Tree* command (`gitlens.explorers.compareSelectedAncestorWithWorking`) to branch nodes in the **GitLens** explorer once another branch within the same repository has been selected to compare the [merge base](https://git-scm.com/docs/git-merge-base) of current and previously selected branches with the working tree in the **GitLens Results** view — closes [#240](https://github.com/eamodio/vscode-gitlens/issues/240)
- Adds *Merge Branch (via Terminal)* command (`gitlens.explorers.terminalMergeBranch`) to branch nodes in the **GitLens** explorer
- Adds *Rebase (Interactive) Branch (via Terminal)* command (`gitlens.explorers.terminalRebaseBranch`) to branch nodes in the **GitLens** explorer
- Adds *Cherry Pick Commit (via Terminal)* command (`gitlens.explorers.terminalRebaseBranch`) to revision (commit) nodes in the **GitLens** explorer and **GitLens Results** view
- Adds *Revert Commit (via Terminal)* command (`gitlens.explorers.terminalRevertCommit`) to revision (commit) nodes in the **GitLens** explorer and **GitLens Results** view
- Adds *Create Tag (via Terminal)...* command (`gitlens.explorers.terminalCreateTag`) to branch and revision (commit) nodes in the **GitLens** explorer and **GitLens Results** view
- Adds *Delete Tag (via Terminal)* command (`gitlens.explorers.terminalDeleteTag`) to tag nodes in the **GitLens** explorer
- Adds a helpful notification the first time the **GitLens Results** view is shown
### Changed
@ -250,11 +262,11 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
- Fixes issue where the **GitLens Results** view wouldn't properly update when replacing existing results
- Fixes issue where showing commit search (file-based) results in the **GitLens Results** view wouldn't only show the matching files — closes [#197](https://github.com/eamodio/vscode-gitlens/issues/197)
- Fixes [#238](https://github.com/eamodio/vscode-gitlens/issues/238) - Show merge commits in file history
- Fixes issue where the Tags node of the **GitLens** view wasn't updated on changes
- Fixes issue where the Tags node of the **GitLens** explorer wasn't updated on changes
- Fixes issue where changes to .gitignore weren't detected properly
- Fixes [#241](https://github.com/eamodio/vscode-gitlens/issues/241) - Adds default setting for .jsonc files to match Git code lens of .json files
- Fixes issue where blame annotations and commands were missing from vscode Git staged revision documents
- Fixes issue where opening changes for renamed files in the **GitLens** and **GitLens Results** views wouldn't work properly
- Fixes issue where opening changes for renamed files in the **GitLens** explorer and **GitLens Results** view wouldn't work properly
- Fixes issue where file-specific menu commands show up on folders in the explorer
## [7.2.0] - 2018-01-01
@ -265,8 +277,8 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
- Adds *Toggle File Heatmap Annotations* command (`gitlens.toggleFileHeatmap`) to toggle the heatmap annotations on and off
- Adds semi-persistent results for commit operations, via the *Show Commit Details* command (`gitlens.showQuickCommitDetails`) in the **GitLens Results** view — closes [#237](https://github.com/eamodio/vscode-gitlens/issues/237)
- Adds *Show in Results* option to the commit details quick pick menu to show the commit in the **GitLens Results** view
- Adds *Compare with Index (HEAD)* command (`gitlens.explorers.compareWithHead`) to branch, tag, and revision (commit) nodes in the **GitLens** view to compare the current selection with the current index (HEAD) in the **GitLens Results** view
- Adds *Compare with Remote* command (`gitlens.explorers.compareWithRemote`) to branch nodes in the **GitLens** view to compare the current selection with its remote tracking branch in the **GitLens Results** view
- Adds *Compare with Index (HEAD)* command (`gitlens.explorers.compareWithHead`) to branch, tag, and revision (commit) nodes in the **GitLens** explorer to compare the current selection with the current index (HEAD) in the **GitLens Results** view
- Adds *Compare with Remote* command (`gitlens.explorers.compareWithRemote`) to branch nodes in the **GitLens** explorer to compare the current selection with its remote tracking branch in the **GitLens Results** view
### Changed
- Improves startup performance and reduces package size
@ -295,11 +307,11 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
## [7.0.0] - 2017-12-18
### Added
- Adds a new **Active Repository** node to the **Repository View** of the **GitLens** view — closes [#224](https://github.com/eamodio/vscode-gitlens/issues/224)
- Adds a new **Active Repository** node to the **Repository View** of the **GitLens** explorer — closes [#224](https://github.com/eamodio/vscode-gitlens/issues/224)
- Automatically updates to track the repository of the active editor
- Only visible if there is more than 1 repository within the workspace
- Adds a new **Tags** node to the **Repository View** of the **GitLens** view — closes [#234](https://github.com/eamodio/vscode-gitlens/issues/234)
- Adds a new **Tags** node to the **Repository View** of the **GitLens** explorer — closes [#234](https://github.com/eamodio/vscode-gitlens/issues/234)
- Provides a list of tags
- Expand each tag 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
@ -308,14 +320,14 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
- Provides a context menu on each tag with *Compare with Selected*, *Select for Compare*, *Open Directory Compare with Working Tree*, and *Refresh* commands
- Provides a context menu with a *Refresh* command
- Adds [Gravatar](https://en.gravatar.com/) support to the **GitLens** view
- Adds `gitlens.gitExplorer.gravatars` setting to specify whether to show gravatar images instead of commit (or status) icons in the **GitLens** view
- Adds `gitlens.gitExplorer.gravatarsDefault` setting to specify the style of the gravatar default (fallback) images in the **GitLens** view<br />`identicon` - a geometric pattern<br />`mm` - (mystery-man) a simple, cartoon-style silhouetted outline of a person (does not vary by email hash)<br />`monsterid` - a monster with different colors, faces, etc<br />`retro` - 8-bit arcade-style pixelated faces<br />`robohash` - a robot with different colors, faces, etc<br />`wavatar` - faces with differing features and backgrounds
- Adds [Gravatar](https://en.gravatar.com/) support to the **GitLens** explorer
- Adds `gitlens.gitExplorer.gravatars` setting to specify whether to show gravatar images instead of commit (or status) icons in the **GitLens** explorer
- Adds `gitlens.gitExplorer.gravatarsDefault` setting to specify the style of the gravatar default (fallback) images in the **GitLens** explorer<br />`identicon` - a geometric pattern<br />`mm` - (mystery-man) a simple, cartoon-style silhouetted outline of a person (does not vary by email hash)<br />`monsterid` - a monster with different colors, faces, etc<br />`retro` - 8-bit arcade-style pixelated faces<br />`robohash` - a robot with different colors, faces, etc<br />`wavatar` - faces with differing features and backgrounds
- Adds `gitlens.resultsExplorer.gravatars` setting to specify whether to show gravatar images instead of commit (or status) icons in the **GitLens Results** view
- Adds `gitlens.resultsExplorer.gravatarsDefault` setting to specify the style of the gravatar default (fallback) images in the **GitLens Results** view<br />`identicon` - a geometric pattern<br />`mm` - (mystery-man) a simple, cartoon-style silhouetted outline of a person (does not vary by email hash)<br />`monsterid` - a monster with different colors, faces, etc<br />`retro` - 8-bit arcade-style pixelated faces<br />`robohash` - a robot with different colors, faces, etc<br />`wavatar` - faces with differing features and backgrounds
- Adds *Select for Compare* command (`gitlens.explorers.selectForCompare`) to branch, remote branch, tag, and revision (commit) nodes in the **GitLens** view to mark the base reference of a comparison
- Adds *Compare with Selected* command (`gitlens.explorers.compareWithSelected`) to branch, remote branch, tag, and revision (commit) nodes in the **GitLens** view once another reference within the same repository has been selected to compare the current selection with the previously selected reference in the **GitLens Results** view
- Adds *Select for Compare* command (`gitlens.explorers.selectForCompare`) to branch, remote branch, tag, and revision (commit) nodes in the **GitLens** explorer to mark the base reference of a comparison
- Adds *Compare with Selected* command (`gitlens.explorers.compareWithSelected`) to branch, remote branch, tag, and revision (commit) nodes in the **GitLens** explorer once another reference within the same repository has been selected to compare the current selection with the previously selected reference in the **GitLens Results** view
- Adds an all-new, on-demand **GitLens Results** view to the Explorer activity
@ -350,7 +362,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
- Fixes [#228](https://github.com/eamodio/vscode-gitlens/issues/228) - Gutter blame spills over heatmap
- Fixes incorrect blame highlighting &mdash; thanks to [PR #231](https://github.com/eamodio/vscode-gitlens/pull/231) by Alexey Vasyukov ([@notmedia](https://github.com/notmedia))!
- Fixes issue with the *Open in File/Revision* option in the file history quick pick menu
- Fixes issues with Git warnings when parsing log status output (can cause the **GitLens** view to not show data in some cases)
- Fixes issues with Git warnings when parsing log status output (can cause the **GitLens** explorer to not show data in some cases)
- Fixes &#x1F91E; [#226](https://github.com/eamodio/vscode-gitlens/issues/226) - Annotations show in Debug Console
## [6.4.0] - 2017-12-12
@ -364,7 +376,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
### Changed
- Overhauls the internal way GitLens deals with Uris and revisions should be far more robust and lead to many fewer edge-case issues
- Aligns quick pick menu commands more with the **GitLens** view context menus
- Aligns quick pick menu commands more with the **GitLens** explorer context menus
### Fixed
- Fixes [#220](https://github.com/eamodio/vscode-gitlens/issues/220) - Open Revision quick pick results in empty file
@ -373,11 +385,11 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
## [6.3.0] - 2017-11-30
### Added
- Adds support for files with staged changes
- Adds new entry in the **History View** of the **GitLens** view
- Adds new entry in the **Repository View** of the **GitLens** view
- Adds new entry in the **History View** of the **GitLens** explorer
- Adds new entry in the **Repository View** of the **GitLens** explorer
- Adds blame annotations, navigation & comparison commands, etc
- Adds support for vscode's Git file revisions (e.g. *Open File (HEAD)*) and diffs (e.g. *Open Changes*)
- Adds new entry in the **History View** of the **GitLens** view
- Adds new entry in the **History View** of the **GitLens** explorer
- Adds blame annotations, navigation & comparison commands, etc
- Adds Git code lens to Git file revisions (GitLens or vscode's)
@ -437,14 +449,14 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
### Fixed
- Fixes issue where failed git commands would get stuck in the pending queue causing future similar commands to also fail
- Fixes issue where changes to git remotes would refresh the entire **GitLens** view
- Fixes issue where changes to git remotes would refresh the entire **GitLens** explorer
## [6.0.0] - 2017-11-08
### Added
- Adds multi-root workspace support &mdash; [Learn more](https://code.visualstudio.com/docs/editor/multi-root-workspaces)
- Adds new logo/icon
- Adds indicator dots on the branch node(s) of the **GitLens** view which denote the following:
- Adds indicator dots on the branch node(s) of the **GitLens** explorer which denote the following:
- *None* - no upstream or up-to-date with the upstream
- *Green* - ahead of the upstream
- *Red* - behind the upstream
@ -455,33 +467,33 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
- Use `=<regex>` to search for commits with differences that change the number of occurrences of the specified string (i.e. addition/deletion) in a file
- Adds support to the *Compare File with Branch...* command (`gitlens.diffWithBranch`) work with renamed files &mdash; closes [#165](https://github.com/eamodio/vscode-gitlens/issues/165)
- Adds *Compare File with Branch...* command (`gitlens.diffWithBranch`) to source control resource context menu
- Adds *Open Repository in Remote* command (`gitlens.openRepoInRemote`) to repository node(s) of the **GitLens** view
- Adds *Enable Automatic Refresh* command (`gitlens.gitExplorer.setAutoRefreshToOn`) to the **GitLens** view regardless of the current view
- Adds *Disable Automatic Refresh* command (`gitlens.gitExplorer.setAutoRefreshToOff`) to the **GitLens** view regardless of the current view
- Adds new Git terminal commands to the **GitLens** view - opens a **GitLens** terminal and sends the specified Git command to it
- Adds *Checkout Branch (via Terminal)* command (`gitlens.terminalCheckoutBranch`) to branch node(s) of the **GitLens** view
- Adds *Create Branch (via Terminal)...* command (`gitlens.terminalCreateBranch`) to branch node(s) of the **GitLens** view
- Adds *Delete Branch (via Terminal)* command (`gitlens.terminalDeleteBranch`) to branch node(s) of the **GitLens** view
- Adds *Rebase Branch to Remote (via Terminal)* command (`gitlens.terminalRebaseBranchToRemote`) to branch node(s) of the **GitLens** view
- Adds *Squash Branch into Commit (via Terminal)* command (`gitlens.terminalSquashBranchIntoCommit`) to branch node(s) of the **GitLens** view
- Adds *Rebase Commit (via Terminal)* command (`gitlens.terminalRebaseCommit`) to commit node(s) of the **GitLens** view
- Adds *Reset Commit (via Terminal)* command (`gitlens.terminalResetCommit`) to commit node(s) of the **GitLens** view
- Adds *Remove Remote (via Terminal)* command (`gitlens.terminalRemoveRemote`) to remote node(s) of the **GitLens** view
- Adds *Open Repository in Remote* command (`gitlens.openRepoInRemote`) to repository node(s) of the **GitLens** explorer
- Adds *Enable Automatic Refresh* command (`gitlens.gitExplorer.setAutoRefreshToOn`) to the **GitLens** explorer regardless of the current view
- Adds *Disable Automatic Refresh* command (`gitlens.gitExplorer.setAutoRefreshToOff`) to the **GitLens** explorer regardless of the current view
- Adds new Git terminal commands to the **GitLens** explorer - opens a **GitLens** terminal and sends the specified Git command to it
- Adds *Checkout Branch (via Terminal)* command (`gitlens.terminalCheckoutBranch`) to branch node(s) of the **GitLens** explorer
- Adds *Create Branch (via Terminal)...* command (`gitlens.terminalCreateBranch`) to branch node(s) of the **GitLens** explorer
- Adds *Delete Branch (via Terminal)* command (`gitlens.terminalDeleteBranch`) to branch node(s) of the **GitLens** explorer
- Adds *Rebase Branch to Remote (via Terminal)* command (`gitlens.terminalRebaseBranchToRemote`) to branch node(s) of the **GitLens** explorer
- Adds *Squash Branch into Commit (via Terminal)* command (`gitlens.terminalSquashBranchIntoCommit`) to branch node(s) of the **GitLens** explorer
- Adds *Rebase Commit (via Terminal)* command (`gitlens.terminalRebaseCommit`) to commit node(s) of the **GitLens** explorer
- Adds *Reset Commit (via Terminal)* command (`gitlens.terminalResetCommit`) to commit node(s) of the **GitLens** explorer
- Adds *Remove Remote (via Terminal)* command (`gitlens.terminalRemoveRemote`) to remote node(s) of the **GitLens** explorer
- Adds ability to specify the url protocol used with user-defined remote services via `gitlens.remotes` setting &mdash; thanks to [PR #192](https://github.com/eamodio/vscode-gitlens/pull/192) by Helmut Januschka ([@hjanuschka](https://github.com/hjanuschka))!
### Changed
- **GitLens** view will no longer show if there is no Git repository &mdash; closes [#159](https://github.com/eamodio/vscode-gitlens/issues/159)
- **GitLens** explorer will no longer show if there is no Git repository &mdash; closes [#159](https://github.com/eamodio/vscode-gitlens/issues/159)
- Optimizes event handling, executing git commands, and general processing to improve performance and reduce any lag
- Optimizes current line hover annotations to only be computed on hover (i.e. lazily evaluated) to reduce the compute required when changing lines
- Protects credentials from possibly being affected by poor network conditions via Git Credential Manager (GCM) for Windows environment variables
- Delays (slightly) the initial loading of the **GitLens** view to improve startup performance
- Delays (slightly) the initial loading of the **GitLens** explorer to improve startup performance
### Fixed
- Fixes jumpy code lens when deleting characters from a line with a Git code lens
- Fixes [#178](https://github.com/eamodio/vscode-gitlens/issues/178) - Slight but noticeable keyboard lag with Gitlens
- Fixes [#183](https://github.com/eamodio/vscode-gitlens/issues/183) - Remote with same url should only show once
- Fixes [#185](https://github.com/eamodio/vscode-gitlens/issues/185) - Wrong relative date shows on mouse hover
- Fixes issue where using the *Refresh* command on a **GitLens** view node refreshed the whole view, rather than just the node
- Fixes issue where using the *Refresh* command on a **GitLens** explorer node refreshed the whole view, rather than just the node
- Fixes issue where certain commands fail when there is no current branch (rebase, detached HEAD, etc)
## [5.7.1] - 2017-10-19
@ -492,12 +504,12 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
### Added
- Adds *Open All Changes (with difftool)* command (`gitlens.externalDiffAll`) - opens all working changes with the configured git difftool &mdash; closes [#164](https://github.com/eamodio/vscode-gitlens/issues/164)
- Also adds the command to the Source Control group context menu
- Adds `gitlens.gitExplorer.autoRefresh` setting to specify whether to automatically refresh the **GitLens** view when the repository or the file system changes
- Adds *Enable Automatic Refresh* command (`gitlens.gitExplorer.setAutoRefreshToOn`) to enable the automatic refresh of the **GitLens** view
- Adds *Disable Automatic Refresh* command (`gitlens.gitExplorer.setAutoRefreshToOff`) to disable the automatic refresh of the **GitLens** view
- Adds *Show Files in Automatic View* command (`gitlens.gitExplorer.setFilesLayoutToAuto`) to change to an automatic layout for the files in the **GitLens** view
- Adds *Show Files in List View* command (`gitlens.gitExplorer.setFilesLayoutToList`) to change to a list layout for the files in the **GitLens** view
- Adds *Show Files in Tree View* command (`gitlens.gitExplorer.setFilesLayoutToTree`) to change to a tree layout for the files in the **GitLens** view
- Adds `gitlens.gitExplorer.autoRefresh` setting to specify whether to automatically refresh the **GitLens** explorer when the repository or the file system changes
- Adds *Enable Automatic Refresh* command (`gitlens.gitExplorer.setAutoRefreshToOn`) to enable the automatic refresh of the **GitLens** explorer
- Adds *Disable Automatic Refresh* command (`gitlens.gitExplorer.setAutoRefreshToOff`) to disable the automatic refresh of the **GitLens** explorer
- Adds *Show Files in Automatic View* command (`gitlens.gitExplorer.setFilesLayoutToAuto`) to change to an automatic layout for the files in the **GitLens** explorer
- Adds *Show Files in List View* command (`gitlens.gitExplorer.setFilesLayoutToList`) to change to a list layout for the files in the **GitLens** explorer
- Adds *Show Files in Tree View* command (`gitlens.gitExplorer.setFilesLayoutToTree`) to change to a tree layout for the files in the **GitLens** explorer
### Changed
- Renames *Directory Compare* command (`gitlens.diffDirectory`) to *Compare Directory with Branch...*
@ -507,8 +519,8 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
### Fixed
- Fixes [#163](https://github.com/eamodio/vscode-gitlens/issues/163) - GitLens can cause git locking in the background
- Fixes issues tracking the active editor in the **History View** of the **GitLens** view
- Fixes issue where the **GitLens** view would refresh more than once when a file system change was detected
- Fixes issues tracking the active editor in the **History View** of the **GitLens** explorer
- Fixes issue where the **GitLens** explorer would refresh more than once when a file system change was detected
- Fixes issue where opening commit search could be filled out with `#00000000`
## [5.6.5] - 2017-10-16
@ -597,13 +609,13 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
## [5.3.0] - 2017-09-26
### Added
- Adds new file layouts to the **GitLens** view
- Adds new file layouts to the **GitLens** explorer
- `auto` - automatically switches between displaying files as a `tree` or `list` based on the `gitlens.gitExplorer.files.threshold` setting and the number of files at each nesting level
- `list` - displays files as a list
- `tree` - displays files as a tree
- Adds `gitlens.gitExplorer.files.layout` setting to specify how the **GitLens** view will display files
- Adds `gitlens.gitExplorer.files.compact` setting to specify whether to compact (flatten) unnecessary file nesting in the **GitLens** view
- Adds `gitlens.gitExplorer.files.threshold` setting to specify when to switch between displaying files as a `tree` or `list` based on the number of files in a nesting level in the **GitLens** view
- Adds `gitlens.gitExplorer.files.layout` setting to specify how the **GitLens** explorer will display files
- Adds `gitlens.gitExplorer.files.compact` setting to specify whether to compact (flatten) unnecessary file nesting in the **GitLens** explorer
- Adds `gitlens.gitExplorer.files.threshold` setting to specify when to switch between displaying files as a `tree` or `list` based on the number of files in a nesting level in the **GitLens** explorer
- Adds `${directory}` token to the file formatting settings
### Changed
@ -614,17 +626,17 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
## [5.2.0] - 2017-09-23
### Added
- Adds new **Changed Files** node to the **Repository Status** node of the **GitLens** view's **Repository View** &mdash; closes [#139](https://github.com/eamodio/vscode-gitlens/issues/139)
- Adds new **Changed Files** node to the **Repository Status** node of the **GitLens** explorer's **Repository View** &mdash; closes [#139](https://github.com/eamodio/vscode-gitlens/issues/139)
- Provides a at-a-glance view of all "working" changes
- Expands to a file-based view of all changed files in the working tree (enabled via `"gitlens.insiders": true`) and/or all files in all commits ahead of the upstream
- Adds optional (on by default) working tree status information to the **Repository Status** node in the **GitLens** view
- Adds optional (on by default) working tree status information to the **Repository Status** node in the **GitLens** explorer
- Adds `auto` value to `gitlens.gitExplorer.view` setting - closes [#150](https://github.com/eamodio/vscode-gitlens/issues/150)
- Adds `gitlens.gitExplorer.enabled` setting to specify whether to show the **GitLens** view - closes [#144](https://github.com/eamodio/vscode-gitlens/issues/144)
- Adds `gitlens.gitExplorer.includeWorkingTree` setting to specify whether to include working tree files inside the **Repository Status** node of the **GitLens** view
- Adds `gitlens.gitExplorer.statusFileFormat` setting to the format of the status of a working or committed file in the **GitLens** view
- Adds `gitlens.gitExplorer.enabled` setting to specify whether to show the **GitLens** explorer - closes [#144](https://github.com/eamodio/vscode-gitlens/issues/144)
- Adds `gitlens.gitExplorer.includeWorkingTree` setting to specify whether to include working tree files inside the **Repository Status** node of the **GitLens** explorer
- Adds `gitlens.gitExplorer.statusFileFormat` setting to the format of the status of a working or committed file in the **GitLens** explorer
### Changed
- Changes the sorting (now alphabetical) of files shown in the **GitLens** view
- Changes the sorting (now alphabetical) of files shown in the **GitLens** explorer
- Changes the default of the `gitlens.gitExplorer.view` setting to `auto`
- Changes the default of the `gitlens.gitExplorer.commitFormat` setting to add parentheses around the commit id
- Removes many menu items from `editor/title` & `editor/title/context` by default &mdash; can be re-enabled via the `gitlens.advanced.menus` setting
@ -647,12 +659,12 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
- Removes `gitlens.annotations.file.recentChanges.hover.wholeLine` setting as it didn't really make sense
### Fixed
- Fixes an issue where stashes with only untracked files would not show in the **Stashes** node of the **GitLens** view
- Fixes an issue where stashes with untracked files would not show its untracked files in the **GitLens** view
- Fixes an issue where stashes with only untracked files would not show in the **Stashes** node of the **GitLens** explorer
- Fixes an issue where stashes with untracked files would not show its untracked files in the **GitLens** explorer
## [5.0.0] - 2017-09-12
### Added
- Adds an all-new **GitLens** view to the Explorer activity
- Adds an all-new **GitLens** explorer to the Explorer activity
- **Repository View** - provides a full repository explorer
@ -721,16 +733,16 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
- 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 &mdash; can now stash a group of files
- Adds *Stash Changes* command (`gitlens.stashSave`) to the source control resource context menu &mdash; can now stash individual files (works with multi-select too!)
- Adds `gitlens.gitExplorer.view` setting to specify the starting view (mode) of the **GitLens** view
- Adds `gitlens.gitExplorer.showTrackingBranch` setting to specify whether to show the tracking branch when displaying local branches in the **GitLens** view
- Adds `gitlens.gitExplorer.commitFormat` setting to specify the format of committed changes in the **GitLens** view
- Adds `gitlens.gitExplorer.commitFileFormat` setting to specify the format of a committed file in the **GitLens** view
- Adds `gitlens.gitExplorer.stashFormat` setting to specify the format of stashed changes in the **GitLens** view
- Adds `gitlens.gitExplorer.stashFileFormat` setting to specify the format of a stashed file in the **GitLens** view
- Adds `gitlens.gitExplorer.view` setting to specify the starting view (mode) of the **GitLens** explorer
- Adds `gitlens.gitExplorer.showTrackingBranch` setting to specify whether to show the tracking branch when displaying local branches in the **GitLens** explorer
- Adds `gitlens.gitExplorer.commitFormat` setting to specify the format of committed changes in the **GitLens** explorer
- Adds `gitlens.gitExplorer.commitFileFormat` setting to specify the format of a committed file in the **GitLens** explorer
- Adds `gitlens.gitExplorer.stashFormat` setting to specify the format of stashed changes in the **GitLens** explorer
- Adds `gitlens.gitExplorer.stashFileFormat` setting to specify the format of a stashed file in the **GitLens** explorer
- Adds `${filePath}` token to file formatting settings
### Changed
- Changes *Show Stashed Changes* option icon in repository status quick pick menu to match the **GitLens** view
- Changes *Show Stashed Changes* option icon in repository status quick pick menu to match the **GitLens** explorer
- Changes *Stash Changes* option icon in stashed changes quick pick menu to a plus (+)
- Renames *Compare File with Previous* command (`gitlens.diffWithPrevious`) to *Compare File with Previous Revision*
- Renames *Compare File with Next Commit* command (`gitlens.diffWithNext`) to *Compare File with Next Revision*
@ -739,7 +751,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
- Renames *Compare Line Commit with Working Tree* command (`gitlens.diffLineWithWorking`) to *Compare Line Revision with Working*
### Removed
- Removes **Git Stashes** view - as it's functionality has been folded into the new **GitLens** view
- Removes **Git Stashes** view - as it's functionality has been folded into the new **GitLens** explorer
- Removes `gitlens.stashExplorer.stashFormat` setting
- Removes `gitlens.stashExplorer.stashFileFormat` setting
- Removes *Stash Unstaged Changes* option from stashed changes quick pick menu &mdash; didn't work as intended

+ 3
- 3
README.md Ver ficheiro

@ -129,7 +129,7 @@ The repository view provides a full Git repository explorer, which has the follo
- Context menus for each revision (commit) provide
- *Open Commit in Remote* (if available), *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*, *Compare with HEAD*, *Compare with Working Tree*, *Compare with Selected* (when available), *Select for Compare*, *Cherry Pick Commit (via Terminal)* (when available), *Push to Commit (via Terminal)* (when available), *Revert Commit (via Terminal)* (when available), *Rebase to Commit (via Terminal)* (when available), *Reset to Commit (via Terminal)* (when available), *Create Branch (via Terminal)...*, *Create Tag (via Terminal)...*, and *Refresh* commands
- Context menus for each changed file provide
- *Open Changes*, *Open Changes with Working File*, *Open File*, *Open Revision*, *Open File in Remote*, *Open Revision in Remote*, *Apply Changes*, and *Show Commit File Details* commands
- *Open Changes*, *Open Changes with Working File*, *Open File*, *Open Revision*, *Open File in Remote*, *Open Revision in Remote*, *Copy Commit ID to Clipboard*, *Copy Commit Message to Clipboard*, *Apply Changes*, and *Show Commit File Details* commands
- Inline toolbars for each changed file provide an *Open File* command
- **Remotes** &mdash; lists the remotes
@ -191,7 +191,7 @@ An on-demand, [customizable](#gitlens-results-view-settings "Jump to the GitLens
- Context menus for each revision (commit) provide
- *Open Commit in Remote* (if available), *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*, *Compare with HEAD*, *Compare with Working Tree*, *Compare with Selected* (when available), *Select for Compare*, *Cherry Pick Commit (via Terminal)* (when available), *Push to Commit (via Terminal)* (when available), *Revert Commit (via Terminal)* (when available), *Rebase to Commit (via Terminal)* (when available), *Reset to Commit (via Terminal)* (when available), *Create Branch (via Terminal)...*, *Create Tag (via Terminal)...*, and *Refresh* commands
- Context menus for each changed file provide
- *Open Changes*, *Open Changes with Working File*, *Open File*, *Open Revision*, *Open File in Remote*, *Open Revision in Remote*, *Apply Changes*, and *Show Commit File Details* commands
- *Open Changes*, *Open Changes with Working File*, *Open File*, *Open Revision*, *Open File in Remote*, *Open Revision in Remote*, *Copy Commit ID to Clipboard*, *Copy Commit Message to Clipboard*, *Apply Changes*, and *Show Commit File Details* commands
#### Compare
- Provides a semi-persistent results view for comparison operations
@ -211,7 +211,7 @@ An on-demand, [customizable](#gitlens-results-view-settings "Jump to the GitLens
- **Changed Files** &mdash; lists the files changed between the compared revisions (branches or commits)
- Expands to a file-based view of all changed files
- Context menus for each changed file provide
- *Open Changes*, *Open Changes with Working File*, *Open File*, *Open Revision*, *Open File in Remote*, *Open Revision in Remote*, *Apply Changes*, and *Show Commit File Details* commands
- *Open Changes*, *Open Changes with Working File*, *Open File*, *Open Revision*, *Open File in Remote*, *Open Revision in Remote*, *Copy Commit ID to Clipboard*, *Copy Commit Message to Clipboard*, *Apply Changes*, and *Show Commit File Details* commands
---
### Code Lens

+ 12
- 7
package.json Ver ficheiro

@ -2519,18 +2519,18 @@
},
{
"command": "gitlens.copyShaToClipboard",
"when": "viewItem =~ /gitlens:commit\\b/",
"group": "4_gitlens@1"
"when": "viewItem =~ /gitlens:(file:)?commit\\b/",
"group": "5_gitlens@1"
},
{
"command": "gitlens.copyMessageToClipboard",
"when": "viewItem =~ /gitlens:(commit|stash)\\b/",
"group": "4_gitlens@2"
"when": "viewItem =~ /gitlens:(file:)?(commit|stash)\\b/",
"group": "5_gitlens@2"
},
{
"command": "gitlens.showQuickCommitDetails",
"when": "viewItem =~ /gitlens:commit\\b/",
"group": "5_gitlens@1"
"group": "5_gitlens_1@1"
},
{
"command": "gitlens.explorers.terminalCherryPickCommit",
@ -2610,7 +2610,7 @@
{
"command": "gitlens.explorers.applyChanges",
"when": "viewItem == gitlens:file:commit",
"group": "5_gitlens@1"
"group": "5_gitlens_1@1"
},
{
"command": "gitlens.explorers.applyChanges",
@ -2689,7 +2689,12 @@
},
{
"command": "gitlens.gitExplorer.refreshNode",
"when": "view =~ /gitlens\\.(git|results)Explorer/ && viewItem =~ /gitlens:(?!file\\b)/",
"when": "view =~ /gitlens\\.gitExplorer/ && viewItem =~ /gitlens:(?!file\\b)/",
"group": "9_gitlens@1"
},
{
"command": "gitlens.resultsExplorer.refreshNode",
"when": "view =~ /gitlens\\.resultsExplorer/ && viewItem =~ /gitlens:(?!file\\b)/",
"group": "9_gitlens@1"
}
]

+ 5
- 5
src/annotations/annotations.ts Ver ficheiro

@ -42,7 +42,7 @@ export class Annotations {
}
private static getHoverCommandBar(commit: GitCommit, hasRemote: boolean, annotationType?: FileAnnotationType, line: number = 0) {
let commandBar = `[\`${GlyphChars.DoubleArrowLeft}\`](${DiffWithCommand.getMarkdownCommandArgs(commit)} "Open Changes") `;
let commandBar = `[\`${GlyphChars.MuchGreaterThan}\`](${DiffWithCommand.getMarkdownCommandArgs(commit)} "Open Changes") `;
if (commit.previousSha !== undefined) {
if (annotationType === FileAnnotationType.RecentChanges) {
@ -92,7 +92,7 @@ export class Annotations {
message = `\n\n> ${message}`;
}
else {
showCommitDetailsCommand = `\`${commit.shortSha || '00000000'}\``;
showCommitDetailsCommand = `\`${commit.shortSha === 'working' ? '00000000' : commit.shortSha}\``;
}
const markdown = new MarkdownString(`${showCommitDetailsCommand} &nbsp; ![](${commit.getGravatarUri(Container.config.defaultGravatarsStyle).toString()}) &nbsp;__${commit.author}__, ${commit.fromNow()} &nbsp; _(${commit.formatDate(dateFormat)})_ ${message}${commandBar}`);
@ -108,14 +108,14 @@ export class Annotations {
let message: string;
if (commit.isUncommitted) {
if (uri.sha !== undefined && GitService.isStagedUncommitted(uri.sha)) {
message = `[\`Changes\`](${DiffWithCommand.getMarkdownCommandArgs(commit)} "Open Changes") &nbsp; ${GlyphChars.Dash} &nbsp; [\`${commit.previousShortSha}\`](${ShowQuickCommitDetailsCommand.getMarkdownCommandArgs(commit.previousSha!)} "Show Commit Details") ${GlyphChars.ArrowLeftRight} _${uri.shortSha}_\n${codeDiff}`;
message = `[\`Changes\`](${DiffWithCommand.getMarkdownCommandArgs(commit)} "Open Changes") &nbsp; ${GlyphChars.Dash} &nbsp; [\`${commit.previousShortSha}\`](${ShowQuickCommitDetailsCommand.getMarkdownCommandArgs(commit.previousSha!)} "Show Commit Details") ${GlyphChars.ArrowLeftRightLong} _${uri.shortSha}_\n${codeDiff}`;
}
else {
message = `[\`Changes\`](${DiffWithCommand.getMarkdownCommandArgs(commit)} "Open Changes") &nbsp; ${GlyphChars.Dash} &nbsp; _uncommitted_\n${codeDiff}`;
message = `[\`Changes\`](${DiffWithCommand.getMarkdownCommandArgs(commit)} "Open Changes") &nbsp; ${GlyphChars.Dash} &nbsp; _uncommitted changes_\n${codeDiff}`;
}
}
else {
message = `[\`Changes\`](${DiffWithCommand.getMarkdownCommandArgs(commit)} "Open Changes") &nbsp; ${GlyphChars.Dash} &nbsp; [\`${commit.previousShortSha}\`](${ShowQuickCommitDetailsCommand.getMarkdownCommandArgs(commit.previousSha!)} "Show Commit Details") ${GlyphChars.ArrowLeftRight} [\`${commit.shortSha}\`](${ShowQuickCommitDetailsCommand.getMarkdownCommandArgs(commit.sha)} "Show Commit Details")\n${codeDiff}`;
message = `[\`Changes\`](${DiffWithCommand.getMarkdownCommandArgs(commit)} "Open Changes") &nbsp; ${GlyphChars.Dash} &nbsp; [\`${commit.previousShortSha}\`](${ShowQuickCommitDetailsCommand.getMarkdownCommandArgs(commit.previousSha!)} "Show Commit Details") ${GlyphChars.ArrowLeftRightLong} [\`${commit.shortSha}\`](${ShowQuickCommitDetailsCommand.getMarkdownCommandArgs(commit.sha)} "Show Commit Details")\n${codeDiff}`;
}
const markdown = new MarkdownString(message);

+ 1
- 1
src/commands/diffWith.ts Ver ficheiro

@ -134,7 +134,7 @@ export class DiffWithCommand extends ActiveEditorCommand {
}
const title = (args.lhs.title !== undefined && args.rhs.title !== undefined)
? `${args.lhs.title} ${GlyphChars.ArrowLeftRight} ${args.rhs.title}`
? `${args.lhs.title} ${GlyphChars.ArrowLeftRightLong} ${args.rhs.title}`
: args.lhs.title || args.rhs.title;
if (args.showOptions === undefined) {

+ 12
- 3
src/constants.ts Ver ficheiro

@ -79,20 +79,29 @@ export enum GlyphChars {
ArrowDropRight = '\u2937',
ArrowHeadRight = '\u27A4',
ArrowLeft = '\u2190',
ArrowLeftDouble = '\u21d0',
ArrowLeftRight = '\u2194',
ArrowLeftRightDouble = '\u21d4',
ArrowLeftRightDoubleStrike = '\u21ce',
ArrowLeftRightLong = '\u27f7',
ArrowRight = '\u2192',
ArrowRightDouble = '\u21d2',
ArrowRightHollow = '\u21e8',
ArrowUp = '\u2191',
ArrowUpRight = '\u2197',
ArrowsHalfLeftRight = '\u21cb',
ArrowsHalfRightLeft = '\u21cc',
ArrowsLeftRight = '\u21c6',
ArrowsRightLeft = '\u21c4',
Asterisk = '\u2217',
Check = '\u2713',
Dash = '\u2014',
Dot = '\u2022',
DoubleArrowLeft = '\u226A',
DoubleArrowRight = '\u22D8',
Ellipsis = '\u2026',
MiddleEllipsis = '\u22EF',
Pensil = '\u270E',
MuchGreaterThan = '\u226A',
MuchLessThan = '\u22D8',
Pencil = '\u270E',
Space = '\u00a0',
SquareWithBottomShadow = '\u274F',
SquareWithTopShadow = '\u2750',

+ 14
- 4
src/git/formatters/commitFormatter.ts Ver ficheiro

@ -63,14 +63,24 @@ export class CommitFormatter extends Formatter
}
get id() {
if (this._item.isUncommitted && !this._item.isStagedUncommitted) return '00000000';
return this._item.shortSha;
}
get message() {
let message = this._item.isUncommitted ? 'Uncommitted change' : this._item.message;
if (this._options.truncateMessageAtNewLine) {
message = this._item.getShortMessage();
let message;
if (this._item.isStagedUncommitted) {
message = 'Staged changes';
}
else if (this._item.isUncommitted) {
message = 'Uncommitted changes';
}
else {
if (this._options.truncateMessageAtNewLine) {
message = this._item.getShortMessage();
}
else {
message = this._item.message;
}
}
return this._padOrTruncate(message, this._options.tokenOptions!.message);

+ 8
- 2
src/git/formatters/statusFormatter.ts Ver ficheiro

@ -13,6 +13,7 @@ export interface IStatusFormatOptions extends IFormatOptions {
file?: Strings.ITokenOptions;
filePath?: Strings.ITokenOptions;
path?: Strings.ITokenOptions;
status?: Strings.ITokenOptions;
};
}
@ -35,12 +36,17 @@ export class StatusFileFormatter extends Formatter
get path() {
const directory = GitStatusFile.getRelativePath(this._item, this._options.relativePath);
return this._padOrTruncate(directory, this._options.tokenOptions!.file);
return this._padOrTruncate(directory, this._options.tokenOptions!.path);
}
get status() {
const status = GitStatusFile.getStatusText(this._item.status);
return this._padOrTruncate(status, this._options.tokenOptions!.status);
}
get working() {
const commit = (this._item as IGitStatusFileWithCommit).commit;
return (commit !== undefined && commit.isUncommitted) ? `${GlyphChars.Pensil} ${GlyphChars.Space}` : '';
return (commit !== undefined && commit.isUncommitted) ? `${GlyphChars.Pencil} ${GlyphChars.Space}` : '';
}
static fromTemplate(template: string, status: IGitStatusFile, dateFormat: string | null): string;

+ 1
- 1
src/git/git.ts Ver ficheiro

@ -219,7 +219,7 @@ export class Git {
}
static shortenSha(sha: string, strings: { stagedUncommitted?: string, uncommitted?: string, working?: string } = {}) {
strings = { stagedUncommitted: 'index', uncommitted: '', working: '', ...strings };
strings = { stagedUncommitted: 'index', uncommitted: 'working', working: '', ...strings };
if (sha === '') return strings.working;
if (Git.isStagedUncommitted(sha)) return strings.stagedUncommitted;

+ 8
- 0
src/git/gitUri.ts Ver ficheiro

@ -94,6 +94,14 @@ export class GitUri extends ((Uri as any) as UriEx) {
return Uri.file(!options.noSha && this.sha ? this.path : this.fsPath);
}
getDirectory(relativeTo?: string): string {
return GitUri.getDirectory(path.relative(this.repoPath || '', this.fsPath), relativeTo);
}
getFilename(relativeTo?: string): string {
return path.basename(path.relative(this.repoPath || '', this.fsPath), relativeTo);
}
getFormattedPath(separator: string = Strings.pad(GlyphChars.Dot, 2, 2), relativeTo?: string): string {
let directory = path.dirname(this.fsPath);
if (this.repoPath) {

+ 20
- 0
src/git/models/branch.ts Ver ficheiro

@ -1,3 +1,5 @@
import { GlyphChars } from '../../constants';
'use strict';
export class GitBranch {
@ -67,6 +69,24 @@ export class GitBranch {
return undefined;
}
getTrackingStatus(options: { empty?: string, expand?: boolean, prefix?: string, separator?: string } = {}): string {
options = { empty: '', prefix: '', separator: ' ', ...options };
if (this.tracking === undefined || (this.state.behind === 0 && this.state.ahead === 0)) return options.empty!;
if (options.expand) {
let status = '';
if (this.state.behind) {
status += `${this.state.behind} ${this.state.behind === 1 ? 'commit' : 'commits'} behind`;
}
if (this.state.ahead) {
status += `${status === '' ? '' : options.separator}${this.state.ahead} ${this.state.ahead === 1 ? 'commit' : 'commits'} ahead`;
}
return `${options.prefix}${status}`;
}
return `${options.prefix}${this.state.behind}${GlyphChars.ArrowDown}${options.separator}${this.state.ahead}${GlyphChars.ArrowUp}`;
}
isValid(): boolean {
return GitBranch.isValid(this.name);
}

+ 108
- 10
src/git/models/status.ts Ver ficheiro

@ -6,18 +6,90 @@ import { GitUri } from '../gitUri';
import { GitLogCommit } from './logCommit';
import * as path from 'path';
export interface GitStatus {
readonly branch: string;
readonly repoPath: string;
readonly sha: string;
readonly state: {
ahead: number;
behind: number;
export interface GitStatusUpstreamState {
ahead: number;
behind: number;
}
export class GitStatus {
constructor(
public readonly repoPath: string,
public readonly branch: string,
public readonly sha: string,
public readonly files: GitStatusFile[],
public readonly state: GitStatusUpstreamState,
public readonly upstream?: string
) { }
private _diff?: {
added: number,
deleted: number,
changed: number
};
readonly upstream?: string;
readonly files: GitStatusFile[];
getDiffStatus(options: { empty?: string, expand?: boolean, prefix?: string, separator?: string } = {}): string {
options = { empty: '', prefix: '', separator: ' ', ...options };
if (this.files.length === 0) return options.empty!;
if (this._diff === undefined) {
this._diff = {
added: 0,
deleted: 0,
changed: 0
};
for (const f of this.files) {
switch (f.status) {
case 'A':
case '?':
this._diff.added++;
break;
case 'D':
this._diff.deleted++;
break;
default:
this._diff.changed++;
break;
}
}
}
if (options.expand) {
let status = '';
if (this._diff.added) {
status += `${this._diff.added} ${this._diff.added === 1 ? 'file' : 'files'} added`;
}
if (this._diff.changed) {
status += `${status === '' ? '' : options.separator}${this._diff.changed} ${this._diff.changed === 1 ? 'file' : 'files'} changed`;
}
if (this._diff.deleted) {
status += `${status === '' ? '' : options.separator}${this._diff.deleted} ${this._diff.deleted === 1 ? 'file' : 'files'} deleted`;
}
return `${options.prefix}${status}`;
}
return `${options.prefix}+${this._diff.added}${options.separator}~${this._diff.changed}${options.separator}-${this._diff.deleted}`;
}
getUpstreamStatus(options: { empty?: string, expand?: boolean, prefix?: string, separator?: string } = {}): string {
options = { empty: '', prefix: '', separator: ' ', ...options };
if (this.upstream === undefined || (this.state.behind === 0 && this.state.ahead === 0)) return options.empty!;
if (options.expand) {
let status = '';
if (this.state.behind) {
status += `${this.state.behind} ${this.state.behind === 1 ? 'commit' : 'commits'} behind`;
}
if (this.state.ahead) {
status += `${status === '' ? '' : options.separator}${this.state.ahead} ${this.state.ahead === 1 ? 'commit' : 'commits'} ahead`;
}
return `${options.prefix}${status}`;
}
return `${options.prefix}${this.state.behind}${GlyphChars.ArrowDown}${options.separator}${this.state.ahead}${GlyphChars.ArrowUp}`;
}
}
export declare type GitStatusFileStatus = '!' | '?' | 'A' | 'C' | 'D' | 'M' | 'R' | 'T' | 'U' | 'X' | 'B';
@ -68,6 +140,10 @@ export class GitStatusFile implements IGitStatusFile {
return getGitStatusOcticon(this.status);
}
getStatusText(status: IGitStatusFile): string {
return GitStatusFile.getStatusText(this.status);
}
with(changes: { indexStatus?: GitStatusFileStatus | null, workTreeStatus?: GitStatusFileStatus | null, fileName?: string, originalFileName?: string | null }): GitStatusFile {
return new GitStatusFile(
this.repoPath,
@ -97,6 +173,10 @@ export class GitStatusFile implements IGitStatusFile {
static getRelativePath(status: IGitStatusFile, relativeTo?: string): string {
return GitUri.getRelativePath(status.fileName, relativeTo);
}
static getStatusText(status: GitStatusFileStatus): string {
return getGitStatusText(status);
}
}
const statusOcticonsMap = {
@ -133,4 +213,22 @@ const statusIconsMap = {
export function getGitStatusIcon(status: GitStatusFileStatus): string {
return statusIconsMap[status] || statusIconsMap['X'];
}
const statusTextMap = {
'!': 'ignored',
'?': 'untracked',
A: 'added',
C: 'copied',
D: 'deleted',
M: 'modified',
R: 'renamed',
T: 'modified',
U: 'conflict',
X: 'unknown',
B: 'unknown'
};
export function getGitStatusText(status: GitStatusFileStatus): string {
return statusTextMap[status] || statusTextMap['X'];
}

+ 15
- 16
src/git/parsers/statusParser.ts Ver ficheiro

@ -57,14 +57,13 @@ export class GitStatusParser {
}
}
return {
branch: branch || '',
repoPath: Strings.normalizePath(repoPath),
sha: '',
state: state,
files: files,
upstream: upstream
};
return new GitStatus(
Strings.normalizePath(repoPath),
branch || '',
'',
files,
state,
upstream);
}
private static parseV2(lines: string[], repoPath: string): GitStatus {
@ -119,14 +118,14 @@ export class GitStatusParser {
}
}
return {
branch: branch || '',
repoPath: Strings.normalizePath(repoPath),
sha: sha || '',
state: state,
files: files,
upstream: upstream
};
return new GitStatus(
Strings.normalizePath(repoPath),
branch || '',
sha || '',
files,
state,
upstream
);
}
static parseStatusFile(repoPath: string, rawStatus: string, fileName: string, originalFileName?: string): GitStatusFile {

+ 1
- 1
src/quickPicks/repoStatusQuickPick.ts Ver ficheiro

@ -313,7 +313,7 @@ export class RepoStatusQuickPick {
const pick = await window.showQuickPick(items, {
matchOnDescription: true,
placeHolder: `status of ${status.branch}${status.upstream ? ` ${Strings.pad(GlyphChars.ArrowLeftRight, 1, 1)} ${status.upstream}` : ''}`,
placeHolder: `status of ${status.branch}${status.upstream ? ` ${Strings.pad(GlyphChars.ArrowLeftRightLong, 1, 1)} ${status.upstream}` : ''}`,
ignoreFocusOut: getQuickPickIgnoreFocusOut(),
onDidSelectItem: (item: QuickPickItem) => {
scope.setKeyCommand('right', item);

+ 1
- 0
src/views/branchFolderNode.ts Ver ficheiro

@ -38,6 +38,7 @@ export class BranchFolderNode extends ExplorerNode {
const item = new TreeItem(this.label, TreeItemCollapsibleState.Collapsed);
item.contextValue = ResourceType.Folder;
item.resourceUri = this.explorer.folderResourceUri;
item.tooltip = this.label;
return item;
}

+ 19
- 15
src/views/branchNode.ts Ver ficheiro

@ -54,10 +54,27 @@ export class BranchNode extends ExplorerRefNode {
async getTreeItem(): Promise<TreeItem> {
let name = this.label;
if (!this.branch.remote && this.branch.tracking !== undefined && this.explorer.config.showTrackingBranch) {
name += ` ${GlyphChars.Space}${GlyphChars.ArrowLeftRight}${GlyphChars.Space} ${this.branch.tracking}`;
let tooltip = `${this.branch.getName()}${this.branch!.current ? ' (current)' : ''}`;
let iconSuffix = '';
if (!this.branch.remote && this.branch.tracking !== undefined) {
if (this.explorer.config.showTrackingBranch) {
name += ` ${GlyphChars.Space}${GlyphChars.ArrowLeftRightLong}${this.branch.getTrackingStatus({ prefix: `${GlyphChars.Space} ` })}${GlyphChars.Space} ${this.branch.tracking}`;
}
tooltip += `\n\nTracking ${GlyphChars.Dash} ${this.branch.tracking}\n${this.branch.getTrackingStatus({ empty: 'up-to-date', expand: true, separator: '\n' })}`;
if (this.branch.state.ahead || this.branch.state.behind) {
if (this.branch.state.behind) {
iconSuffix = '-yellow';
}
if (this.branch.state.ahead) {
iconSuffix = this.branch.state.behind ? '-red' : '-green';
}
}
}
const item = new TreeItem(`${this.branch!.current ? `${GlyphChars.Check} ${GlyphChars.Space}` : ''}${name}`, TreeItemCollapsibleState.Collapsed);
item.tooltip = tooltip;
if (this.branch.remote) {
item.contextValue = ResourceType.RemoteBranch;
@ -73,19 +90,6 @@ export class BranchNode extends ExplorerRefNode {
: ResourceType.Branch;
}
let iconSuffix = '';
if (this.branch.tracking) {
if (this.branch.state.ahead && this.branch.state.behind) {
iconSuffix = '-yellow';
}
else if (this.branch.state.ahead) {
iconSuffix = '-green';
}
else if (this.branch.state.behind) {
iconSuffix = '-red';
}
}
item.iconPath = {
dark: Container.context.asAbsolutePath(`images/dark/icon-branch${iconSuffix}.svg`),
light: Container.context.asAbsolutePath(`images/light/icon-branch${iconSuffix}.svg`)

+ 26
- 1
src/views/commitFileNode.ts Ver ficheiro

@ -1,6 +1,7 @@
'use strict';
import { Command, TreeItem, TreeItemCollapsibleState } from 'vscode';
import { Commands, DiffWithPreviousCommandArgs } from '../commands';
import { GlyphChars } from '../constants';
import { Container } from '../container';
import { Explorer, ExplorerNode, ResourceType } from './explorerNode';
import { CommitFormatter, getGitStatusIcon, GitLogCommit, GitUri, ICommitFormatOptions, IGitStatusFile, IStatusFormatOptions, StatusFileFormatter } from '../gitService';
@ -53,6 +54,7 @@ export class CommitFileNode extends ExplorerNode {
const item = new TreeItem(this.label, TreeItemCollapsibleState.None);
item.contextValue = this.resourceType;
item.tooltip = this.tooltip;
if ((this.displayAs & CommitFileNodeDisplayAs.CommitIcon) === CommitFileNodeDisplayAs.CommitIcon) {
item.iconPath = {
@ -73,8 +75,9 @@ export class CommitFileNode extends ExplorerNode {
item.command = this.getCommand();
// Only cache the label for a single refresh
// Only cache the label/tooltip for a single refresh
this._label = undefined;
this._tooltip = undefined;
return item;
}
@ -117,12 +120,34 @@ export class CommitFileNode extends ExplorerNode {
set relativePath(value: string | undefined) {
this._relativePath = value;
this._label = undefined;
this._tooltip = undefined;
}
protected get resourceType(): ResourceType {
return ResourceType.CommitFile;
}
private _tooltip: string | undefined;
get tooltip() {
if (this._tooltip === undefined) {
if (this.displayAs & CommitFileNodeDisplayAs.CommitLabel) {
this._tooltip = CommitFormatter.fromTemplate(
this.commit.isUncommitted
? `\${author} ${GlyphChars.Dash} \${id}\n\${ago} (\${date})`
: `\${author} ${GlyphChars.Dash} \${id}\n\${ago} (\${date})\n\n\${message}`,
this.commit,
{
dataFormat: Container.config.defaultDateFormat
} as ICommitFormatOptions
);
}
else {
this._tooltip = StatusFileFormatter.fromTemplate('${file}\n${directory}/\n\n${status}', this.status);
}
}
return this._tooltip;
}
protected getCommitTemplate() {
return this.explorer.config.commitFormat;
}

+ 10
- 0
src/views/commitNode.ts Ver ficheiro

@ -69,6 +69,16 @@ export class CommitNode extends ExplorerRefNode {
};
}
item.tooltip = CommitFormatter.fromTemplate(
this.commit.isUncommitted
? `\${author} ${GlyphChars.Dash} \${id}\n\${ago} (\${date})`
: `\${author} ${GlyphChars.Dash} \${id}\n\${ago} (\${date})\n\n\${message}`,
this.commit,
{
dataFormat: Container.config.defaultDateFormat
} as ICommitFormatOptions
);
return item;
}

+ 1
- 2
src/views/commitResultsNode.ts Ver ficheiro

@ -19,8 +19,7 @@ export class CommitResultsNode extends ExplorerNode {
async getChildren(): Promise<ExplorerNode[]> {
const children = await new CommitNode(this.commit, this.explorer).getChildren();
// Since we can't control the tooltip separately from the message (see https://github.com/Microsoft/vscode/issues/32012), don't truncate it
children.splice(0, 0, new MessageNode(CommitFormatter.fromTemplate('${message}', this.commit, { truncateMessageAtNewLine: false })));
children.splice(0, 0, new MessageNode(CommitFormatter.fromTemplate('${message}', this.commit, { truncateMessageAtNewLine: true }), CommitFormatter.fromTemplate('${message}', this.commit)));
return children;
}

+ 2
- 10
src/views/comparisonResultsNode.ts Ver ficheiro

@ -5,7 +5,7 @@ import { CommitsResultsNode } from './commitsResultsNode';
import { GlyphChars } from '../constants';
import { Container } from '../container';
import { Explorer, ExplorerNode, NamedRef, ResourceType } from './explorerNode';
import { GitLog, GitService, GitStatusFile, GitUri } from '../gitService';
import { GitLog, GitService, GitUri } from '../gitService';
import { StatusFilesResultsNode } from './statusFilesResultsNode';
export class ComparisonResultsNode extends ExplorerNode {
@ -31,17 +31,9 @@ export class ComparisonResultsNode extends ExplorerNode {
return `${count === 0 ? 'No' : `${count}${truncated ? '+' : ''}`} commits`;
};
const filesQueryFn = () => Container.git.getDiffStatus(this.uri.repoPath!, this.ref1.ref, this.ref2.ref);
const filesLabelFn = (diff: GitStatusFile[] | undefined) => {
const count = diff !== undefined ? diff.length : 0;
if (count === 1) return `1 file changed`;
return `${count === 0 ? 'No' : count} files changed`;
};
this.children = [
new CommitsResultsNode(this.uri.repoPath!, commitsLabelFn, commitsQueryFn, this.explorer),
new StatusFilesResultsNode(this.uri.repoPath!, this.ref1.ref, this.ref2.ref, filesLabelFn, filesQueryFn, this.explorer)
new StatusFilesResultsNode(this.uri.repoPath!, this.ref1.ref, this.ref2.ref, this.explorer)
];
return this.children;

+ 3
- 1
src/views/explorerNode.ts Ver ficheiro

@ -117,7 +117,8 @@ export abstract class ExplorerRefNode extends ExplorerNode {
export class MessageNode extends ExplorerNode {
constructor(
private readonly message: string
private readonly message: string,
private readonly tooltip?: string
) {
super(new GitUri());
}
@ -129,6 +130,7 @@ export class MessageNode extends ExplorerNode {
getTreeItem(): TreeItem | Promise<TreeItem> {
const item = new TreeItem(this.message, TreeItemCollapsibleState.None);
item.contextValue = ResourceType.Message;
item.tooltip = this.tooltip;
return item;
}
}

+ 1
- 0
src/views/fileHistoryNode.ts Ver ficheiro

@ -74,6 +74,7 @@ export class FileHistoryNode extends ExplorerNode {
const item = new TreeItem(`${this.uri.getFormattedPath()}`, TreeItemCollapsibleState.Expanded);
item.contextValue = ResourceType.FileHistory;
item.tooltip = `History of ${this.uri.getFilename()}\n${this.uri.getDirectory()}/`;
item.iconPath = {
dark: Container.context.asAbsolutePath('images/dark/icon-history.svg'),

+ 1
- 0
src/views/folderNode.ts Ver ficheiro

@ -64,6 +64,7 @@ export class FolderNode extends ExplorerNode {
const item = new TreeItem(this.label, TreeItemCollapsibleState.Collapsed);
item.contextValue = ResourceType.Folder;
item.resourceUri = this.explorer.folderResourceUri;
item.tooltip = this.label;
return item;
}

+ 2
- 1
src/views/remoteNode.ts Ver ficheiro

@ -50,7 +50,7 @@ export class RemoteNode extends ExplorerNode {
let separator;
if (fetch && push) {
separator = GlyphChars.ArrowLeftRight;
separator = GlyphChars.ArrowLeftRightLong;
}
else if (fetch) {
separator = GlyphChars.ArrowLeft;
@ -66,6 +66,7 @@ export class RemoteNode extends ExplorerNode {
const item = new TreeItem(label, TreeItemCollapsibleState.Collapsed);
item.contextValue = ResourceType.Remote;
item.tooltip = `${this.remote.name}\n${this.remote.path} (${(this.remote.provider !== undefined) ? this.remote.provider.name : this.remote.domain})`;
if (this.remote.provider !== undefined) {
item.iconPath = {

+ 8
- 0
src/views/stashNode.ts Ver ficheiro

@ -44,6 +44,14 @@ export class StashNode extends ExplorerRefNode {
dataFormat: Container.config.defaultDateFormat
} as ICommitFormatOptions), TreeItemCollapsibleState.Collapsed);
item.contextValue = ResourceType.Stash;
item.tooltip = CommitFormatter.fromTemplate(
'${ago} (${date})\n\n${message}',
this.commit,
{
dataFormat: Container.config.defaultDateFormat
} as ICommitFormatOptions
);
return item;
}
}

+ 48
- 7
src/views/statusFileCommitsNode.ts Ver ficheiro

@ -24,7 +24,23 @@ export class StatusFileCommitsNode extends ExplorerNode {
async getTreeItem(): Promise<TreeItem> {
const item = new TreeItem(this.label, TreeItemCollapsibleState.Collapsed);
item.contextValue = ResourceType.StatusFileCommits;
if (this.commits.length === 1 && this.commit.isUncommitted) {
item.collapsibleState = TreeItemCollapsibleState.None;
item.contextValue = ResourceType.StatusFile;
if (this.commit.isStagedUncommitted) {
item.tooltip = StatusFileFormatter.fromTemplate('${status} in index\n\n${file}\n${directory}/', this.status);
}
else {
item.tooltip = StatusFileFormatter.fromTemplate('${status} in working tree\n\n${file}\n${directory}/', this.status);
}
item.command = this.getCommand();
}
else {
item.contextValue = ResourceType.StatusFileCommits;
item.tooltip = StatusFileFormatter.fromTemplate(`\${status} in ${this.getChangedIn()}\n\n\${file}\n\${directory}/`, this.status);
}
const icon = getGitStatusIcon(this.status.status);
item.iconPath = {
@ -32,15 +48,12 @@ export class StatusFileCommitsNode extends ExplorerNode {
light: Container.context.asAbsolutePath(path.join('images', 'light', icon))
};
if (this.commits.length === 1 && this.commits[0].isUncommitted) {
item.collapsibleState = TreeItemCollapsibleState.None;
item.contextValue = ResourceType.StatusFile;
item.command = this.getCommand();
}
// Only cache the label for a single refresh
this._label = undefined;
// Capitalize the first letter of the tooltip
item.tooltip = item.tooltip.charAt(0).toUpperCase() + item.tooltip.slice(1);
return item;
}
@ -86,6 +99,34 @@ export class StatusFileCommitsNode extends ExplorerNode {
this._label = undefined;
}
private getChangedIn(): string {
const changedIn = [];
let commits = 0;
for (const c of this.commits) {
if (c.isUncommitted) {
if (c.isStagedUncommitted) {
changedIn.push('working tree');
}
else {
changedIn.push('index');
}
continue;
}
commits++;
}
if (commits > 0) {
changedIn.push(`${commits} ${commits === 1 ? 'commit' : 'commits'}`);
}
if (changedIn.length > 2) {
changedIn[changedIn.length - 1] = `and ${changedIn[changedIn.length - 1]}`;
}
return changedIn.join(changedIn.length > 2 ? ', ' : ' and ');
}
getCommand(): Command | undefined {
return {
title: 'Compare File with Previous Revision',

+ 4
- 3
src/views/statusFileNode.ts Ver ficheiro

@ -25,11 +25,12 @@ export class StatusFileNode extends ExplorerNode {
getTreeItem(): TreeItem {
const item = new TreeItem(this.label, TreeItemCollapsibleState.None);
item.contextValue = ResourceType.StatusFile;
item.tooltip = StatusFileFormatter.fromTemplate('${file}\n${directory}/\n\n${status}', this.status);
const icon = getGitStatusIcon(this.status.status);
const statusIcon = getGitStatusIcon(this.status.status);
item.iconPath = {
dark: Container.context.asAbsolutePath(path.join('images', 'dark', icon)),
light: Container.context.asAbsolutePath(path.join('images', 'light', icon))
dark: Container.context.asAbsolutePath(path.join('images', 'dark', statusIcon)),
light: Container.context.asAbsolutePath(path.join('images', 'light', statusIcon))
};
item.command = this.getCommand();

+ 1
- 1
src/views/statusFilesNode.ts Ver ficheiro

@ -122,7 +122,7 @@ export class StatusFilesNode extends ExplorerNode {
}
}
const label = `${files} file${files > 1 ? 's' : ''} changed`; // ${this.status.upstream === undefined ? '' : ` (ahead of ${this.status.upstream})`}`;
const label = `${files} ${files === 1 ? 'file' : 'files'} changed`;
const item = new TreeItem(label, TreeItemCollapsibleState.Collapsed);
item.id = this.id;
item.contextValue = ResourceType.StatusFiles;

+ 10
- 8
src/views/statusFilesResultsNode.ts Ver ficheiro

@ -2,6 +2,7 @@
import { Arrays, Iterables, Strings } from '../system';
import { TreeItem, TreeItemCollapsibleState } from 'vscode';
import { ExplorerFilesLayout } from '../configuration';
import { Container } from '../container';
import { Explorer, ExplorerNode, ResourceType } from './explorerNode';
import { FolderNode, IFileExplorerNode } from './folderNode';
import { GitStatusFile, GitUri } from '../gitService';
@ -18,8 +19,6 @@ export class StatusFilesResultsNode extends ExplorerNode {
readonly repoPath: string,
private readonly ref1: string,
private readonly ref2: string,
private readonly labelFn: (diff: GitStatusFile[] | undefined) => string,
private readonly diffFn: () => Promise<GitStatusFile[] | undefined>,
private readonly explorer: Explorer
) {
super(GitUri.fromRepoPath(repoPath));
@ -59,10 +58,13 @@ export class StatusFilesResultsNode extends ExplorerNode {
private async ensureCache() {
if (this._cache === undefined) {
const diff = await this.diffFn();
const diff = await Container.git.getDiffStatus(this.uri.repoPath!, this.ref1, this.ref2);
const count = diff !== undefined ? diff.length : 0;
const label = `${count === 0 ? 'No' : count} ${count === 1 ? 'file' : 'files'} changed`;
this._cache = {
label: this.labelFn(diff),
label: label,
diff: diff
};
}
@ -70,13 +72,13 @@ export class StatusFilesResultsNode extends ExplorerNode {
return this._cache;
}
private async getLabel() {
private async getDiff() {
const cache = await this.ensureCache();
return cache.label;
return cache.diff;
}
private async getDiff() {
private async getLabel() {
const cache = await this.ensureCache();
return cache.diff;
return cache.label;
}
}

+ 17
- 14
src/views/statusNode.ts Ver ficheiro

@ -1,4 +1,5 @@
import { Disposable, TreeItem, TreeItemCollapsibleState } from 'vscode';
import { GlyphChars } from '../constants';
import { Container } from '../container';
import { ExplorerNode, ResourceType } from './explorerNode';
import { GitExplorer } from './gitExplorer';
@ -68,29 +69,31 @@ export class StatusNode extends ExplorerNode {
let hasChildren = false;
const hasWorkingChanges = status.files.length !== 0 && this.includeWorkingTree;
let label = '';
let label = `${status.getUpstreamStatus({ prefix: `${GlyphChars.Space} ` })}${hasWorkingChanges ? status.getDiffStatus({ prefix: `${GlyphChars.Space} `}) : ''}`;
let tooltip = `${status.branch} (current)`;
let iconSuffix = '';
if (status.upstream) {
if (!status.state.ahead && !status.state.behind) {
label = `${status.branch}${hasWorkingChanges ? ' has uncommitted changes and' : ''} is up-to-date with ${status.upstream}`;
if (this.explorer.config.showTrackingBranch) {
label += `${GlyphChars.Space} ${status.upstream}`;
}
else {
label = `${status.branch}${hasWorkingChanges ? ' has uncommitted changes and' : ''} is not up-to-date with ${status.upstream}`;
tooltip += `\n\nTracking ${GlyphChars.Dash} ${status.upstream}\n${status.getUpstreamStatus({ empty: 'up-to-date', expand: true, separator: '\n' })}`;
if (status.state.ahead || status.state.behind) {
hasChildren = true;
if (status.state.ahead && status.state.behind) {
if (status.state.behind) {
iconSuffix = '-yellow';
}
else if (status.state.ahead) {
iconSuffix = '-green';
}
else if (status.state.behind) {
iconSuffix = '-red';
if (status.state.ahead) {
iconSuffix = status.state.behind ? '-red' : '-green';
}
}
}
else {
label = `${status.branch} ${hasWorkingChanges ? 'has uncommitted changes' : this.includeWorkingTree ? 'has no changes' : 'has nothing to commit'}`;
label = `${status.branch}${label === '' ? '' : ` ${GlyphChars.Space}${status.upstream ? GlyphChars.ArrowLeftRightLong : GlyphChars.Dash}${label}`}`;
if (hasWorkingChanges) {
tooltip += `\n\nHas uncommitted changes${status.getDiffStatus({ expand: true, prefix: `\n`, separator: '\n' })}`;
}
let state: TreeItemCollapsibleState;
@ -105,7 +108,7 @@ export class StatusNode extends ExplorerNode {
const item = new TreeItem(label, state);
item.id = this.id;
item.contextValue = ResourceType.Status;
item.tooltip = tooltip;
item.iconPath = {
dark: Container.context.asAbsolutePath(`images/dark/icon-repo${iconSuffix}.svg`),
light: Container.context.asAbsolutePath(`images/light/icon-repo${iconSuffix}.svg`)

+ 3
- 3
src/views/statusUpstreamNode.ts Ver ficheiro

@ -18,7 +18,7 @@ export class StatusUpstreamNode extends ExplorerNode {
}
get id(): string {
return `gitlens:repository(${this.status.repoPath})${this.active ? ':active' : ''}:status:upstream`;
return `gitlens:repository(${this.status.repoPath})${this.active ? ':active' : ''}:status:upstream:${this.direction}`;
}
async getChildren(): Promise<ExplorerNode[]> {
@ -46,8 +46,8 @@ export class StatusUpstreamNode extends ExplorerNode {
async getTreeItem(): Promise<TreeItem> {
const label = this.direction === 'ahead'
? `${this.status.state.ahead} commit${this.status.state.ahead > 1 ? 's' : ''} (ahead of ${this.status.upstream})`
: `${this.status.state.behind} commit${this.status.state.behind > 1 ? 's' : ''} (behind ${this.status.upstream})`;
? `${this.status.state.ahead} ${this.status.state.ahead === 1 ? 'commit' : 'commits'} (ahead of ${this.status.upstream})`
: `${this.status.state.behind} ${this.status.state.behind === 1 ? 'commit' : 'commits'} (behind ${this.status.upstream})`;
const item = new TreeItem(label, TreeItemCollapsibleState.Collapsed);
item.id = this.id;

Carregando…
Cancelar
Guardar