|
1 | 1 | import type { TextEditor, Uri } from 'vscode'; |
2 | 2 | import type { Container } from '../container'; |
| 3 | +import { createReference } from '../git/utils/reference.utils'; |
3 | 4 | import { showGenericErrorMessage } from '../messages'; |
| 5 | +import { showComparisonPicker } from '../quickpicks/comparisonPicker'; |
4 | 6 | import { getBestRepositoryOrShowPicker } from '../quickpicks/repositoryPicker'; |
5 | 7 | import { command } from '../system/-webview/command'; |
6 | 8 | import { Logger } from '../system/logger'; |
@@ -68,10 +70,19 @@ export class CompareWithCommand extends ActiveEditorCommand { |
68 | 70 | const repoPath = (await getBestRepositoryOrShowPicker(this.container, uri, editor, title))?.path; |
69 | 71 | if (!repoPath) return; |
70 | 72 |
|
| 73 | + if (args.ref1 == null || args.ref2 == null) { |
| 74 | + const result = await showComparisonPicker(this.container, repoPath, { |
| 75 | + head: args.ref1 != null ? createReference(args.ref1, repoPath) : undefined, |
| 76 | + base: args.ref2 != null ? createReference(args.ref2, repoPath) : undefined, |
| 77 | + }); |
| 78 | + if (result == null) return; |
| 79 | + |
| 80 | + args.ref1 = result.head.ref; |
| 81 | + args.ref2 = result.base.ref; |
| 82 | + } |
| 83 | + |
71 | 84 | if (args.ref1 != null && args.ref2 != null) { |
72 | 85 | await this.container.views.searchAndCompare.compare(repoPath, args.ref1, args.ref2); |
73 | | - } else { |
74 | | - this.container.views.searchAndCompare.selectForCompare(repoPath, args.ref1, { prompt: true }); |
75 | 86 | } |
76 | 87 | } catch (ex) { |
77 | 88 | Logger.error(ex, 'CompareWithCommmand'); |
|
0 commit comments