Browse Source

Reworks new committer vs author switch

Adds `${committerAgo}`, `${committerAgoOrDate}`, `${committerDate}`
Repurposes `${authorAgo}` & replaces current ones w/ `${author}, ${ago}`
Repurposes `${authorAgoOrDate}` & replaces w/ `${author}, ${agoOrDate}`
Renames defaultDateType to defaultDateSource
Points format settings to new formatting wiki
main
Eric Amodio 5 years ago
parent
commit
3f3a0de59a
14 changed files with 288 additions and 185 deletions
  1. +57
    -57
      README.md
  2. +34
    -34
      package.json
  3. +2
    -2
      src/codelens/codeLensController.ts
  4. +4
    -4
      src/config.ts
  5. +31
    -1
      src/extension.ts
  6. +52
    -10
      src/git/formatters/commitFormatter.ts
  7. +2
    -2
      src/git/gitService.ts
  8. +53
    -31
      src/git/models/commit.ts
  9. +23
    -19
      src/git/models/logCommit.ts
  10. +5
    -5
      src/git/models/stashCommit.ts
  11. +16
    -12
      src/git/models/status.ts
  12. +6
    -4
      src/system/string.ts
  13. +1
    -1
      src/views/nodes/helpers.ts
  14. +2
    -3
      src/views/nodes/lineHistoryNode.ts

+ 57
- 57
README.md View File

