WinMerge configuration when called from TortoiseHG/Mercurial - configuration

Summary:
When TortoiseHG/Mercurial calls WinMerge, it appears to pass as standard the /e command line parameter. How do I configure it so that command line parameter is not passed?
Details:
I'm using TortoiseHG(2.10.1) and WinMerge (2.14.0) on Windows 7. The mercurial global settings are configured to use WinMerge for both vdiff and merging.
When WinMerge is called, the /e command line parameter means that the Esc key closes WinMerge on the first press.
My problem is that when I double click on a file in the list of changes files in WinMerge, it opens a new tab, and clicking Esc closes WinMerge, not just the individual file comparison tab. I want to be able to press Esc key to close just the individual file comparison tab... and from what I can tell, removing the /e will do that.
Unfortunately I can't work out how to get the configuration file to do that.
Here is my configuration file as I currently have it...
[ui]
username = {removed for StackOverflow}
merge = winmergeu
[tortoisehg]
vdiff = winmergeu
initialrevision = workingdir
[extdiff]
cmd.winmerge= C:\Program Files\WinMerge\WinMergeU.exe
opts.winmerge= /x /ub /wl
[extensions]
hgext.convert=
mercurial_keyring=
mq=
rebase =
[web]
I have also tried changing the cmd.winmerge and opts.winmerge to use winmergeu
Additional:
I have also just tried adding hgext.extdiff= to the [extensions] section, as well as the following... but still no luck.
[merge-tools]
winmerge.regkey=Software\Thingamahoochie\WinMerge\
winmerge.regname=Executable
winmerge.priority=-10
winmerge.args=/x /wl /ub /dl other /dr local $other $local $output
winmerge.fixeol=True
winmerge.checkchanged=True
winmerge.gui=True
winmerge.diffargs=/r /x /ub /wl /dl '$plabel1' /dr '$clabel' $parent $child
winmerge.diff3args=
winmerge.dirdiff=True
(This information came from this blog)

Related

How do I extend the $PATH that Sublime Text 2 uses?

