<p>Does anyone know how to setup <a href="http://www.selenic.com/mercurial/wiki/index.cgi/Mercurial" rel="noreferrer">Mercurial</a> to use <a href="http://www.perforce.com/perforce/products/merge.html" rel="noreferrer">p4merge</a> as the merge/diff tool on OS X 10.5?</p>

[{'answer_id': 43241, 'author': 'Matthew Schinckel', 'author_id': 188, 'author_profile': 'https://Stackoverflow.com/users/188', 'pm_score': 0, 'selected': False, 'text': '<p>I\'m guessing there\'s a CLI tool for p4merge (which I know nothing about).</p>\n\n<p>I wrote a blog post about using Changes.app, and some other GUI tools with Mercurial: <a href="http://schinckel.net/2008/04/26/mercurial-with-os-x-gui-tools/" rel="nofollow noreferrer">Using Mercurial with GUI Tools.</a></p>\n\n<p>Basically, you need to know the calling expectations of the CLI tool that loads up the diff tool.  IE, how to make it load data from a particular file, and how to make it wait for exit.  There should be enough info on the post to give you some ideas.</p>\n'}, {'answer_id': 54261, 'author': 'Community', 'author_id': -1, 'author_profile': 'https://Stackoverflow.com/users/-1', 'pm_score': 0, 'selected': False, 'text': '<p>I use the following bit of Python to launch p4merge and use it with git :</p>\n\n<pre><code>#!/usr/bin/python\nimport sys\nimport os\n\nos.system(\'/Applications/p4merge.app/Contents/MacOS/p4merge "%s" "%s"\' % (sys.argv[2], sys.argv[5]))\n</code></pre>\n\n<p>I\'m not sure how mercurial looks to launch an external diff tool though ? Hopefully it\'s as simple as adjusting 2 &amp; 5 in the above line to being the index of the arguments for \'checked in\' and \'current working copy\'.</p>\n'}, {'answer_id': 170637, 'author': 'Ry4an Brase', 'author_id': 8992, 'author_profile': 'https://Stackoverflow.com/users/8992', 'pm_score': 5, 'selected': False, 'text': "<p><strong>This will work for merging:</strong></p>\n\n<p>Place this into your <code>~/.hgrc</code> (or, optionally, your <code>Mercurial.ini</code> on Windows):</p>\n\n<pre><code>[merge-tools]\np4.priority = 100\np4.premerge = True  # change this to False if you're don't trust hg's internal merge\np4.executable = /Applications/p4merge.app/Contents/MacOS/p4merge\np4.gui = True\np4.args = $base $local $other $output\n</code></pre>\n\n<p>Requires Mercurial 1.0 or newer.  Clearly you'll need to update the path to that executable to reflect where you'd got p4merge installed.</p>\n\n<hr>\n\n<p><strong>You can't change what <code>hg diff</code> uses</strong>; but you <em>can</em> use the <code>extdiff</code> extension to create new diff commands that use the display you want. </p>\n\n<p>So <code>hg pdiff</code> could run p4 merge, etc.</p>\n"}, {'answer_id': 399092, 'author': 'Ivan', 'author_id': 50135, 'author_profile': 'https://Stackoverflow.com/users/50135', 'pm_score': 4, 'selected': False, 'text': '<p>I found <a href="https://stackoverflow.com/questions/42980/how-to-use-p4merge-as-the-mergediff-tool-for-mercurial#170637">Ry4an\'s answer</a> to be a good solution, except for a minor problem, which left p4merge (under mac os) mixing up the command inputs. <strong>Do everything described in <a href="https://stackoverflow.com/questions/42980/how-to-use-p4merge-as-the-mergediff-tool-for-mercurial#170637">his answer</a> and add the following line in the [merge-tools] section</strong>:</p>\n\n<pre><code>p4.args=$base $local $other $output\n</code></pre>\n\n<p>This line tells mercurial in which order p4merge takes its arguments.</p>\n'}, {'answer_id': 2311268, 'author': 'gnz', 'author_id': 269335, 'author_profile': 'https://Stackoverflow.com/users/269335', 'pm_score': 2, 'selected': False, 'text': '<p>Maybe because I\'m working on Windows, but the proposed solution didn\'t work for me. Instead, the following does work.</p>\n\n<p>In your <code>~/.hgrc/</code> / <code>Mercurial.ini</code>, I applied the following changes:</p>\n\n<p>Enabled "ExtDiff" extension:</p>\n\n<pre><code>[extensions]\nhgext.extdiff =\n</code></pre>\n\n<p>Added P4 extdiff command:</p>\n\n<pre><code>[extdiff]\ncmd.p4diff = p4merge\n</code></pre>\n\n<p>Configured it as the default visual diff tool:</p>\n\n<pre><code>[tortoisehg]\nvdiff = p4diff\n</code></pre>\n'}, {'answer_id': 3779528, 'author': 'macrobug', 'author_id': 226508, 'author_profile': 'https://Stackoverflow.com/users/226508', 'pm_score': 4, 'selected': False, 'text': '<p>I am using version 1.0.1 of TortoiseHg and p4merge works out of the box.</p>\n\n<p>Just go to <em>Global Settings -> TortoiseHg</em> and select the following options:</p>\n\n<ul>\n<li>Three-way Merge Tool: p4merge</li>\n<li>Visual Diff Tool: p4merge</li>\n</ul>\n\n<p><img src="https://i.stack.imgur.com/LQH39.png" alt="Screenshot"></p>\n'}]
['https://Stackoverflow.com/questions/42980', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/3547/']