jacekkopecky / vscode-whole-diff

Whole Diff extension for VSCode
MIT License
10 stars 2 forks source link

Diff between arbitrary branches #6

Closed scfrazer closed 1 month ago

scfrazer commented 1 year ago

Let me start with what I really want: The ability to diff between the current branch and what is on master (or main or trunk or whatever). Essentially a preview of what a PR would have in it. This idea could be generalized to any two branches. It looks like this can almost be done as-is, but it is tied to GitLens. I'd like the ability to, say, enter the branch or branches in a quick input dialog thing.

I have some experience writing extensions if you are too busy to work on this and are accepting PRs.

jacekkopecky commented 1 year ago

Hi, yes, I use GitLens so I just put the whole-diff button everywhere where I want it in GitLens views, but the extension should not be constrained to GitLens.

If you feel like doing it: to start with, there is a command whole-diff.showWholeDiffBySha which could be a good one to extend. Currently it requires an SHA string (extension.ts lines 53 and 61). It could support more input formats so you could type main...yourbranch and it could give you the PR for yourbranch.

Alternatively, outside the whole-diff extension, you create custom commands to open diffs like this:

const uri = vscode.Uri.from({ scheme: 'whole-diff-fs', path: '/Users/you/repofolder/main...yourbranch.diff' });
await vscode.commands.executeCommand(
  'vscode.openWith',
  uri,
  'diffViewer',
);

I'll consider any PR, and I'll be happy to review work in progress.

jacekkopecky commented 1 month ago

Closing as solved outside of the extension; PRs welcome anyway.