I just installed Sublime-jshint (and the requisite node.js + jshint) but get this error when I try to invoke JSHint from within ST2:
[Errno 2] No such file or directory
[cmd: [u'jshint', u'PATH-TO-THE-JS-FILE-I-AM-LINTING', u'--reporter', u'/home/cmg/.config/sublime-text-2/Packages/JSHint/reporter.js']]
[dir: DIR-MY-JS-FILE-IS-IN]
[path: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/home/cmg/bin]
[Finished]
The final item in the given path is in the home dir of my user (cmg), so it's been customized somehow... but I don't recall how, so I don't know how to add the dir I need (~/node_modules/.bin).
I've added it to $PATH in my shell (via both .bashrc and .bash_profile) but ST2 doesn't pick it up.
(I'm on Ubuntu 14.04. All the usable stuff I've found via Google on this subject has been either OS X specific or related to ST's build system).
Basically, the exec command, which the jshint package uses internally, allows you to set/extend the PATH of the spawned subprocess. (docs)
The package actually uses this path argument on OSX, but has it hardcoded (I am partly guilty of that as I rewrote the command because it was just horrible before). It should allow for a setting to specify the path to your jshint executable, so I suggest you create an issue for that.
I don't know why ST dosn't pick up your PATH from somewhere else since I have very little experience with that.
Open /etc/profile in Sublime (using sudo) and add the following line at the very bottom:
export PATH=/home/cmg/node_modules/.bin:$PATH
and save the file. Restart completely, and your PATH should be updated.

In Mercurial on Windows how do I set (any) editor correctly? (Can't commit)

I have TortoiseHg installed on Windows XP. Although I can use most hg commands normally from the command line, I cannot use hg commit (without the -m option) because it fails to launch my editor. This is what happens:
> hg commit
/c: /c: is a directory
abort: edit failed: notepad.exe exited with status 126
in mercurial.ini I have the editor set as:
[ui]
editor = notepad.exe
If I myself type notepad.exe or even just notepad from the command line then notepad works fine. Changing the editor variable to something else (like to foobar) confirms that Mercurial is reading the variable and trying to run foobar with the same result (foobar exited with status 126).
I also have a problem using parts of the TortoiseHg GUI. Context menu options like "View at revision" don't work when clicked. Presumably they are trying to launch the editor but are failing.
This problem has persisted for about 2 1/2 years of using Mercurial, and I've tried everything I can think of to set the editor variable in another way or set it to another program. Currently using TortoiseHg version 2.8 ("with Mercurial-2.6, Python-2.7.3, PyQt-4.9.6, Qt-4.8.4").
related questions:
Using other editor with TortoiseHg
How do I specify a different editor for Mercurial on Windows?
Mercurial Editor: "abort: The system cannot find the file specified"
Not long did I ask this question before finally realizing the problem. Mercurial and TortoiseHg are running the value of my Editor variable into a command interpreter, and this interpreter is whichever is specified by the COMSPEC enviroment variable.
Apparently once in my life I set this variable to the msys shell C:\msys\bin\sh.exe (probably in a vain attempt at trying to fix a problem not unlike the one I was asking here). The funny errors were caused because the msys shell being sent something like /c notepad.exe as an argument.
I have no idea why the extra /c switch is being passed (which is cmd.exe specific) if Mercurial is also deciding to also use COMSPEC. Also, when editing the settings from TortoiseHg, I am somewhat misleadingly told that if the Shell value in my mercurial config file is left unspecified, then it will default to cmd.exe on windows. This value of Shell is probably used for something else though, like the 'Open Terminal' context menu.

How to let TortoiseHg (Mercurial) on Windows use the Private Key file generated (by Puttygen)?

I have used Puttygen to create a public and a private key, and then is ready to let TortoiseHg on Windows 7 do a clone by going to
ssh://somebody#code.somewhere.com/somecode
but there seems to be no where to add the private key to TortoiseHg? (or even just the mercurial command line)
The file is already some where on hard disk as somefile.ppk Does someone know how to add it?
Either add the following to the [ui]-section of the mercurial.ini in your home directory (assuming your key is in "C:\Users\UserName\mykey.ppk"):
[ui]
ssh = tortoiseplink.exe -ssh -i "C:\Users\UserName\mykey.ppk"
or use Pageant, found in the TortoiseHg installation path (e.g. C:\Program Files\TortoiseHg\Pageant.exe). Start it, double click the taskbar-icon that appears, and add the .ppk-file.
need an ssh key generator first
cmd: ssh-keygen -t rsa
open PuTTY Key Generator
Conversions > import key: open the id_rsa file in C:\Users\.ssh (you may have to create the folder !must run cmd as Admin!)
Save the imported file id_rsa as id_rsa.ppk
Open Pageant.exe in TortoiseHG folder
It will show up in Taskbar
Right click and click add keys
Finally add your new ppk file
Oh right copy the contents of id_rsa.pub to hg host

Mercurial error: abort no username supplied

Problem on WindowsXP (likely will happen on all Win installs), first time using Mercurial. I found the answer in an inobvious place so I'm asking/answering the question myself so others don't have to search like I did.
First time using Mercurial on machine.
Add new repoz:
c:\bla\>hg add
no problem.
Next, commit:
c:\bla\hg commit
error:
abort: no username supplied (see "hg help config")
Solution:
On my Windows install, the Mercurial.ini did not get propagated. It also needs a user email added to it.
Take the default Mercurial.ini file found at in the Mercurial executable install directory (C:\Program Files\Mercurial\Mercurial.ini on my machine)
and copy it to your user home dir (C:\Documents and Settings\myName on winXP).
On a Windows 7 install there is no default .ini, you will need to create a new one in C:\Users\myName.
Then edit that .ini file. Find this area. The username needs an email set. It will be blank--add your email name here.
[ui]
; editor used to enter commit logs, etc. Most text editors will work.
editor = notepad
username = userEmail#domain.example
This fixed the problem for me.
I'm sorry, but why do you call this a problem? Mercurial asks you to see hg help config, and this help text explicitly tells you how to add a username -- I know since I wrote that help text :-)
How should we improve the error message to make this more clear?
However, we've managed to screw this up by making hg help config include help for all config settings. So the nice little example of how to set the username:
[ui]
username = Your Name <your#email.example>
is now lost in the noise (add this to ~/.hgrc, creating the file if necessary). I've opened an issue for this.
On Windows XP I do not see an ini file.
After creating the repository using the command hg init,
I added a file with the name hgrc to the folder .hg
With the following content:
[ui]
editor = notepad
username = zamboni#icemachine.example
no matter Windows or Linux, hg looks the <repo>/.hg/hgrc file for valid configuration. As in "hg help config" says, you only have to add at the end of that file the following lines:
[ui]
username = YOUR NAME <EMAIL#HOST.EXAMPLE>
verbose = true
save and hg commit -m 'test'
If you are using TortoiseHg, you can add [UI] settings easily
Right clicking in any folder Explorer to access the TortoiseHg menu.
From the flyout TortoiseHg menu choose Global Settings
From the interface click the Edit File
Add the [UI] settings to the end
[ui]
username = YourName <YourEmail#SomeAddress.com>
verbose = true
Save and you are done
Here is what worked like a charm for me on Windows XP:
Go to the folder C:\Program Files\Mercurial\hgrc.d assuming you have installed Mercurial to C:\Program Files\Mercurial\.
You should see a Mercurial.RC file in there.
Copy the file to C:\Documents and Settings\ [USERNAME]\
Rename Mercurial.RC to Mercurial.ini.
Edit the [ui] section like so:
[ui]
; editor used to enter commit logs, etc. Most text editors will work.
editor = notepad
verbose = True
username = userEmail#domain.example
I had the same problem. What helped me was to put [ui] and username = firstname lastname on separate lines of the ~/.hgrc file. Putting these two things on one line did not work and led to the error.
This problem still exists. The mercurial.ini file is ignored no matter where you put it.
No mercurial.ini file is created during installation. I created one in the Mercurial install directory, but it had no effect. I copied it to %USERPROFILE% and then to %HOME%, but neither one works.
Putting .hgrc in the HOME directory works.
The documentation ("hg help config") needs to be fixed.
Configure you .hgrc like this:
[ui]
username = your name <youremail#host.example>
verbose = True
NOTE! Do not leave out the [ui] part
This is a problem because in the help file the path to the specified config file does not exist, we have to copy the Mercurial.ini from program files directory to USER directory, maybe this is a problem coming from the installer on windows.
#Kevin Won: you forgot to add the line:
verbose = True

Load multiple .hgrc files - ie, some with machine-specific settings?

I'd like to keep two ~/.hgrc files: ~/.hgrc and ~/.hgrc.local – one with "standard" settings (eg, username), the other with machine-specific settings (eg, setting a graphical merge tool).
How can I do this with hg?
For example, this is how I do it with Vim:
# ~/.vimrc
syntax enable
source ~/.vimrc.local
Then:
# ~/.vimrc.local
let work_code = 'code/work/.*'
if expand('%:p:h') =~ work_code ... fi
There's a not-often used %include directive in mercurial 1.3 and later:
From man hgrc:
A line of the form %include file will include file into the current
configuration file. The inclusion is recursive, which means that
included files can include other files. Filenames are relative to the
configuration file in which the %include directive is found.
so go with:
%include ~/.hgrc.local
and you should be good to go.
I solve this problem for all my "dot files" in a similar way. On login my shell checks a list of files (hgrc, vimrc, ....) and checks if any of them is older than ${that_name}.global or ${that_name}.local. If it is - cat ${that_name}.{global,local} > ${that_name}. Simple and works great so far. While there's a "better" way (using %include) sometimes processing the config files manually has advantages - for example it will work with mercurial pre-1.3.
Mercurial checks for a number of configuration files with a specific priority. This way you can have global, user-specific and repository-specific settings.
Mercurial version >= 1.4 has a hg help config command which describes this in a nice overview:
$ hg help config
Configuration Files
Mercurial reads configuration data from several files, if they exist. Below we list the most specific file first.
On Windows, these configuration files are read:
- "<repo>\.hg\hgrc"
- "%USERPROFILE%\.hgrc"
- "%USERPROFILE%\Mercurial.ini"
- "%HOME%\.hgrc"
- "%HOME%\Mercurial.ini"
- "C:\Mercurial\Mercurial.ini"
- "HKEY_LOCAL_MACHINE\SOFTWARE\Mercurial"
- "<install-dir>\Mercurial.ini"
On Unix, these files are read:
- "<repo>/.hg/hgrc"
- "$HOME/.hgrc"
- "/etc/mercurial/hgrc"
- "/etc/mercurial/hgrc.d/*.rc"
- "<install-root>/etc/mercurial/hgrc"
- "<install-root>/etc/mercurial/hgrc.d/*.rc"
The configuration files for Mercurial use a simple ini-file format. A configuration file consists of sections, led by a "[section]" header and followed by
"name = value" entries:
[ui]
username = Firstname Lastname <firstname.lastname#example.net>
verbose = True
This above entries will be referred to as "ui.username" and "ui.verbose", respectively. Please see the hgrc man page for a full description of the possible
configuration values:
- on Unix-like systems: "man hgrc"
- online: http://www.selenic.com/mercurial/hgrc.5.html
You can list your current settings with hg showconfig.
Mercurial will look in several different locations for hgrc files and will load them if present. For system-wide configuration the standard (on UNIX) would be to use /etc/mercurial/hgrc.
See the files section of the hgrc man page for more information.