@ -652,7 +652,7 @@ GitLens is highly customizable and provides many configuration settings to allow
| `gitlens.defaultDateFormat` | Specifies how absolute dates will be formatted by default. See the [Moment.js docs](https://momentjs.com/docs/#/displaying/format/) for valid formats |
| `gitlens.defaultDateShortFormat` | Specifies how short absolute dates will be formatted by default. See the [Moment.js docs](https://momentjs.com/docs/#/displaying/format/) for valid formats |
| `gitlens.defaultDateStyle` | Specifies how dates will be displayed by default |
| `gitlens.defaultDateType` | Specifies if dates should use author date or committer date |
| `gitlens.defaultDateSource` | Specifies whether commit dates should use the authored or committed date |
| `gitlens.defaultGravatarsStyle` | Specifies the style of the gravatar default (fallback) images<br /><br />`identicon` - a geometric pattern<br />`mm` - 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` - a face with differing features and backgrounds |
| `gitlens.insiders` | Specifies whether to enable experimental features |
| `gitlens.keymap` | Specifies the keymap to use for GitLens shortcut keys<br /><br />`alternate` - adds an alternate set of shortcut keys that start with `Alt` (&#x2325; on macOS)<br />`chorded` - adds a chorded set of shortcut keys that start with `Ctrl+Shift+G` (<code>&#x2325;&#x2318;G</code> on macOS)<br />`none` - no shortcut keys will be added |
@ -664,45 +664,45 @@ GitLens is highly customizable and provides many configuration settings to allow
### Current Line Blame Settings [#](#current-line-blame-settings- 'Current Line Blame Settings')
| Name | Description |
| -------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `gitlens.currentLine.dateFormat` | Specifies how to format absolute dates (using the `${date}` token) for the current line blame annotations. See the [Moment.js docs](https://momentjs.com/docs/#/displaying/format/) for valid formats |
| `gitlens.currentLine.enabled` | Specifies whether to provide a blame annotation for the current line, by default. Use the _Toggle Line Blame Annotations_ command (`gitlens.toggleLineBlame`) to toggle the annotations on and off for the current window |
| `gitlens.currentLine.format` | Specifies the format of the current line blame annotation. See the [GitLens docs](https://github.com/eamodio/vscode-gitlens/wiki/Advanced-Formatting) for advanced formatting<br /><br />Available tokens<br />`${id}` &mdash; commit id<br />`${author}` &mdash; commit author<br />`${email}` &mdash; commit author e-mail<br />`${message}` &mdash; commit message<br />`${ago}` &mdash; relative commit date (e.g. 1 day ago)<br />`${date}` &mdash; formatted commit date (format specified by `gitlens.currentLine.dateFormat`) class="p"><br />`${agoOrDate}` &mdash; commit date specified by n class="sb">`gitlens.defaultDateStyle`<br />`${authorAgo}` &mdash; commit author, relative commit date<br />`${authorAgoOrDate}` &mdash; commit author, commit date specified by `gitlens.defaultDateStyle` |
| `gitlens.currentLine.scrollable` | Specifies whether the current line blame annotation can be scrolled into view when it is outside the viewport |
| Name | Description |
| -------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `gitlens.currentLine.dateFormat` | Specifies how to format absolute dates (e.g. using the `${date}` token) for the current line blame annotations. See the [Moment.js docs](https://momentjs.com/docs/#/displaying/format/) for valid formats |
| `gitlens.currentLine.enabled` | Specifies whether to provide a blame annotation for the current line, by default. Use the _Toggle Line Blame Annotations_ command (`gitlens.toggleLineBlame`) to toggle the annotations on and off for the current window |
| `gitlens.currentLine.format` | Specifies the format of the current line blame annotation. See [_Commit Tokens_](https://github.com/eamodio/vscode-gitlens/wiki/Custom-Formatting#commit-tokens) in the GitLens docs. Date formatting is controlled by the `gitlens.currentLine.dateFormat` setting |
| `gitlens.currentLine.scrollable` | Specifies whether the current line blame annotation can be scrolled into view when it is outside the viewport |
### Gutter Blame Settings [#](#gutter-blame-settings- 'Gutter Blame Settings')
| Name | Description |
| ----------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `gitlens.blame.avatars` | Specifies whether to show avatar images in the gutter blame annotations |
| `gitlens.blame.compact` | Specifies whether to compact (deduplicate) matching adjacent gutter blame annotations |
| `gitlens.blame.dateFormat` | Specifies how to format absolute dates (using the `${date}` token) in gutter blame annotations. See the [Moment.js docs](https://momentjs.com/docs/#/displaying/format/) for valid formats |
| `gitlens.blame.format` | Specifies the format of the gutter blame annotations. See the [GitLens docs](https://github.com/eamodio/vscode-gitlens/wiki/Advanced-Formatting) for advanced formatting<br /><br />Available tokens<br />`${id}` &mdash; commit id<br />`${author}` &mdash; commit author<br />`${email}` &mdash; commit author e-mail<br />`${message}` &mdash; commit message<br />`${ago}` &mdash; relative commit date (e.g. 1 day ago)<br />`${date}` &mdash; formatted commit date (format specified by `gitlens.blame.dateFormat`) class="p"><br />`${agoOrDate}` &mdash; commit date specified by n class="sb">`gitlens.defaultDateStyle` class="p">< class="nt">br class="p">/>`${authorAgo}` class="ni">&mdash; commit author, relative commit date class="p">< class="nt">br class="p">/>`${authorAgoOrDate}` class="ni">&mdash; commit author, commit date specified by `gitlens.defaultDateStyle` |
| `gitlens.blame.heatmap.enabled` | Specifies whether to provide a heatmap indicator in the gutter blame annotations |
| `gitlens.blame.heatmap.location` | Specifies where the heatmap indicators will be shown in the gutter blame annotations<br /><br />`left` - adds a heatmap indicator on the left edge of the gutter blame annotations<br />`right` - adds a heatmap indicator on the right edge of the gutter blame annotations |
| `gitlens.blame.highlight.enabled` | Specifies whether to highlight lines associated with the current line |
| `gitlens.blame.highlight.locations` | Specifies where the associated line highlights will be shown<br /><br />`gutter` - adds a gutter glyph<br />`line` - adds a full-line highlight background color<br />`overview` - adds a decoration to the overview ruler (scroll bar) |
| `gitlens.blame.ignoreWhitespace` | Specifies whether to ignore whitespace when comparing revisions during blame operations |
| `gitlens.blame.separateLines` | Specifies whether gutter blame annotations will have line separators |
| `gitlens.blame.toggleMode` | Specifies how the gutter blame annotations will be toggled<br /><br />`file` - toggles each file individually<br />`window` - toggles the window, i.e. all files at once |
| Name | Description |
| ----------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `gitlens.blame.avatars` | Specifies whether to show avatar images in the gutter blame annotations |
| `gitlens.blame.compact` | Specifies whether to compact (deduplicate) matching adjacent gutter blame annotations |
| `gitlens.blame.dateFormat` | Specifies how to format absolute dates (e.g. using the `${date}` token) in gutter blame annotations. See the [Moment.js docs](https://momentjs.com/docs/#/displaying/format/) for valid formats |
| `gitlens.blame.format` | Specifies the format of the gutter blame annotations. See [_Commit Tokens_](https://github.com/eamodio/vscode-gitlens/wiki/Custom-Formatting#commit-tokens) in the GitLens docs. Date formatting is controlled by the `gitlens.blame.dateFormat` setting |
| `gitlens.blame.heatmap.enabled` | Specifies whether to provide a heatmap indicator in the gutter blame annotations |
| `gitlens.blame.heatmap.location` | Specifies where the heatmap indicators will be shown in the gutter blame annotations<br /><br />`left` - adds a heatmap indicator on the left edge of the gutter blame annotations<br />`right` - adds a heatmap indicator on the right edge of the gutter blame annotations |
| `gitlens.blame.highlight.enabled` | Specifies whether to highlight lines associated with the current line |
| `gitlens.blame.highlight.locations` | Specifies where the associated line highlights will be shown<br /><br />`gutter` - adds a gutter glyph<br />`line` - adds a full-line highlight background color<br />`overview` - adds a decoration to the overview ruler (scroll bar) |
| `gitlens.blame.ignoreWhitespace` | Specifies whether to ignore whitespace when comparing revisions during blame operations |
| `gitlens.blame.separateLines` | Specifies whether gutter blame annotations will have line separators |
| `gitlens.blame.toggleMode` | Specifies how the gutter blame annotations will be toggled<br /><br />`file` - toggles each file individually<br />`window` - toggles the window, i.e. all files at once |
### Hover Settings [#](#hover-settings- 'Hover Settings')
| Name | Description |
| -------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `gitlens.hovers.annotations.changes` | Specifies whether to provide a _changes (diff)_ hover for all lines when showing blame annotations |
| `gitlens.hovers.annotations.details` | Specifies whether to provide a _commit details_ hover for all lines when showing blame annotations |
| `gitlens.hovers.annotations.enabled` | Specifies whether to provide any hovers when showing blame annotations |
| `gitlens.hovers.annotations.over` | Specifies when to trigger hovers when showing blame annotations<br /><br />`annotation` - only shown when hovering over the line annotation<br />`line` - shown when hovering anywhere over the line |
| `gitlens.hovers.avatars` | Specifies whether to show avatar images in hovers |
| `gitlens.hovers.changesDiff` | Specifies whether to show just the changes to the line or the set of related changes in the _changes (diff)_ hover<br /><br />`line` - Shows only the changes to the line<br /><br />`hunk` - Shows the set of related changes |
| `gitlens.hovers.currentLine.changes` | Specifies whether to provide a _changes (diff)_ hover for the current line |
| `gitlens.hovers.currentLine.details` | Specifies whether to provide a _commit details_ hover for the current line |
| `gitlens.hovers.currentLine.enabled` | Specifies whether to provide any hovers for the current line |
| `gitlens.hovers.currentLine.over` | Specifies when to trigger hovers for the current line<br /><br />`annotation` - only shown when hovering over the line annotation<br />`line` - shown when hovering anywhere over the line |
| `gitlens.hovers.enabled` | Specifies whether to provide any hovers |
| `gitlens.hovers.detailsMarkdownFormat` | Specifies the (in markdown) of the _commit details_ hover. See the [GitLens docs](https://github.com/eamodio/vscode-gitlens/wiki/Advanced-Formatting) for advanced formatting<br /><br />Available tokens<br />`${id}` &mdash; commit id<br />`${author}` &mdash; commit author<br />`${email}` &mdash; commit author e-mail<br />`${message}` &mdash; commit message<br />`${ago}` &mdash; relative commit date (e.g. 1 day ago)<br />`${date}` &mdash; formatted commit date (format specified by `gitlens.defaultDateFormat`)<br />`${agoOrDate}` &mdash; commit date specified by `gitlens.defaultDateStyle`<br />`${authorAgo}` &mdash; commit author, relative commit date<br />`${authorAgoOrDate}` &mdash; commit author, commit date specified by `gitlens.defaultDateStyle`<br />`${avatar}` &mdash; commit author avatar<br />`${commands}` &mdash; a set of commit commands |
| Name | Description |
| -------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `gitlens.hovers.annotations.changes` | Specifies whether to provide a _changes (diff)_ hover for all lines when showing blame annotations |
| `gitlens.hovers.annotations.details` | Specifies whether to provide a _commit details_ hover for all lines when showing blame annotations |
| `gitlens.hovers.annotations.enabled` | Specifies whether to provide any hovers when showing blame annotations |
| `gitlens.hovers.annotations.over` | Specifies when to trigger hovers when showing blame annotations<br /><br />`annotation` - only shown when hovering over the line annotation<br />`line` - shown when hovering anywhere over the line |
| `gitlens.hovers.avatars` | Specifies whether to show avatar images in hovers |
| `gitlens.hovers.changesDiff` | Specifies whether to show just the changes to the line or the set of related changes in the _changes (diff)_ hover<br /><br />`line` - Shows only the changes to the line<br /><br />`hunk` - Shows the set of related changes |
| `gitlens.hovers.currentLine.changes` | Specifies whether to provide a _changes (diff)_ hover for the current line |
| `gitlens.hovers.currentLine.details` | Specifies whether to provide a _commit details_ hover for the current line |
| `gitlens.hovers.currentLine.enabled` | Specifies whether to provide any hovers for the current line |
| `gitlens.hovers.currentLine.over` | Specifies when to trigger hovers for the current line<br /><br />`annotation` - only shown when hovering over the line annotation<br />`line` - shown when hovering anywhere over the line |
| `gitlens.hovers.enabled` | Specifies whether to provide any hovers |
| `gitlens.hovers.detailsMarkdownFormat` | Specifies the format (in markdown) of the _commit details_ hover. See [_Commit Tokens_](https://github.com/eamodio/vscode-gitlens/wiki/Custom-Formatting#commit-tokens) in the GitLens docs |
### Code Lens Settings [#](#code-lens-settings- 'Code Lens Settings')
@ -736,14 +736,14 @@ GitLens is highly customizable and provides many configuration settings to allow
### Status Bar Settings [#](#status-bar-settings- 'Status Bar Settings')
| Name | Description |
| --------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `gitlens.statusBar.alignment` | Specifies the blame alignment in the status bar<br /><br />`left` - aligns to the left<br />`right` - aligns to the right |
| `gitlens.statusBar.command` | Specifies the command to be executed when the blame status bar item is clicked<br /><br />`gitlens.toggleFileBlame` - toggles file blame annotations<br />`gitlens.diffWithPrevious` - compares the current line commit with the previous<br />`gitlens.diffWithWorking` - compares the current line commit with the working tree<br />`gitlens.toggleCodeLens` - toggles Git code lens<br />`gitlens.showQuickCommitDetails` - shows a commit details quick pick<br />`gitlens.showQuickCommitFileDetails` - shows a commit file details quick pick<br />`gitlens.showQuickFileHistory` - shows a file history quick pick<br />`gitlens.showQuickRepoHistory` - shows a branch history quick pick |
| `gitlens.statusBar.dateFormat` | Specifies the date format of absolute dates shown in the blame information in the status bar. See the [Moment.js docs](https://momentjs.com/docs/#/displaying/format/) for valid formats |
| `gitlens.statusBar.enabled` | Specifies whether to provide blame information in the status bar |
| `gitlens.statusBar.format` | Specifies the format of the blame information in the status bar. See the [GitLens docs](https://github.com/eamodio/vscode-gitlens/wiki/Advanced-Formatting) for advanced formatting<br /><br />Available tokens<br />`${id}` &mdash; commit id<br />`${author}` &mdash; commit author<br />`${email}` &mdash; commit author e-mail<br />`${message}` &mdash; commit message<br />`${ago}` &mdash; relative commit date (e.g. 1 day ago)<br />`${date}` &mdash; formatted commit date (format specified by `gitlens.statusBar.dateFormat`)<br />`${agoOrDate}` &mdash; commit date specified by `gitlens.defaultDateStyle`<br />`${authorAgo}` &mdash; commit author, relative commit date<br />`${authorAgoOrDate}` &mdash; commit author, commit date specified by `gitlens.defaultDateStyle` |
| `gitlens.statusBar.reduceFlicker` | Specifies whether to avoid clearing the previous blame information when changing lines to reduce status bar "flashing" |
| Name | Description |
| --------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `gitlens.statusBar.alignment` | Specifies the blame alignment in the status bar<br /><br />`left` - aligns to the left<br />`right` - aligns to the right |
| `gitlens.statusBar.command` | Specifies the command to be executed when the blame status bar item is clicked<br /><br />`gitlens.toggleFileBlame` - toggles file blame annotations<br />`gitlens.diffWithPrevious` - compares the current line commit with the previous<br />`gitlens.diffWithWorking` - compares the current line commit with the working tree<br />`gitlens.toggleCodeLens` - toggles Git code lens<br />`gitlens.showQuickCommitDetails` - shows a commit details quick pick<br />`gitlens.showQuickCommitFileDetails` - shows a commit file details quick pick<br />`gitlens.showQuickFileHistory` - shows a file history quick pick<br />`gitlens.showQuickRepoHistory` - shows a branch history quick pick |
| `gitlens.statusBar.dateFormat` | Specifies how to format absolute dates (e.g. using the `${date}` token) in the blame information in the status bar. See the [Moment.js docs](https://momentjs.com/docs/#/displaying/format/) for valid formats |
| `gitlens.statusBar.enabled` | Specifies whether to provide blame information in the status bar |
| `gitlens.statusBar.format` | Specifies the format of the blame information in the status bar. See [_Commit Tokens_](https://github.com/eamodio/vscode-gitlens/wiki/Custom-Formatting#commit-tokens) in the GitLens docs. Date formatting is controlled by the `gitlens.statusBar.dateFormat` setting |
| `gitlens.statusBar.reduceFlicker` | Specifies whether to avoid clearing the previous blame information when changing lines to reduce status bar "flashing" |
### Repositories View Settings [#](#repositories-view-settings- 'Repositories View Settings')
@ -812,21 +812,21 @@ See also [View Settings](#view-settings- 'Jump to the View settings')
### View Settings [#](#view-settings- 'View Settings')
| Name | Description |
| ------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `gitlens.views.commitFileFormat` | Specifies the format of a committed file in the views<br /><br />Available tokens<br />`${directory}` &mdash; directory name<br />`${file}` &mdash; file name<br />`${filePath}` &mdash; formatted file name and path<br />`${path}` &mdash; full file path |
| `gitlens.views.commitFileDescriptionFormat` | Specifies the description format of a committed file in the views<br /><br />Available tokens<br />`${directory}` &mdash; directory name<br />`${file}` &mdash; file name<br />`${filePath}` &mdash; formatted file name and path<br />`${path}` &mdash; full file path |
| `gitlens.views.commitFormat` | Specifies the format of committed changes in the views. See the [GitLens docs](https://github.com/eamodio/vscode-gitlens/wiki/Advanced-Formatting) for advanced formatting<br /><br />Available tokens<br />`${id}` &mdash; commit id<br />`${author}` &mdash; commit author<br />`${email}` &mdash; commit author e-mail<br />`${message}` &mdash; commit message<br />`${ago}` &mdash; relative commit date (e.g. 1 day ago)<br />`${date}` &mdash; formatted commit date (format specified by `gitlens.defaultDateFormat`)<br />`${agoOrDate}` &mdash; commit date specified by `gitlens.defaultDateStyle`<br />`${authorAgo}` &mdash; commit author, relative commit date<br />`${authorAgoOrDate}` &mdash; commit author, commit date specified by `gitlens.defaultDateStyle` |
| `gitlens.views.commitDescriptionFormat` | Specifies the description format of committed changes in the views. See the [GitLens docs](https://github.com/eamodio/vscode-gitlens/wiki/Advanced-Formatting) for advanced formatting<br /><br />Available tokens<br />`${id}` &mdash; commit id<br />`${author}` &mdash; commit author<br />`${email}` &mdash; commit author e-mail<br />`${message}` &mdash; commit message<br />`${ago}` &mdash; relative commit date (e.g. 1 day ago)<br />`${date}` &mdash; formatted commit date (format specified by `gitlens.defaultDateFormat`)<br />`${agoOrDate}` &mdash; commit date specified by `gitlens.defaultDateStyle`<br />`${authorAgo}` &mdash; commit author, relative commit date<br />`${authorAgoOrDate}` &mdash; commit author, commit date specified by `gitlens.defaultDateStyle` |
| `gitlens.views.defaultItemLimit` | Specifies the default number of items to show in a view list. Use 0 to specify no limit |
| `gitlens.views.pageItemLimit` | Specifies the number of items to show in a each page when paginating a view list. Use 0 to specify no limit |
| `gitlens.views.showRelativeDateMarkers` | Specifies whether to show relative date markers (_Less than a week ago_, _Over a week ago_, _Over a month ago_, etc) on revision (commit) histories in the views |
| `gitlens.views.stashFileFormat` | Specifies the format of a stashed file in the views<br /><br />Available tokens<br />`${directory}` &mdash; directory name<br />`${file}` &mdash; file name<br />`${filePath}` &mdash; formatted file name and path<br />`${path}` &mdash; full file path |
| `gitlens.views.stashFileDescriptionFormat` | Specifies the description format of a stashed file in the views<br /><br />Available tokens<br />`${directory}` &mdash; directory name<br />`${file}` &mdash; file name<br />`${filePath}` &mdash; formatted file name and path<br />`${path}` &mdash; full file path |
| `gitlens.views.stashFormat` | Specifies the format of stashed changes in the views. See the [GitLens docs](https://github.com/eamodio/vscode-gitlens/wiki/Advanced-Formatting) for advanced formatting<br /><br />Available tokens<br />`${id}` &mdash; commit id<br />`${author}` &mdash; commit author<br />`${email}` &mdash; commit author e-mail<br />`${message}` &mdash; commit message<br />`${ago}` &mdash; relative commit date (e.g. 1 day ago)<br />`${date}` &mdash; formatted commit date (format specified by `gitlens.defaultDateFormat`)<br />`${agoOrDate}` &mdash; commit date specified by `gitlens.defaultDateStyle`<br />`${authorAgo}` &mdash; commit author, relative commit date<br />`${authorAgoOrDate}` &mdash; commit author, commit date specified by `gitlens.defaultDateStyle` |
| `gitlens.views.stashDescriptionFormat` | Specifies the description format of stashed changes in the views. See the [GitLens docs](https://github.com/eamodio/vscode-gitlens/wiki/Advanced-Formatting) for advanced formatting<br /><br />Available tokens<br />`${id}` &mdash; commit id<br />`${author}` &mdash; commit author<br />`${email}` &mdash; commit author e-mail<br />`${message}` &mdash; commit message<br />`${ago}` &mdash; relative commit date (e.g. 1 day ago)<br />`${date}` &mdash; formatted commit date (format specified by `gitlens.defaultDateFormat`)<br />`${agoOrDate}` &mdash; commit date specified by `gitlens.defaultDateStyle`<br />`${authorAgo}` &mdash; commit author, relative commit date<br />`${authorAgoOrDate}` &mdash; commit author, commit date specified by `gitlens.defaultDateStyle` |
| `gitlens.views.statusFileFormat` | Specifies the format of the status of a working or committed file in the views<br /><br />Available tokens<br />`${directory}` &mdash; directory name<br />`${file}` &mdash; file name<br />`${filePath}` &mdash; formatted file name and path<br />`${path}` &mdash; full file path<br />`${working}` &mdash; optional indicator if the file is uncommitted |
| `gitlens.views.statusFileDescriptionFormat` | Specifies the description format of the status of a working or committed file in the views<br /><br />Available tokens<br />`${directory}` &mdash; directory name<br />`${file}` &mdash; file name<br />`${filePath}` &mdash; formatted file name and path<br />`${path}` &mdash; full file path<br />`${working}` &mdash; optional indicator if the file is uncommitted |
| Name | Description |
| ------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `gitlens.views.commitFileFormat` | Specifies the format of a committed file in the views. See [_File Tokens_](https://github.com/eamodio/vscode-gitlens/wiki/Custom-Formatting#file-tokens) in the GitLens docs |
| `gitlens.views.commitFileDescriptionFormat` | Specifies the description format of a committed file in the views. See [_File Tokens_](https://github.com/eamodio/vscode-gitlens/wiki/Custom-Formatting#file-tokens) in the GitLens docs |
| `gitlens.views.commitFormat` | Specifies the format of committed changes in the views. See [_Commit Tokens_](https://github.com/eamodio/vscode-gitlens/wiki/Custom-Formatting#commit-tokens) in the GitLens docs |
| `gitlens.views.commitDescriptionFormat` | Specifies the description format of committed changes in the views. See [_Commit Tokens_](https://github.com/eamodio/vscode-gitlens/wiki/Custom-Formatting#commit-tokens) in the GitLens docs |
| `gitlens.views.defaultItemLimit` | Specifies the default number of items to show in a view list. Use 0 to specify no limit |
| `gitlens.views.pageItemLimit` | Specifies the number of items to show in a each page when paginating a view list. Use 0 to specify no limit |
| `gitlens.views.showRelativeDateMarkers` | Specifies whether to show relative date markers (_Less than a week ago_, _Over a week ago_, _Over a month ago_, etc) on revision (commit) histories in the views |
| `gitlens.views.stashFileFormat` | Specifies the format of a stashed file in the views. See [_File Tokens_](https://github.com/eamodio/vscode-gitlens/wiki/Custom-Formatting#file-tokens) in the GitLens docs |
| `gitlens.views.stashFileDescriptionFormat` | Specifies the description format of a stashed file in the views. See [_File Tokens_](https://github.com/eamodio/vscode-gitlens/wiki/Custom-Formatting#file-tokens) in the GitLens docs |
| `gitlens.views.stashFormat` | Specifies the format of stashed changes in the views. See [_Commit Tokens_](https://github.com/eamodio/vscode-gitlens/wiki/Custom-Formatting#commit-tokens) in the GitLens docs |
| `gitlens.views.stashDescriptionFormat` | Specifies the description format of stashed changes in the views. See [_Commit Tokens_](https://github.com/eamodio/vscode-gitlens/wiki/Custom-Formatting#commit-tokens) in the GitLens docs |
| `gitlens.views.statusFileFormat` | Specifies the format of the status of a working or committed file in the views. See [_File Tokens_](https://github.com/eamodio/vscode-gitlens/wiki/Custom-Formatting#file-tokens) in the GitLens docs |
| `gitlens.views.statusFileDescriptionFormat` | Specifies the description format of the status of a working or committed file in the views. See [_File Tokens_](https://github.com/eamodio/vscode-gitlens/wiki/Custom-Formatting#file-tokens) in the GitLens docs |
### Modes Settings [#](#modes-settings- 'Modes Settings')

+ 34
- 34
package.json View File

@ -68,13 +68,13 @@
"gitlens.blame.dateFormat": {
"type": "string",
"default": null,
"markdownDescription": "Specifies how to format absolute dates (using the `${date}` token) in gutter blame annotations. See the [Moment.js docs](https://momentjs.com/docs/#/displaying/format/) for valid formats",
"markdownDescription": "Specifies how to format absolute dates (e.g. using the `${date}` token) in gutter blame annotations. See the [Moment.js docs](https://momentjs.com/docs/#/displaying/format/) for valid formats",
"scope": "window"
},
"gitlens.blame.format": {
"type": "string",
"default": "${message|40?} ${agoOrDate|14-}",
"markdownDescription": "Specifies the format of the gutter blame annotations. See the [GitLens docs](https://github.com/eamodio/vscode-gitlens/wiki/Advanced-Formatting) for advanced formatting\n- Available tokens\n - `${id}` &mdash; commit id\n - `${author}` &mdash; commit author\n - `${email}` &mdash; commit author e-mail\n - `${message}` &mdash; commit message\n - `${ago}` &mdash; relative commit date (e.g. 1 day ago)\n - `${date}` &mdash; formatted commit date (format specified by `#gitlens.blame.dateFormat#`)\n - `${agoOrDate}` &mdash; commit date specified by `#gitlens.defaultDateStyle#`\n - `${authorAgo}` &mdash; commit author, relative commit date\n - `${authorAgoOrDate}` &mdash; commit author, commit date specified by `#gitlens.defaultDateStyle#`",
"markdownDescription": "Specifies the format of the gutter blame annotations. See [_Commit Tokens_](https://github.com/eamodio/vscode-gitlens/wiki/Custom-Formatting#commit-tokens) in the GitLens docs. Date formatting is controlled by the `#gitlens.blame.dateFormat#` setting",
"scope": "window"
},
"gitlens.blame.heatmap.enabled": {
@ -386,7 +386,7 @@
"gitlens.currentLine.dateFormat": {
"type": "string",
"default": null,
"markdownDescription": "Specifies how to format absolute dates (using the `${date}` token) for the current line blame annotation. See the [Moment.js docs](https://momentjs.com/docs/#/displaying/format/) for valid formats",
"markdownDescription": "Specifies how to format absolute dates (e.g. using the `${date}` token) for the current line blame annotation. See the [Moment.js docs](https://momentjs.com/docs/#/displaying/format/) for valid formats",
"scope": "window"
},
"gitlens.currentLine.enabled": {
@ -397,8 +397,8 @@
},
"gitlens.currentLine.format": {
"type": "string",
"default": "${authorAgoOrDate} • ${message}",
"markdownDescription": "Specifies the format of the current line blame annotation. See the [GitLens docs](https://github.com/eamodio/vscode-gitlens/wiki/Advanced-Formatting) for advanced formatting\n- Available tokens\n - `${id}` &mdash; commit id\n - `${author}` &mdash; commit author\n - `${email}` &mdash; commit author e-mail\n - `${message}` &mdash; commit message\n - `${ago}` &mdash; relative commit date (e.g. 1 day ago)\n - `${date}` &mdash; formatted commit date (format specified by `#gitlens.currentLine.dateFormat#`)\n - `${agoOrDate}` &mdash; commit date specified by `#gitlens.defaultDateStyle#`\n - `${authorAgo}` &mdash; commit author, relative commit date\n - `${authorAgoOrDate}` &mdash; commit author, commit date specified by `#gitlens.defaultDateStyle#`",
"default": "${author}, ${agoOrDate} • ${message}",
"markdownDescription": "Specifies the format of the current line blame annotation. See [_Commit Tokens_](https://github.com/eamodio/vscode-gitlens/wiki/Custom-Formatting#commit-tokens) in the GitLens docs. Date formatting is controlled by the `#gitlens.currentLine.dateFormat#` setting",
"scope": "window"
},
"gitlens.currentLine.scrollable": {
@ -425,32 +425,32 @@
"markdownDescription": "Specifies how short absolute dates will be formatted by default. See the [Moment.js docs](https://momentjs.com/docs/#/displaying/format/) for valid formats",
"scope": "window"
},
"gitlens.defaultDateStyle": {
"gitlens.defaultDateSource": {
"type": "string",
"default": "relative",
"default": "authored",
"enum": [
"relative",
"absolute"
"authored",
"committed"
],
"enumDescriptions": [
"e.g. 1 day ago",
"e.g. July 25th, 2018 7:18pm"
"Uses the date when the changes were authored (i.e. originally written)",
"Uses the date when the changes were committed"
],
"markdownDescription": "Specifies how dates will be displayed by default",
"markdownDescription": "Specifies whether commit dates should use the authored or committed date",
"scope": "window"
},
"gitlens.defaultDateType": {
"gitlens.defaultDateStyle": {
"type": "string",
"default": "author",
"default": "relative",
"enum": [
"author",
"committer"
"relative",
"absolute"
],
"enumDescriptions": [
"The date that the commit was originally written",
"The date that the commit was applied to the branch"
"e.g. 1 day ago",
"e.g. July 25th, 2018 7:18pm"
],
"markdownDescription": "Specifies if dates should use author date or committer date",
"markdownDescription": "Specifies how dates will be displayed by default",
"scope": "window"
},
"gitlens.defaultGravatarsStyle": {
@ -594,7 +594,7 @@
"gitlens.hovers.detailsMarkdownFormat": {
"type": "string",
"default": "[${avatar} &nbsp;__${author}__](mailto:${email}), ${ago} &nbsp; _(${date})_ \n\n${message}\n\n${commands}",
"markdownDescription": "Specifies the format (in markdown) of the _commit details_ hover. See the [GitLens docs](https://github.com/eamodio/vscode-gitlens/wiki/Advanced-Formatting) for advanced formatting\n- Available tokens\n - `${id}` &mdash; commit id\n - `${author}` &mdash; commit author\n - `${email}` &mdash; commit author e-mail\n - `${message}` &mdash; commit message\n - `${ago}` &mdash; relative commit date (e.g. 1 day ago)\n - `${date}` &mdash; formatted commit date (format specified by `#gitlens.defaultDateFormat#`)\n - `${agoOrDate}` &mdash; commit date specified by `#gitlens.defaultDateStyle#`\n - `${authorAgo}` &mdash; commit author, relative commit date\n - `${authorAgoOrDate}` &mdash; commit author, commit date specified by `#gitlens.defaultDateStyle#`\n - `${avatar}` &mdash; commit author avatar\n - `${commands}` &mdash; a set of commit commands",
"markdownDescription": "Specifies the format (in markdown) of the _commit details_ hover. See [_Commit Tokens_](https://github.com/eamodio/vscode-gitlens/wiki/Custom-Formatting#commit-tokens) in the GitLens docs",
"scope": "window"
},
"gitlens.hovers.enabled": {
@ -1238,7 +1238,7 @@
"gitlens.statusBar.dateFormat": {
"type": "string",
"default": null,
"markdownDescription": "Specifies the date format of absolute dates shown in the blame information in the status bar. See the [Moment.js docs](https://momentjs.com/docs/#/displaying/format/) for valid formats",
"markdownDescription": "Specifies how to format absolute dates (e.g. using the `${date}` token) in the blame information in the status bar. See the [Moment.js docs](https://momentjs.com/docs/#/displaying/format/) for valid formats",
"scope": "window"
},
"gitlens.statusBar.enabled": {
@ -1249,8 +1249,8 @@
},
"gitlens.statusBar.format": {
"type": "string",
"default": "${authorAgoOrDate}",
"markdownDescription": "Specifies the format of the gutter blame annotations. See the [GitLens docs](https://github.com/eamodio/vscode-gitlens/wiki/Advanced-Formatting) for advanced formatting\n- Available tokens\n - `${id}` &mdash; commit id\n - `${author}` &mdash; commit author\n - `${email}` &mdash; commit author e-mail\n - `${message}` &mdash; commit message\n - `${ago}` &mdash; relative commit date (e.g. 1 day ago)\n - `${date}` &mdash; formatted commit date (format specified by `#gitlens.statusBar.dateFormat#`)\n - `${agoOrDate}` &mdash; commit date specified by `#gitlens.defaultDateStyle#`\n - `${authorAgo}` &mdash; commit author, relative commit date\n - `${authorAgoOrDate}` &mdash; commit author, commit date specified by `#gitlens.defaultDateStyle#`",
"default": "${author}, ${agoOrDate}",
"markdownDescription": "Specifies the format of the blame information in the status bar. See [_Commit Tokens_](https://github.com/eamodio/vscode-gitlens/wiki/Custom-Formatting#commit-tokens) in the GitLens docs. Date formatting is controlled by the `#gitlens.statusBar.dateFormat#` setting",
"scope": "window"
},
"gitlens.statusBar.reduceFlicker": {
@ -1280,25 +1280,25 @@
"gitlens.views.commitFileFormat": {
"type": "string",
"default": "${file}",
"markdownDescription": "Specifies the format of a committed file in the views\n- Available tokens\n - `${directory}` &mdash; directory name\n - `${file}` &mdash; file name\n - `${filePath}` &mdash; formatted file name and path\n - `${originalPath}` &mdash; full file path of the original file if renamed\n - `${path}` &mdash; full file path",
"markdownDescription": "Specifies the format of a committed file in the views. See [_File Tokens_](https://github.com/eamodio/vscode-gitlens/wiki/Custom-Formatting#file-tokens) in the GitLens docs",
"scope": "window"
},
"gitlens.views.commitFileDescriptionFormat": {
"type": "string",
"default": "${directory}${ ← originalPath}",
"markdownDescription": "Specifies the description format of a committed file in the views\n- Available tokens\n - `${directory}` &mdash; directory name\n - `${file}` &mdash; file name\n - `${filePath}` &mdash; formatted file name and path\n - `${originalPath}` &mdash; full file path of the original file if renamed\n - `${path}` &mdash; full file path",
"markdownDescription": "Specifies the description format of a committed file in the views. See [_File Tokens_](https://github.com/eamodio/vscode-gitlens/wiki/Custom-Formatting#file-tokens) in the GitLens docs",
"scope": "window"
},
"gitlens.views.commitFormat": {
"type": "string",
"default": "${message}",
"markdownDescription": "Specifies the format of committed changes in the views. See the [GitLens docs](https://github.com/eamodio/vscode-gitlens/wiki/Advanced-Formatting) for advanced formatting\n- Available tokens\n - `${id}` &mdash; commit id\n - `${author}` &mdash; commit author\n - `${email}` &mdash; commit author e-mail\n - `${message}` &mdash; commit message\n - `${ago}` &mdash; relative commit date (e.g. 1 day ago)\n - `${date}` &mdash; formatted commit date (format specified by `#gitlens.defaultDateFormat#`)\n - `${agoOrDate}` &mdash; commit date specified by `#gitlens.defaultDateStyle#`\n - `${authorAgo}` &mdash; commit author, relative commit date\n - `${authorAgoOrDate}` &mdash; commit author, commit date specified by `#gitlens.defaultDateStyle#`",
"markdownDescription": "Specifies the format of committed changes in the views. See [_Commit Tokens_](https://github.com/eamodio/vscode-gitlens/wiki/Custom-Formatting#commit-tokens) in the GitLens docs",
"scope": "window"
},
"gitlens.views.commitDescriptionFormat": {
"type": "string",
"default": "${changes • }${authorAgoOrDate}",
"markdownDescription": "Specifies the description format of committed changes in the views. See the [GitLens docs](https://github.com/eamodio/vscode-gitlens/wiki/Advanced-Formatting) for advanced formatting\n- Available tokens\n - `${id}` &mdash; commit id\n - `${author}` &mdash; commit author\n - `${email}` &mdash; commit author e-mail\n - `${message}` &mdash; commit message\n - `${ago}` &mdash; relative commit date (e.g. 1 day ago)\n - `${date}` &mdash; formatted commit date (format specified by `#gitlens.defaultDateFormat#`)\n - `${agoOrDate}` &mdash; commit date specified by `#gitlens.defaultDateStyle#`\n - `${authorAgo}` &mdash; commit author, relative commit date\n - `${authorAgoOrDate}` &mdash; commit author, commit date specified by `#gitlens.defaultDateStyle#`",
"default": "${changes • }${author}, ${agoOrDate}",
"markdownDescription": "Specifies the description format of committed changes in the views. See [_Commit Tokens_](https://github.com/eamodio/vscode-gitlens/wiki/Custom-Formatting#commit-tokens) in the GitLens docs",
"scope": "window"
},
"gitlens.views.compare.avatars": {
@ -1590,37 +1590,37 @@
"gitlens.views.stashFileFormat": {
"type": "string",
"default": "${file}",
"markdownDescription": "Specifies the format of a stashed file in the views\n- Available tokens\n - `${directory}` &mdash; directory name\n - `${file}` &mdash; file name\n - `${filePath}` &mdash; formatted file name and path\n - `${originalPath}` &mdash; full file path of the original file if renamed\n - `${path}` &mdash; full file path",
"markdownDescription": "Specifies the format of a stashed file in the views. See [_File Tokens_](https://github.com/eamodio/vscode-gitlens/wiki/Custom-Formatting#file-tokens) in the GitLens docs",
"scope": "window"
},
"gitlens.views.stashFileDescriptionFormat": {
"type": "string",
"default": "${directory}${ ← originalPath}",
"markdownDescription": "Specifies the description format of a stashed file in the views\n- Available tokens\n - `${directory}` &mdash; directory name\n - `${file}` &mdash; file name\n - `${filePath}` &mdash; formatted file name and path\n - `${originalPath}` &mdash; full file path of the original file if renamed\n - `${path}` &mdash; full file path",
"markdownDescription": "Specifies the description format of a stashed file in the views. See [_File Tokens_](https://github.com/eamodio/vscode-gitlens/wiki/Custom-Formatting#file-tokens) in the GitLens docs",
"scope": "window"
},
"gitlens.views.stashFormat": {
"type": "string",
"default": "${message}",
"markdownDescription": "Specifies the format of stashed changes in the views. See the [GitLens docs](https://github.com/eamodio/vscode-gitlens/wiki/Advanced-Formatting) for advanced formatting\n- Available tokens\n - `${id}` &mdash; commit id\n - `${author}` &mdash; commit author\n - `${email}` &mdash; commit author e-mail\n - `${message}` &mdash; commit message\n - `${ago}` &mdash; relative commit date (e.g. 1 day ago)\n - `${date}` &mdash; formatted commit date (format specified by `#gitlens.defaultDateFormat#`)\n - `${agoOrDate}` &mdash; commit date specified by `#gitlens.defaultDateStyle#`\n - `${authorAgo}` &mdash; commit author, relative commit date\n - `${authorAgoOrDate}` &mdash; commit author, commit date specified by `#gitlens.defaultDateStyle#`",
"markdownDescription": "Specifies the format of stashed changes in the views. See [_Commit Tokens_](https://github.com/eamodio/vscode-gitlens/wiki/Custom-Formatting#commit-tokens) in the GitLens docs",
"scope": "window"
},
"gitlens.views.stashDescriptionFormat": {
"type": "string",
"default": "${changes • }${agoOrDate}",
"markdownDescription": "Specifies the description format of stashed changes in the views. See the [GitLens docs](https://github.com/eamodio/vscode-gitlens/wiki/Advanced-Formatting) for advanced formatting\n- Available tokens\n - `${id}` &mdash; commit id\n - `${author}` &mdash; commit author\n - `${email}` &mdash; commit author e-mail\n - `${message}` &mdash; commit message\n - `${ago}` &mdash; relative commit date (e.g. 1 day ago)\n - `${date}` &mdash; formatted commit date (format specified by `#gitlens.defaultDateFormat#`)\n - `${agoOrDate}` &mdash; commit date specified by `#gitlens.defaultDateStyle#`\n - `${authorAgo}` &mdash; commit author, relative commit date\n - `${authorAgoOrDate}` &mdash; commit author, commit date specified by `#gitlens.defaultDateStyle#`",
"markdownDescription": "Specifies the description format of stashed changes in the views. See [_Commit Tokens_](https://github.com/eamodio/vscode-gitlens/wiki/Custom-Formatting#commit-tokens) in the GitLens docs",
"scope": "window"
},
"gitlens.views.statusFileFormat": {
"type": "string",
"default": "${working }${file}",
"markdownDescription": "Specifies the format of the status of a working or committed file in the views\n- Available tokens\n - `${directory}` &mdash; directory name\n - `${file}` &mdash; file name\n - `${filePath}` &mdash; formatted file name and path\n - `${originalPath}` &mdash; full file path of the original file if renamed\n - `${path}` &mdash; full file path\n - `${working}` &mdash; optional indicator if the file is uncommitted",
"markdownDescription": "Specifies the format of the status of a working or committed file in the views. See [_File Tokens_](https://github.com/eamodio/vscode-gitlens/wiki/Custom-Formatting#file-tokens) in the GitLens docs",
"scope": "window"
},
"gitlens.views.statusFileDescriptionFormat": {
"type": "string",
"default": "${directory}${ ← originalPath}",
"markdownDescription": "Specifies the description format of the status of a working or committed file in the views\n- Available tokens\n - `${directory}` &mdash; directory name\n - `${file}` &mdash; file name\n - `${filePath}` &mdash; formatted file name and path\n - `${originalPath}` &mdash; full file path of the original file if renamed\n - `${path}` &mdash; full file path\n - `${working}` &mdash; optional indicator if the file is uncommitted",
"markdownDescription": "Specifies the description format of the status of a working or committed file in the views. See [_File Tokens_](https://github.com/eamodio/vscode-gitlens/wiki/Custom-Formatting#file-tokens) in the GitLens docs",
"scope": "window"
},
"gitlens.advanced.abbreviatedShaLength": {

+ 2
- 2
src/codelens/codeLensController.ts View File

@ -31,9 +31,9 @@ export class GitCodeLensController implements Disposable {
const section = configuration.name('codeLens').value;
if (
configuration.changed(e, section, null) ||
configuration.changed(e, configuration.name('defaultDateStyle').value) ||
configuration.changed(e, configuration.name('defaultDateFormat').value) ||
configuration.changed(e, configuration.name('defaultDateType').value)
configuration.changed(e, configuration.name('defaultDateSource').value) ||
configuration.changed(e, configuration.name('defaultDateStyle').value)
) {
if (!configuration.initializing(e)) {
Logger.log('CodeLens config changed; resetting CodeLens provider');

+ 4
- 4
src/config.ts View File

@ -29,8 +29,8 @@ export interface Config {
debug: boolean;
defaultDateFormat: string | null;
defaultDateShortFormat: string | null;
defaultDateSource: DateSource;
defaultDateStyle: DateStyle;
defaultDateType: DateType;
defaultGravatarsStyle: GravatarDefaultStyle;
heatmap: {
ageThreshold: number;
@ -128,9 +128,9 @@ export enum CustomRemoteType {
GitLab = 'GitLab'
}
export enum DateType {
Author = 'author',
Committer = 'committer'
export enum DateSource {
Authored = 'authored',
Committed = 'committed'
}
export enum DateStyle {

+ 31
- 1
src/extension.ts View File

@ -101,7 +101,37 @@ async function migrateSettings(context: ExtensionContext, previousVersion: strin
const previous = Versions.fromString(previousVersion);
try {
if (Versions.compare(previous, Versions.from(9, 2, 2)) !== 1) {
if (Versions.compare(previous, Versions.from(9, 6, 3)) !== 1) {
const formatMigrationFn = (v: string) => {
if (v == null || v.length === 0) return v;
return (
v
// eslint-disable-next-line no-template-curly-in-string
.replace(/\$\{authorAgo\}/g, '${author}, ${ago}')
// eslint-disable-next-line no-template-curly-in-string
.replace(/\$\{authorAgoOrDate\}/g, '${author}, ${agoOrDate}')
);
};
await Promise.all(
[
configuration.name('blame')('format').value,
configuration.name('currentLine')('format').value,
configuration.name('hovers')('detailsMarkdownFormat').value,
configuration.name('statusBar')('format').value,
configuration.name('views')('commitFormat').value,
configuration.name('views')('commitDescriptionFormat').value,
configuration.name('views')('stashFormat').value,
configuration.name('views')('stashDescriptionFormat').value
].map(s =>
configuration.migrate<string, string>(s, s, {
migrationFn: formatMigrationFn
})
)
);
}
else if (Versions.compare(previous, Versions.from(9, 2, 2)) !== 1) {
await configuration.migrate('views.avatars', configuration.name('views')('compare')('avatars').value);
await configuration.migrate('views.avatars', configuration.name('views')('repositories')('avatars').value);
await configuration.migrate('views.avatars', configuration.name('views')('search')('avatars').value);

+ 52
- 10
src/git/formatters/commitFormatter.ts View File

@ -48,26 +48,54 @@ export interface CommitFormatOptions extends FormatOptions {
}
export class CommitFormatter extends Formatter<GitCommit, CommitFormatOptions> {
private get _ago() {
return this._item.fromNow();
private get _authorDate() {
return this._item.formatAuthorDate(this._options.dateFormat);
}
private get _authorDateAgo() {
return this._item.formatAuthorDateFromNow();
}
private get _authorDateOrAgo() {
const dateStyle =
this._options.dateStyle !== undefined ? this._options.dateStyle : Container.config.defaultDateStyle;
return dateStyle === DateStyle.Absolute ? this._authorDate : this._authorDateAgo;
}
private get _committerDate() {
return this._item.formatCommitterDate(this._options.dateFormat);
}
private get _committerDateAgo() {
return this._item.formatCommitterDateFromNow();
}
private get _committerDateOrAgo() {
const dateStyle =
this._options.dateStyle !== undefined ? this._options.dateStyle : Container.config.defaultDateStyle;
return dateStyle === DateStyle.Absolute ? this._committerDate : this._committerDateAgo;
}
private get _date() {
return this._item.formatDate(this._options.dateFormat);
}
private get _agoOrDate() {
private get _dateAgo() {
return this._item.formatDateFromNow();
}
private get _dateOrAgo() {
const dateStyle =
this._options.dateStyle !== undefined ? this._options.dateStyle : Container.config.defaultDateStyle;
return dateStyle === DateStyle.Absolute ? this._date : this._ago;
return dateStyle === DateStyle.Absolute ? this._date : this._dateAgo;
}
get ago() {
return this._padOrTruncate(this._ago, this._options.tokenOptions.ago);
return this._padOrTruncate(this._dateAgo, this._options.tokenOptions.ago);
}
get agoOrDate() {
return this._padOrTruncate(this._agoOrDate, this._options.tokenOptions.agoOrDate);
return this._padOrTruncate(this._dateOrAgo, this._options.tokenOptions.agoOrDate);
}
get author() {
@ -75,13 +103,15 @@ export class CommitFormatter extends Formatter {
}
get authorAgo() {
const authorAgo = `${this._item.author}, ${this._ago}`;
return this._padOrTruncate(authorAgo, this._options.tokenOptions.authorAgo);
return this._padOrTruncate(this._authorDateAgo, this._options.tokenOptions.authorAgo);
}
get authorAgoOrDate() {
const authorAgo = `${this._item.author}, ${this._agoOrDate}`;
return this._padOrTruncate(authorAgo, this._options.tokenOptions.authorAgoOrDate);
return this._padOrTruncate(this._authorDateOrAgo, this._options.tokenOptions.authorAgoOrDate);
}
get authorDate() {
return this._padOrTruncate(this._authorDate, this._options.tokenOptions.date);
}
get avatar() {
@ -158,6 +188,18 @@ export class CommitFormatter extends Formatter {
return commands;
}
get committerAgo() {
return this._padOrTruncate(this._committerDateAgo, this._options.tokenOptions.ago);
}
get committerAgoOrDate() {
return this._padOrTruncate(this._committerDateOrAgo, this._options.tokenOptions.agoOrDate);
}
get committerDate() {
return this._padOrTruncate(this._committerDate, this._options.tokenOptions.date);
}
get date() {
return this._padOrTruncate(this._date, this._options.tokenOptions.date);
}

+ 2
- 2
src/git/gitService.ts View File

@ -167,9 +167,9 @@ export class GitService implements Disposable {
private onConfigurationChanged(e: ConfigurationChangeEvent) {
if (
configuration.changed(e, configuration.name('defaultDateStyle').value) ||
configuration.changed(e, configuration.name('defaultDateFormat').value) ||
configuration.changed(e, configuration.name('defaultDateType').value)
configuration.changed(e, configuration.name('defaultDateSource').value) ||
configuration.changed(e, configuration.name('defaultDateStyle').value)
) {
CommitFormatting.reset();
}

+ 53
- 31
src/git/models/commit.ts View File

@ -1,13 +1,12 @@
'use strict';
import { Uri } from 'vscode';
import { configuration, DateStyle, GravatarDefaultStyle } from '../../configuration';
import { configuration, DateSource, DateStyle, GravatarDefaultStyle } from '../../configuration';
import { Container } from '../../container';
import { Dates } from '../../system';
import { CommitFormatter } from '../formatters/formatters';
import { Git } from '../git';
import { GitUri } from '../gitUri';
import { getGravatarUri } from '../../gravatar';
import { DateType } from '../../config';
export interface GitAuthor {
name: string;
@ -32,13 +31,13 @@ export enum GitCommitType {
export const CommitFormatting = {
dateFormat: undefined! as string | null,
dateSource: undefined! as DateSource,
dateStyle: undefined! as DateStyle,
dateType: undefined! as DateType,
reset: () => {
CommitFormatting.dateStyle = configuration.get<DateStyle>(configuration.name('defaultDateStyle').value);
CommitFormatting.dateFormat = configuration.get<string | null>(configuration.name('defaultDateFormat').value);
CommitFormatting.dateType = configuration.get<DateType>(configuration.name('defaultDateType').value);
CommitFormatting.dateSource = configuration.get<DateSource>(configuration.name('defaultDateSource').value);
CommitFormatting.dateStyle = configuration.get<DateStyle>(configuration.name('defaultDateStyle').value);
}
};
@ -51,13 +50,12 @@ export abstract class GitCommit {
protected readonly _fileName: string;
protected _previousSha: string | undefined;
private _authorDateFormatter: Dates.DateFormatter | undefined;
private _committerDateFormatter: Dates.DateFormatter | undefined;
private _isStagedUncommitted: boolean | undefined;
private _isUncommitted: boolean | undefined;
private _shortSha: string | undefined;
private _authorDateFormatter: Dates.DateFormatter | undefined;
private _committerDateFormatter: Dates.DateFormatter | undefined;
constructor(
type: GitCommitType,
public readonly repoPath: string,
@ -85,33 +83,13 @@ export abstract class GitCommit {
}
get date(): Date {
return CommitFormatting.dateType === DateType.Committer
? this.committerDate : this.authorDate;
}
get authorDateFormatter(): Dates.DateFormatter {
if (this._authorDateFormatter === undefined) {
this._authorDateFormatter = Dates.toFormatter(this.authorDate);
}
return this._authorDateFormatter;
}
get committerDateFormatter(): Dates.DateFormatter {
if (this._committerDateFormatter === undefined) {
this._committerDateFormatter = Dates.toFormatter(this.committerDate);
}
return this._committerDateFormatter;
}
get dateFormatter(): Dates.DateFormatter {
return CommitFormatting.dateType === DateType.Committer
? this.committerDateFormatter : this.authorDateFormatter;
return CommitFormatting.dateSource === DateSource.Committed ? this.committerDate : this.authorDate;
}
get formattedDate(): string {
return CommitFormatting.dateStyle === DateStyle.Absolute
? this.formatDate(CommitFormatting.dateFormat)
: this.fromNow();
: this.formatDateFromNow();
}
get shortSha() {
@ -180,6 +158,50 @@ export abstract class GitCommit {
return this.workingFileName ? GitUri.resolveToUri(this.workingFileName, this.repoPath) : this.uri;
}
private get authorDateFormatter(): Dates.DateFormatter {
if (this._authorDateFormatter === undefined) {
this._authorDateFormatter = Dates.toFormatter(this.authorDate);
}
return this._authorDateFormatter;
}
private get committerDateFormatter(): Dates.DateFormatter {
if (this._committerDateFormatter === undefined) {
this._committerDateFormatter = Dates.toFormatter(this.committerDate);
}
return this._committerDateFormatter;
}
private get dateFormatter(): Dates.DateFormatter {
return CommitFormatting.dateSource === DateSource.Committed
? this.committerDateFormatter
: this.authorDateFormatter;
}
formatAuthorDate(format?: string | null) {
if (format == null) {
format = 'MMMM Do, YYYY h:mma';
}
return this.authorDateFormatter.format(format);
}
formatAuthorDateFromNow() {
return this.authorDateFormatter.fromNow();
}
formatCommitterDate(format?: string | null) {
if (format == null) {
format = 'MMMM Do, YYYY h:mma';
}
return this.committerDateFormatter.format(format);
}
formatCommitterDateFromNow() {
return this.committerDateFormatter.fromNow();
}
formatDate(format?: string | null) {
if (format == null) {
format = 'MMMM Do, YYYY h:mma';
@ -188,7 +210,7 @@ export abstract class GitCommit {
return this.dateFormatter.format(format);
}
fromNow() {
formatDateFromNow() {
return this.dateFormatter.fromNow();
}

+ 23
- 19
src/git/models/logCommit.ts View File

@ -17,8 +17,8 @@ export class GitLogCommit extends GitCommit {
sha: string,
author: string,
email: string | undefined,
date: Date,
public readonly committedDate: Date,
authorDate: Date,
committerDate: Date,
message: string,
fileName: string,
public readonly files: GitFile[],
@ -34,8 +34,8 @@ export class GitLogCommit extends GitCommit {
sha,
author,
email,
date,
committedDate,
authorDate,
committerDate,
message,
fileName,
originalFileName,
@ -97,20 +97,24 @@ export class GitLogCommit extends GitCommit {
return this._diff;
}
getFormattedDiffStatus(
options: {
compact?: boolean;
empty?: string;
expand?: boolean;
prefix?: string;
separator?: string;
suffix?: string;
} = {}
): string {
getFormattedDiffStatus({
compact,
empty,
expand,
prefix = '',
separator = ' ',
suffix = ''
}: {
compact?: boolean;
empty?: string;
expand?: boolean;
prefix?: string;
separator?: string;
suffix?: string;
} = {}): string {
const { added, changed, deleted } = this.getDiffStatus();
if (added === 0 && changed === 0 && deleted === 0) return options.empty || '';
if (added === 0 && changed === 0 && deleted === 0) return empty || '';
const { compact, expand, prefix = '', separator = ' ', suffix = '' } = options;
if (expand) {
let status = '';
if (added) {
@ -170,7 +174,7 @@ export class GitLogCommit extends GitCommit {
fileName?: string;
author?: string;
email?: string;
date?: Date;
authorDate?: Date;
committedDate?: Date;
message?: string;
originalFileName?: string | null;
@ -185,8 +189,8 @@ export class GitLogCommit extends GitCommit {
this.getChangedValue(changes.sha, this.sha)!,
changes.author || this.author,
changes.email || this.email,
changes.date || this.date,
changes.committedDate || this.committedDate,
changes.authorDate || this.authorDate,
changes.committedDate || this.committerDate,
changes.message || this.message,
changes.fileName || this.fileName,
this.getChangedValue(changes.files, this.files) || [],

+ 5
- 5
src/git/models/stashCommit.ts View File

@ -13,7 +13,7 @@ export class GitStashCommit extends GitLogCommit {
public readonly stashName: string,
repoPath: string,
sha: string,
date: Date,
authorDate: Date,
committedDate: Date,
message: string,
fileName: string,
@ -29,7 +29,7 @@ export class GitStashCommit extends GitLogCommit {
sha,
'You',
undefined,
date,
authorDate,
committedDate,
message,
fileName,
@ -49,7 +49,7 @@ export class GitStashCommit extends GitLogCommit {
type?: GitCommitType;
sha?: string | null;
fileName?: string;
date?: Date;
authorDate?: Date;
committedDate?: Date;
message?: string;
originalFileName?: string | null;
@ -63,8 +63,8 @@ export class GitStashCommit extends GitLogCommit {
this.stashName,
this.repoPath,
this.getChangedValue(changes.sha, this.sha)!,
changes.date || this.date,
changes.committedDate || this.committedDate,
changes.authorDate || this.authorDate,
changes.committedDate || this.committerDate,
changes.message || this.message,
changes.fileName || this.fileName,
this.getChangedValue(changes.files, this.files) || [],

+ 16
- 12
src/git/models/status.ts View File

@ -62,20 +62,24 @@ export class GitStatus {
return this._diff;
}
getFormattedDiffStatus(
options: {
compact?: boolean;
empty?: string;
expand?: boolean;
prefix?: string;
separator?: string;
suffix?: string;
} = {}
): string {
getFormattedDiffStatus({
compact,
empty,
expand,
prefix = '',
separator = ' ',
suffix = ''
}: {
compact?: boolean;
empty?: string;
expand?: boolean;
prefix?: string;
separator?: string;
suffix?: string;
} = {}): string {
const { added, changed, deleted } = this.getDiffStatus();
if (added === 0 && changed === 0 && deleted === 0) return options.empty || '';
if (added === 0 && changed === 0 && deleted === 0) return empty || '';
const { compact, expand, prefix = '', separator = ' ', suffix = '' } = options;
if (expand) {
let status = '';
if (added) {

+ 6
- 4
src/system/string.ts View File

@ -51,8 +51,11 @@ export namespace Strings {
export function getTokensFromTemplate(template: string) {
const tokens: { key: string; options: TokenOptions }[] = [];
let match = tokenRegex.exec(template);
while (match != null) {
let match;
do {
match = tokenRegex.exec(template);
if (match == null) break;
const [, prefix, key, truncateTo, option, suffix] = match;
tokens.push({
key: key,
@ -64,8 +67,7 @@ export namespace Strings {
truncateTo: truncateTo == null ? undefined : parseInt(truncateTo, 10)
}
});
match = tokenRegex.exec(template);
}
} while (match != null);
return tokens;
}

+ 1
- 1
src/views/nodes/helpers.ts View File

@ -55,7 +55,7 @@ export function* insertDateMarkers
time = date.setDate(date.getDate() - daysAgo);
}
const date = new Date(node.commit.committedDate.setUTCHours(0, 0, 0, 0)).getTime();
const date = new Date(node.commit.committerDate.setUTCHours(0, 0, 0, 0)).getTime();
if (date <= time) {
while (index < markers.length - 1) {
[daysAgo] = markers[index + 1];

+ 2
- 3
src/views/nodes/lineHistoryNode.ts View File

@ -73,9 +73,8 @@ export class LineHistoryNode extends SubscribeableViewNode {
commit.sha,
'You',
commit.email,
commit.date,
// TODO: Add committed date to blame?
commit.date,
commit.authorDate,
commit.committerDate,
commit.message,
commit.fileName,
[file],

Loading…
Cancel
Save