Skip to content

Commit

Permalink
Adds dotted notation setting - closes #330
Browse files Browse the repository at this point in the history
  • Loading branch information
eamodio committed May 22, 2019
1 parent 71b42af commit 834c452
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 18 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
- A context menu provides access to more common file revision commands
- **\* Files Changed** — lists all of the files changed between the compared revisions
- Adds a `gitlens.views.repositories.showBranchComparison` setting to specify whether to show a comparison of the current branch to a user-selected reference in the _Repositories_ view
- Adds a `gitlens.advanced.useSymmetricDifferenceNotation` setting to specify whether to use the symmetric difference (three-dot) notation or the range (two-dot) notation for comparisions — closes [#330](https://github.com/eamodio/vscode-gitlens/issues/330)
- Adds a _Copy Remote Url to Clipboard_ command to commit quick pick menus

## Changed
Expand Down
31 changes: 16 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -858,21 +858,22 @@ See also [View Settings](#view-settings- 'Jump to the View settings')

### Advanced Settings [#](#advanced-settings- 'Advanced Settings')

| Name | Description |
| ----------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------- |
| `gitlens.advanced.abbreviatedShaLength` | Specifies the length of abbreviated commit ids (shas) |
| `gitlens.advanced.blame.customArguments` | Specifies additional arguments to pass to the `git blame` command |
| `gitlens.advanced.blame.delayAfterEdit` | Specifies the time (in milliseconds) to wait before re-blaming an unsaved document after an edit. Use 0 to specify an infinite wait |
| `gitlens.advanced.blame.sizeThresholdAfterEdit` | Specifies the maximum document size (in lines) allowed to be re-blamed after an edit while still unsaved. Use 0 to specify no maximum |
| `gitlens.advanced.caching.enabled` | Specifies whether git output will be cached — changing the default is not recommended |
| `gitlens.advanced.fileHistoryFollowsRenames` | Specifies whether file histories will follow renames -- will affect how merge commits are shown in histories |
| `gitlens.advanced.maxListItems` | Specifies the maximum number of items to show in a list. Use 0 to specify no maximum |
| `gitlens.advanced.maxSearchItems` | Specifies the maximum number of items to show in a search. Use 0 to specify no maximum |
| `gitlens.advanced.messages` | Specifies which messages should be suppressed |
| `gitlens.advanced.quickPick.closeOnFocusOut` | Specifies whether to close QuickPick menus when focus is lost |
| `gitlens.advanced.repositorySearchDepth` | Specifies how many folders deep to search for repositories |
| `gitlens.advanced.similarityThreshold` | Specifies the amount (percent) of similarity a deleted and added file pair must have to be considered a rename |
| `gitlens.advanced.telemetry.enabled` | Specifies whether to enable GitLens telemetry (even if enabled still abides by the overall `telemetry.enableTelemetry` setting |
| Name | Description |
| ------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `gitlens.advanced.abbreviatedShaLength` | Specifies the length of abbreviated commit ids (shas) |
| `gitlens.advanced.blame.customArguments` | Specifies additional arguments to pass to the `git blame` command |
| `gitlens.advanced.blame.delayAfterEdit` | Specifies the time (in milliseconds) to wait before re-blaming an unsaved document after an edit. Use 0 to specify an infinite wait |
| `gitlens.advanced.blame.sizeThresholdAfterEdit` | Specifies the maximum document size (in lines) allowed to be re-blamed after an edit while still unsaved. Use 0 to specify no maximum |
| `gitlens.advanced.caching.enabled` | Specifies whether git output will be cached — changing the default is not recommended |
| `gitlens.advanced.fileHistoryFollowsRenames` | Specifies whether file histories will follow renames -- will affect how merge commits are shown in histories |
| `gitlens.advanced.maxListItems` | Specifies the maximum number of items to show in a list. Use 0 to specify no maximum |
| `gitlens.advanced.maxSearchItems` | Specifies the maximum number of items to show in a search. Use 0 to specify no maximum |
| `gitlens.advanced.messages` | Specifies which messages should be suppressed |
| `gitlens.advanced.quickPick.closeOnFocusOut` | Specifies whether to close QuickPick menus when focus is lost |
| `gitlens.advanced.repositorySearchDepth` | Specifies how many folders deep to search for repositories |
| `gitlens.advanced.similarityThreshold` | Specifies the amount (percent) of similarity a deleted and added file pair must have to be considered a rename |
| `gitlens.advanced.telemetry.enabled` | Specifies whether to enable GitLens telemetry (even if enabled still abides by the overall `telemetry.enableTelemetry` setting |
| `gitlens.advanced.useSymmetricDifferenceNotation` | Specifies whether to use the symmetric difference (three-dot) notation or the range (two-dot) notation for comparisions. See the [Git docs](https://git-scm.com/docs/gitrevisions#_dotted_range_notations) |

#### Custom Remotes Settings

Expand Down
6 changes: 6 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -1752,6 +1752,12 @@
"default": true,
"markdownDescription": "Specifies whether to enable GitLens telemetry (even if enabled still abides by the overall `#telemetry.enableTelemetry#` setting",
"scope": "window"
},
"gitlens.advanced.useSymmetricDifferenceNotation": {
"type": "boolean",
"default": true,
"markdownDescription": "Specifies whether to use the symmetric difference (three-dot) notation or the range (two-dot) notation for comparisions. See the [Git docs](https://git-scm.com/docs/gitrevisions#_dotted_range_notations)",
"scope": "window"
}
}
},
Expand Down
1 change: 1 addition & 0 deletions src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,7 @@ export interface AdvancedConfig {
telemetry: {
enabled: boolean;
};
useSymmetricDifferenceNotation: boolean;
}

export interface CodeLensConfig {
Expand Down
6 changes: 4 additions & 2 deletions src/views/nodes/compareBranchNode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export class CompareBranchNode extends ViewNode<RepositoriesView> {
querying: true
}
),
new ResultsFilesNode(this.view, this, this.uri.repoPath!, this.branch.ref, this._compareWith)
new ResultsFilesNode(this.view, this, this.uri.repoPath!, this._compareWith, this.branch.ref)
];
}
return this._children;
Expand Down Expand Up @@ -102,9 +102,11 @@ export class CompareBranchNode extends ViewNode<RepositoriesView> {
}

private async getCommitsQuery(maxCount: number | undefined): Promise<CommitsQueryResults> {
const notation = Container.config.advanced.useSymmetricDifferenceNotation ? '...' : '..';

const log = await Container.git.getLog(this.uri.repoPath!, {
maxCount: maxCount,
ref: `${this.branch.ref}...${this._compareWith || 'HEAD'}`
ref: `${this._compareWith || 'HEAD'}${notation}${this.branch.ref}`
});

const count = log !== undefined ? log.count : 0;
Expand Down
4 changes: 3 additions & 1 deletion src/views/nodes/compareResultsNode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,9 +148,11 @@ export class CompareResultsNode extends SubscribeableViewNode<CompareView> {
}

private async getCommitsQuery(maxCount: number | undefined): Promise<CommitsQueryResults> {
const notation = Container.config.advanced.useSymmetricDifferenceNotation ? '...' : '..';

const log = await Container.git.getLog(this.uri.repoPath!, {
maxCount: maxCount,
ref: `${this._ref1.ref}...${this._ref2.ref || 'HEAD'}`
ref: `${this._ref1.ref}${notation}${this._ref2.ref || 'HEAD'}`
});

const count = log !== undefined ? log.count : 0;
Expand Down

0 comments on commit 834c452

Please sign in to comment.