4

In general, if I've got a custom file of type W and want to use custom application/editor X to open/view it how do i set up Hg to call the application X when i want to edit/view the file?

Specific example: I'm using TortoiseHg to track a set of files, that are created by a custom application, an OPC server application called Kepserver. Kepserver creates .OPF files, while Hg can tell when the files have changed, I'd like to use the Kepserver application to view the files from Hg Workbench.

I see a setting that allows me to set an editor. I specified the path to the Kepserver application, but when i click on the files in workbench it tries to do a binary diff, using Kdiff3, How can i specify editors for specific repositories?

StayOnTarget
  • 11,743
  • 10
  • 52
  • 81
user595985
  • 1,543
  • 4
  • 29
  • 55
  • Possible duplicate of [How do I configure TortoiseHg to open a file in the right program based on its extension?](https://stackoverflow.com/questions/7506900/how-do-i-configure-tortoisehg-to-open-a-file-in-the-right-program-based-on-its-e) – StayOnTarget Nov 07 '18 at 17:38

1 Answers1

6

The default behavior when double-clicking a file in TortoiseHg workbench is to run a visual diff. To open the file in an editor, you must right-click on the file and select "Edit Local" or one of the similar options.

The editor used when this option is selected is controlled by the

[tortoisehg]
editor = <editor>

setting in your .hgrc or mercurial.ini.

Tim Henigan
  • 60,452
  • 11
  • 85
  • 78
  • Unfortunately this doesn't seem to work with sublime text. I've entered the path to the exe `C:\Program Files (x86)\Sublime Text\sublimetext.exe`. When I copy this filepath into windows explorer the app opens. – Benbob Oct 13 '11 at 03:04
  • @Keyo: You may need to experiment with quoting since there are spaces in the path. – Tim Henigan Oct 13 '11 at 12:05
  • I've tried "C:\...\sublimetext.exe" $FILE which works in the command line. Ugh, I don't know why it doesn't just open the file with the default application, or at least have a link to view in explorer. Any ideas? – Benbob Oct 13 '11 at 13:48
  • @Keyo: I have the best luck if I add the exe to my PATH environment variable. If you can open a shell and execute `sublimetext` from any directory, then you should be able to simply set `editor = sublimetext $FILE`. – Tim Henigan Oct 13 '11 at 13:52
  • 4
    I found that quoting the path string to the .exe worked just fine. I also did not supply any arguments beyond the string (like $FILE). `[tortoisehg]` `editor = "C:\Program Files\Sublime Text 2\sublime_text.exe"` – mikesjawnbit Feb 01 '13 at 22:22