Browse Source

Adds repo view entry for staged changes

main
Eric Amodio 7 years ago
parent
commit
b1e4415b00
2 changed files with 36 additions and 5 deletions
  1. +2
    -0
      CHANGELOG.md
  2. +34
    -5
      src/views/statusFilesNode.ts

+ 2
- 0
CHANGELOG.md View File

@ -9,6 +9,8 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
- 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 blame annotations, navigation & comparison commands, etc
- Adds support for files with staged changes
- Adds new entry in the `Repository View` of the `GitLens` view
## [6.3.0-beta] - 2017-11-27
### Added

+ 34
- 5
src/views/statusFilesNode.ts View File

@ -43,13 +43,42 @@ export class StatusFilesNode extends ExplorerNode {
}
if (this.status.files.length !== 0 && this.includeWorkingTree) {
statuses.splice(0, 0, ...this.status.files.map(s => {
return {
...s,
commit: new GitLogCommit(GitCommitType.File, repoPath, GitService.uncommittedSha, s.fileName, 'You', new Date(), '', s.status, [s], s.originalFileName, 'HEAD', s.fileName)
} as IGitStatusFileWithCommit;
statuses.splice(0, 0, ...Iterables.flatMap(this.status.files, s => {
if (s.workTreeStatus !== undefined && s.indexStatus !== undefined) {
// Decrements the date to guarantee this entry will be sorted after the previous entry (most recent first)
const older = new Date();
older.setMilliseconds(older.getMilliseconds() - 1);
return [
{
...s,
commit: new GitLogCommit(GitCommitType.File, repoPath, GitService.uncommittedSha, s.fileName, 'You', new Date(), '', s.status, [s], s.originalFileName, GitService.stagedUncommittedSha, s.fileName)
} as IGitStatusFileWithCommit,
{
...s,
commit: new GitLogCommit(GitCommitType.File, repoPath, GitService.stagedUncommittedSha, s.fileName, 'You', older, '', s.status, [s], s.originalFileName, 'HEAD', s.fileName)
} as IGitStatusFileWithCommit
];
}
else if (s.indexStatus !== undefined) {
return [
{
...s,
commit: new GitLogCommit(GitCommitType.File, repoPath, GitService.stagedUncommittedSha, s.fileName, 'You', new Date(), '', s.status, [s], s.originalFileName, 'HEAD', s.fileName)
} as IGitStatusFileWithCommit
];
}
else {
return [
{
...s,
commit: new GitLogCommit(GitCommitType.File, repoPath, GitService.uncommittedSha, s.fileName, 'You', new Date(), '', s.status, [s], s.originalFileName, 'HEAD', s.fileName)
} as IGitStatusFileWithCommit
];
}
}));
}
statuses.sort((a, b) => b.commit.date.getTime() - a.commit.date.getTime());
const groups = Arrays.groupBy(statuses, s => s.fileName);

Loading…
Cancel
Save