Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

open any file from another branch #708

Closed
emmanueltouzery opened this issue Apr 11, 2019 · 7 comments · Fixed by #2825
Closed

open any file from another branch #708

emmanueltouzery opened this issue Apr 11, 2019 · 7 comments · Fixed by #2825
Assignees
Labels
feature New feature or request help wanted Want community input and/or pull request verified ✔ Verified
Milestone

Comments

@emmanueltouzery
Copy link

Recently #646 was implemented, but it doesn't completely work for me. The reason being that sometimes a file is renamed, and then the command (understandably) fails. In emacs/magit this is handled like that: you run the command, then by default the same filename as your current file is displayed and you just press enter if you want the same filename, but you can edit the filename if needed.

Maybe that gitlens feature, gitlens.openFileRevisionFromBranch, could be improved so that if it doesn't find the file in another branch, it doesn't fail but rather gives the user the opportunity to manually specify a filename.

In my case I renamed a .ts file to .tsx, but there could be many examples of renaming files.

@eamodio eamodio added feature New feature or request and removed improvement labels Dec 15, 2020
@danielpickett
Copy link

I would LOVE this feature. Any movement on this?

@eamodio eamodio added the help wanted Want community input and/or pull request label Mar 17, 2023
@eamodio
Copy link
Member

eamodio commented Mar 17, 2023

I can see this being a useful feature, but we (the GitLens team) aren't going to look at it anytime soon, so if the community wanted to open a PR for it we'd definitely be open to accepting it.

mogelbrod added a commit to mogelbrod/vscode-gitlens that referenced this issue Jul 20, 2023
Improves the `openFileAtRevision()` function by:
- Asking user to enter another path when the requested file doesn't exist in the
  selected revision.
- Showing an error message on subsequent failure (or if an error is thrown).

The above function is used by a number of commands:
- `gitlens.openFileRevision`
- `gitlens.openFileRevisionFrom`
- `gitlens.openRevisionFile`

Also renames the `rethrow` argument of `utils.openEditor()` to `throwOnError` to
align it with `utils.findOrOpenEditor()`.
mogelbrod added a commit to mogelbrod/vscode-gitlens that referenced this issue Jul 20, 2023
Improves the `openFileAtRevision()` function by:
- Asking user to enter another path when the requested file doesn't exist in the
  selected revision.
- Showing an error message on subsequent failure (or if an error is thrown).

The above function is used by a number of commands:
- `gitlens.openFileRevision`
- `gitlens.openFileRevisionFrom`
- `gitlens.openRevisionFile`

Also renames the `rethrow` argument of `utils.openEditor()` to `throwOnError` to
align it with `utils.findOrOpenEditor()`.
mogelbrod added a commit to mogelbrod/vscode-gitlens that referenced this issue Jul 20, 2023
Improves the `openFileAtRevision()` function by:
- Asking user to enter another path when the requested file doesn't exist in the
  selected revision.
- Showing an error message on subsequent failure (or if an error is thrown).

The above function is used by a number of commands:
- `gitlens.openFileRevision`
- `gitlens.openFileRevisionFrom`
- `gitlens.openRevisionFile`

Also renames the `rethrow` argument of `utils.openEditor()` to `throwOnError` to
align it with `utils.findOrOpenEditor()`.
mogelbrod added a commit to mogelbrod/vscode-gitlens that referenced this issue Jul 23, 2023
Improves the `openFileAtRevision()` function by:
- Asking user to enter another path when the requested file doesn't exist in the
  selected revision.
- Showing an error message on subsequent failure (or if an error is thrown).

The above function is used by a number of commands:
- `gitlens.openFileRevision`
- `gitlens.openFileRevisionFrom`
- `gitlens.openRevisionFile`

Also renames the `rethrow` argument of `utils.openEditor()` to `throwOnError` to
align it with `utils.findOrOpenEditor()`.
mogelbrod added a commit to mogelbrod/vscode-gitlens that referenced this issue Nov 16, 2023
Improves the `openFileAtRevision()` function by:
- Asking user to enter another path when the requested file doesn't exist in the
  selected revision.
