Skip to content

Commit f7df845

Browse files
committed
Adds working tree status to custom view (insiders)
Hides working changed files behind insiders flag Unhides Changed Files node from behind insiders flag Adds changed file count to Changed Files node label Adds icon to Changed Files node Adds upstream branch to upstream status nodes Sorts files in the Changed Files node
1 parent 712544f commit f7df845

File tree

14 files changed

+81
-27
lines changed

14 files changed

+81
-27
lines changed

CHANGELOG.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,14 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
66

77
## [Unreleased]
88

9-
## [5.2.0-beta]
9+
## [5.2.0-beta] - 2017-09-20
1010
### Added
11+
- Adds working tree status (enabled via `"gitlens.insiders": true`) to the `Repository Status` node in the `GitLens` custom view
1112
- Adds new `Changed Files` node to the `Repository Status` node of the `GitLens` custom view's `Repository View` -- closes [#139](https://github.com/eamodio/vscode-gitlens/issues/139)
12-
- Provides a file-based view of all the changed files in the working tree (enabled via `"gitlens.insiders": true`) and/or files in commits that haven't yet been pushed upstream
13+
- Provides a at-a-glance view of all "working" changes
14+
- 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
1315
- Adds `gitlens.gitExplorer.enabled` setting to specify whether or not to show the `GitLens` custom view - closes [#144](https://github.com/eamodio/vscode-gitlens/issues/144)
16+
- Adds `gitlens.gitExplorer.statusFileFormat` setting to the format of the status of a working or committed file in the `GitLens` custom view
1417

1518
### Changed
1619
- Changes the sorting (now alphabetical) of files shown in the `GitLens` custom view

README.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,13 +126,17 @@ GitLens provides an unobtrusive blame annotation at the end of the current line,
126126
![GitLens Repository view](https://raw.githubusercontent.com/eamodio/vscode-gitlens/master/images/screenshot-git-custom-view-repository.png)
127127

128128
- `Repository Status` node — provides the status of the repository
129-
- Provides the name of the current branch, its upstream tracking branch (if available), and its upstream status (if available)
129+
- Provides the name of the current branch, its working tree status (enabled via `"gitlens.insiders": true`), and its upstream tracking branch and status (if available)
130130
- Provides indicator dots on the repository icon which denote the following:
131131
- `None` - up-to-date with the upstream
132132
- `Green` - ahead of the upstream
133133
- `Red` - behind the upstream
134134
- `Yellow` - both ahead of and behind the upstream
135-
- Provides additional nodes, if the current branch is not synchronized with the upstream, to quickly see and explore the specific commits ahead and/or behind the upstream
135+
- Provides additional upstream status nodes, if the current branch is tracking a remote branch and
136+
- is behind the upstream — quickly see and explore the specific commits behind the upstream (i.e. commits that haven't been pulled)
137+
- is ahead of the upstream — quickly see and explore the specific commits ahead of the upstream (i.e. commits that haven't been pushed)
138+
- `Changed Files` node — provides a at-a-glance view of all "working" changes
139+
- 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
136140
- Provides a context menu with `Open Repository in Remote`, and `Refresh` commands
137141

138142
- `Branches` node — provides a list of the local branches
@@ -357,6 +361,7 @@ GitLens is highly customizable and provides many configuration settings to allow
357361
|`gitlens.gitExplorer.commitFileFormat`|Specifies the format of a committed file in the `GitLens` custom view<br />Available tokens<br /> ${file} - file name<br /> ${filePath} - file name and path<br /> ${path} - file path
358362
|`gitlens.gitExplorer.stashFormat`|Specifies the format of stashed changes in the `GitLens` custom view<br />Available tokens<br /> ${id} - commit id<br /> ${author} - commit author<br /> ${message} - commit message<br /> ${ago} - relative commit date (e.g. 1 day ago)<br /> ${date} - formatted commit date (format specified by `gitlens.statusBar.dateFormat`)<br /> ${authorAgo} - commit author, relative commit date<br />See https://github.com/eamodio/vscode-gitlens/wiki/Advanced-Formatting for advanced formatting
359363
|`gitlens.gitExplorer.stashFileFormat`|Specifies the format of a stashed file in the `GitLens` custom view<br />Available tokens<br /> ${file} - file name<br /> ${filePath} - file name and path<br /> ${path} - file path
364+
|`gitlens.gitExplorer.statusFileFormat`|Specifies the format of the status of a working or committed file in the `GitLens` custom view<br />Available tokens<br /> ${file} - file name<br /> ${filePath} - file name and path<br /> ${path} - file path<br />${working} - optional indicator if the file is uncommitted
360365

361366
### Custom Remotes Settings
362367

images/dark/icon-diff.svg

Lines changed: 4 additions & 0 deletions
Loading

images/light/icon-diff.svg

Lines changed: 4 additions & 0 deletions
Loading

package.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -443,6 +443,11 @@
443443
"default": "${filePath}",
444444
"description": "Specifies the format of a stashed file in the `GitLens` custom view\nAvailable tokens\n ${file} - file name\n ${filePath} - file name and path\n ${path} - file path"
445445
},
446+
"gitlens.gitExplorer.statusFileFormat": {
447+
"type": "string",
448+
"default": "${working}${filePath}",
449+
"description": "Specifies the format of the status of a working or committed file in the `GitLens` custom view\nAvailable tokens\n ${file} - file name\n ${filePath} - file name and path\n ${path} - file path\n ${working} - optional indicator if the file is uncommitted"
450+
},
446451
"gitlens.gitExplorer.view": {
447452
"type": "string",
448453
"default": "repository",

src/configuration.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -324,6 +324,7 @@ export interface IConfig {
324324
commitFileFormat: string;
325325
stashFormat: string;
326326
stashFileFormat: string;
327+
statusFileFormat: string;
327328
// dateFormat: string | null;
328329
};
329330

src/constants.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,10 +81,12 @@ export type GlyphChars = '\u21a9' |
8181
'\u21e8' |
8282
'\u2191' |
8383
'\u2197' |
84+
'\u2217' |
8485
'\u2713' |
8586
'\u2014' |
8687
'\u2022' |
8788
'\u2026' |
89+
'\u270E' |
8890
'\u00a0' |
8991
'\u200b';
9092
export const GlyphChars = {
@@ -97,10 +99,12 @@ export const GlyphChars = {
9799
ArrowRightHollow: '\u21e8' as GlyphChars,
98100
ArrowUp: '\u2191' as GlyphChars,
99101
ArrowUpRight: '\u2197' as GlyphChars,
102+
Asterisk: '\u2217' as GlyphChars,
100103
Check: '\u2713' as GlyphChars,
101104
Dash: '\u2014' as GlyphChars,
102105
Dot: '\u2022' as GlyphChars,
103106
Ellipsis: '\u2026' as GlyphChars,
107+
Pensil: '\u270E' as GlyphChars,
104108
Space: '\u00a0' as GlyphChars,
105109
ZeroWidthSpace: '\u200b' as GlyphChars
106110
};

src/git/formatters/status.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
'use strict';
22
import { Strings } from '../../system';
3+
import { GlyphChars } from '../../constants';
34
import { Formatter, IFormatOptions } from './formatter';
4-
import { GitStatusFile, IGitStatusFile } from '../models/status';
5+
import { GitStatusFile, IGitStatusFile, IGitStatusFileWithCommit } from '../models/status';
56
import * as path from 'path';
67

78
export interface IStatusFormatOptions extends IFormatOptions {
@@ -29,6 +30,11 @@ export class StatusFileFormatter extends Formatter<IGitStatusFile, IStatusFormat
2930
return this._padOrTruncate(directory, this._options.tokenOptions!.file);
3031
}
3132

33+
get working() {
34+
const commit = (this._item as IGitStatusFileWithCommit).commit;
35+
return (commit !== undefined && commit.isUncommitted) ? `${GlyphChars.Pensil} ${GlyphChars.Space}` : '';
36+
}
37+
3238
static fromTemplate(template: string, status: IGitStatusFile, dateFormat: string | null): string;
3339
static fromTemplate(template: string, status: IGitStatusFile, options?: IStatusFormatOptions): string;
3440
static fromTemplate(template: string, status: IGitStatusFile, dateFormatOrOptions?: string | null | IStatusFormatOptions): string;

src/git/models/status.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { Strings } from '../../system';
33
import { Uri } from 'vscode';
44
import { GlyphChars } from '../../constants';
55
import { GitUri } from '../gitUri';
6+
import { GitLogCommit } from './logCommit';
67
import * as path from 'path';
78

89
export interface GitStatus {
@@ -27,6 +28,10 @@ export interface IGitStatusFile {
2728
originalFileName?: string;
2829
}
2930

31+
export interface IGitStatusFileWithCommit extends IGitStatusFile {
32+
commit: GitLogCommit;
33+
}
34+
3035
export class GitStatusFile implements IGitStatusFile {
3136

3237
originalFileName?: string;

src/views/gitExplorer.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,8 @@ export class GitExplorer implements TreeDataProvider<ExplorerNode> {
116116
private onConfigurationChanged() {
117117
const cfg = workspace.getConfiguration().get<IConfig>(ExtensionKey)!;
118118

119-
if (!Objects.areEquivalent(cfg.gitExplorer, this._config && this._config.gitExplorer)) {
119+
if (!Objects.areEquivalent(cfg.gitExplorer, this._config && this._config.gitExplorer) ||
120+
!Objects.areEquivalent(cfg.insiders, this._config && this._config.insiders)) {
120121
setTimeout(() => {
121122
this._root = this.getRootNode(window.activeTextEditor);
122123
this.refresh();

0 commit comments

Comments
 (0)