Skip to content

Commit 834c452

Browse files
committed
Adds dotted notation setting - closes #330
1 parent 71b42af commit 834c452

File tree

6 files changed

+31
-18
lines changed

6 files changed

+31
-18
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
1717
- A context menu provides access to more common file revision commands
1818
- **\* Files Changed** — lists all of the files changed between the compared revisions
1919
- 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
20+
- 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)
2021
- Adds a _Copy Remote Url to Clipboard_ command to commit quick pick menus
2122

2223
## Changed

README.md

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -858,21 +858,22 @@ See also [View Settings](#view-settings- 'Jump to the View settings')
858858

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

861-
| Name | Description |
862-
| ----------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------- |
863-
| `gitlens.advanced.abbreviatedShaLength` | Specifies the length of abbreviated commit ids (shas) |
864-
| `gitlens.advanced.blame.customArguments` | Specifies additional arguments to pass to the `git blame` command |
865-
| `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 |
866-
| `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 |
867-
| `gitlens.advanced.caching.enabled` | Specifies whether git output will be cached — changing the default is not recommended |
868-
| `gitlens.advanced.fileHistoryFollowsRenames` | Specifies whether file histories will follow renames -- will affect how merge commits are shown in histories |
869-
| `gitlens.advanced.maxListItems` | Specifies the maximum number of items to show in a list. Use 0 to specify no maximum |
870-
| `gitlens.advanced.maxSearchItems` | Specifies the maximum number of items to show in a search. Use 0 to specify no maximum |
871-
| `gitlens.advanced.messages` | Specifies which messages should be suppressed |
872-
| `gitlens.advanced.quickPick.closeOnFocusOut` | Specifies whether to close QuickPick menus when focus is lost |
873-
| `gitlens.advanced.repositorySearchDepth` | Specifies how many folders deep to search for repositories |
874-
| `gitlens.advanced.similarityThreshold` | Specifies the amount (percent) of similarity a deleted and added file pair must have to be considered a rename |
875-
| `gitlens.advanced.telemetry.enabled` | Specifies whether to enable GitLens telemetry (even if enabled still abides by the overall `telemetry.enableTelemetry` setting |
861+
| Name | Description |
862+
| ------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
863+
| `gitlens.advanced.abbreviatedShaLength` | Specifies the length of abbreviated commit ids (shas) |
864+
| `gitlens.advanced.blame.customArguments` | Specifies additional arguments to pass to the `git blame` command |
865+
| `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 |
866+
| `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 |
867+
| `gitlens.advanced.caching.enabled` | Specifies whether git output will be cached — changing the default is not recommended |
868+
| `gitlens.advanced.fileHistoryFollowsRenames` | Specifies whether file histories will follow renames -- will affect how merge commits are shown in histories |
869+
| `gitlens.advanced.maxListItems` | Specifies the maximum number of items to show in a list. Use 0 to specify no maximum |
870+
| `gitlens.advanced.maxSearchItems` | Specifies the maximum number of items to show in a search. Use 0 to specify no maximum |
871+
| `gitlens.advanced.messages` | Specifies which messages should be suppressed |
872+
| `gitlens.advanced.quickPick.closeOnFocusOut` | Specifies whether to close QuickPick menus when focus is lost |
873+
| `gitlens.advanced.repositorySearchDepth` | Specifies how many folders deep to search for repositories |
874+
| `gitlens.advanced.similarityThreshold` | Specifies the amount (percent) of similarity a deleted and added file pair must have to be considered a rename |
875+
| `gitlens.advanced.telemetry.enabled` | Specifies whether to enable GitLens telemetry (even if enabled still abides by the overall `telemetry.enableTelemetry` setting |
876+
| `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) |
876877

877878
#### Custom Remotes Settings
878879

package.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1752,6 +1752,12 @@
17521752
"default": true,
17531753
"markdownDescription": "Specifies whether to enable GitLens telemetry (even if enabled still abides by the overall `#telemetry.enableTelemetry#` setting",
17541754
"scope": "window"
1755+
},
1756+
"gitlens.advanced.useSymmetricDifferenceNotation": {
1757+
"type": "boolean",
1758+
"default": true,
1759+
"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)",
1760+
"scope": "window"
17551761
}
17561762
}
17571763
},

src/config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,7 @@ export interface AdvancedConfig {
224224
telemetry: {
225225
enabled: boolean;
226226
};
227+
useSymmetricDifferenceNotation: boolean;
227228
}
228229

229230
export interface CodeLensConfig {

src/views/nodes/compareBranchNode.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ export class CompareBranchNode extends ViewNode<RepositoriesView> {
4444
querying: true
4545
}
4646
),
47-
new ResultsFilesNode(this.view, this, this.uri.repoPath!, this.branch.ref, this._compareWith)
47+
new ResultsFilesNode(this.view, this, this.uri.repoPath!, this._compareWith, this.branch.ref)
4848
];
4949
}
5050
return this._children;
@@ -102,9 +102,11 @@ export class CompareBranchNode extends ViewNode<RepositoriesView> {
102102
}
103103

104104
private async getCommitsQuery(maxCount: number | undefined): Promise<CommitsQueryResults> {
105+
const notation = Container.config.advanced.useSymmetricDifferenceNotation ? '...' : '..';
106+
105107
const log = await Container.git.getLog(this.uri.repoPath!, {
106108
maxCount: maxCount,
107-
ref: `${this.branch.ref}...${this._compareWith || 'HEAD'}`
109+
ref: `${this._compareWith || 'HEAD'}${notation}${this.branch.ref}`
108110
});
109111

110112
const count = log !== undefined ? log.count : 0;

src/views/nodes/compareResultsNode.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,9 +148,11 @@ export class CompareResultsNode extends SubscribeableViewNode<CompareView> {
148148
}
149149

150150
private async getCommitsQuery(maxCount: number | undefined): Promise<CommitsQueryResults> {
151+
const notation = Container.config.advanced.useSymmetricDifferenceNotation ? '...' : '..';
152+
151153
const log = await Container.git.getLog(this.uri.repoPath!, {
152154
maxCount: maxCount,
153-
ref: `${this._ref1.ref}...${this._ref2.ref || 'HEAD'}`
155+
ref: `${this._ref1.ref}${notation}${this._ref2.ref || 'HEAD'}`
154156
});
155157

156158
const count = log !== undefined ? log.count : 0;

0 commit comments

Comments
 (0)