- Showing an error message on subsequent failure (or if an error is thrown).

The above function is used by a number of commands:
- `gitlens.openFileRevision`
- `gitlens.openFileRevisionFrom`
- `gitlens.openRevisionFile`

Also renames the `rethrow` argument of `utils.openEditor()` to `throwOnError` to
align it with `utils.findOrOpenEditor()`.
@mogelbrod
Copy link
Contributor

I've got a PR up that implements this in #2825

mogelbrod added a commit to mogelbrod/vscode-gitlens that referenced this issue Nov 29, 2023
Improves the `openFileAtRevision()` function by:
- Asking user to enter another path when the requested file doesn't exist in the
  selected revision.
- Showing an error message on subsequent failure (or if an error is thrown).

The above function is used by a number of commands:
- `gitlens.openFileRevision`
- `gitlens.openFileRevisionFrom`
- `gitlens.openRevisionFile`
mogelbrod added a commit to mogelbrod/vscode-gitlens that referenced this issue Nov 29, 2023
Improves the `openFileAtRevision()` function by:
- Asking user to enter another path when the requested file doesn't exist in the
  selected revision.
- Showing an error message on subsequent failure (or if an error is thrown).

The above function is used by a number of commands:
- `gitlens.openFileRevision`
- `gitlens.openFileRevisionFrom`
- `gitlens.openRevisionFile`
eamodio added a commit to mogelbrod/vscode-gitlens that referenced this issue Dec 6, 2023
Improves the `openFileAtRevision()` function by:
- Asking user to enter another path when the requested file doesn't exist in the
  selected revision.
- Showing an error message on subsequent failure (or if an error is thrown).

The above function is used by a number of commands:
- `gitlens.openFileRevision`
- `gitlens.openFileRevisionFrom`
- `gitlens.openRevisionFile`
eamodio added a commit that referenced this issue Dec 6, 2023
Improves the `openFileAtRevision()` function by:
- Asking user to enter another path when the requested file doesn't exist in the
  selected revision.
- Showing an error message on subsequent failure (or if an error is thrown).

The above function is used by a number of commands:
- `gitlens.openFileRevision`
- `gitlens.openFileRevisionFrom`
- `gitlens.openRevisionFile`
@eamodio eamodio self-assigned this Dec 6, 2023
@eamodio eamodio added pending-release Resolved but not yet released to the stable edition needs-verification Request for verification labels Dec 6, 2023
@eamodio eamodio added this to the 14.6 milestone Dec 6, 2023
@eamodio
Copy link
Member

eamodio commented Dec 6, 2023

Thanks to @mogelbrod's PR this has landed! Thank you!

Can you please verify this fix in tomorrow's (v2023.12.06xx) pre-release edition of GitLens? Thank you so much!

You can switch to the pre-release edition of GitLens, by clicking on the "Switch to Pre-Release version of this extension" from the Extensions view.

image

@mogelbrod
Copy link
Contributor

mogelbrod commented Dec 7, 2023

@eamodio that's great! I tried the pre-release (v2023.12.704 ) just now and encountered a potential issue:

  • Open a project in vscode
  • Rename a checked (committed) in file from x.js to x.ts or similar
  • Open the file in vscode
  • Trigger the "Open file at revision..." command

Expected behaviour: be presented with a revision picker
Actual behaviour: "Unable to show commit history"
Screenshot 2023-12-07 at 11 28 53

Nothing logged to the GitLens output

@eamodio
Copy link
Member

eamodio commented Dec 11, 2023

@mogelbrod that seems to be an existing bug, which I moved to #3050 (which will be fixed in tomorrow's pre-release)

@eamodio eamodio removed the pending-release Resolved but not yet released to the stable edition label Dec 18, 2023
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 18, 2024
@eamodio eamodio added verified ✔ Verified and removed needs-verification Request for verification labels Jan 18, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature New feature or request help wanted Want community input and/or pull request verified ✔ Verified
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants