Search code examples
mercurialsublimetext2tortoisehg

View older file version under mercurial with a different text editor without setting it as default


I want to view an older version of my file under mercurial version control in Sublime Text (without setting it as the default editor via ui.editor option in hrgc)

Can I specify a different text editor from this command line?

hg cat -r 101 mycode.py

Edit:

FWIW, TortoiseHg lets you specify an editor by adding this to your .hrgc. I wish it was possible to do the same with command line.

[tortoisehg]
editor ="C:\Program Files\Sublime Text 2\sublime_text.exe"

Solution

  • hg cat just dumps the file to stdout and sublime text reads files from disk, so you'll need to send the file somewhere temporarily.

    You could write a bash alias to do it in a blink, but it's nothing mercurial will do out of the box. If you check the various Mercurial plugins for sublime you should be able to find something that opens files as specific versions for you.