exit codes when writing / not writing merged files
Moderator: SourceGear
-
- Posts: 1
- Joined: Tue Feb 05, 2008 7:40 am
- Location: Dortmund, Germany
- Contact:
exit codes when writing / not writing merged files
Hi,
I really like DiffMerge and I would like to use it with the Mercurial system.
It can already be integrated into mercurial as you can see here:
http://www.selenic.com/mercurial/wiki/i ... rgeProgram
However it doesn't send exit codes when quiting DiffMerge, so mercurial can't recognise if its sucessfully saved.
Any plans to add exit codes ?
Cheers,
Daniel
I really like DiffMerge and I would like to use it with the Mercurial system.
It can already be integrated into mercurial as you can see here:
http://www.selenic.com/mercurial/wiki/i ... rgeProgram
However it doesn't send exit codes when quiting DiffMerge, so mercurial can't recognise if its sucessfully saved.
Any plans to add exit codes ?
Cheers,
Daniel
-
- Posts: 534
- Joined: Tue Jun 05, 2007 11:37 am
- Location: SourceGear
- Contact:
i'll log a feature request for this.
I'll log a request for this.
I didn't add it originally because DiffMerge can have multiple
windows open and can be used as a more or less stand-alone
tool. Having the exit code mean you did or did not write the
file makes sense in this context, but not so much in the general
case.
In the Mercurial script, It might be easier to use the
--result=<result_pathname> argument and have DiffMerge
write the merge result into a new file (instead of overwriting
one of the inputs). And then check for the existence of this
file in the script.
A word of warning though, because File|Save does not cause
the program to exit, both methods have the problem that you
could do a save and then edit some more and quit without saving
and the calling script would think that your last save was really
what you wanted. which may or may not be true.
jeff
I didn't add it originally because DiffMerge can have multiple
windows open and can be used as a more or less stand-alone
tool. Having the exit code mean you did or did not write the
file makes sense in this context, but not so much in the general
case.
In the Mercurial script, It might be easier to use the
--result=<result_pathname> argument and have DiffMerge
write the merge result into a new file (instead of overwriting
one of the inputs). And then check for the existence of this
file in the script.
A word of warning though, because File|Save does not cause
the program to exit, both methods have the problem that you
could do a save and then edit some more and quit without saving
and the calling script would think that your last save was really
what you wanted. which may or may not be true.
jeff
Re: exit codes when writing / not writing merged files
Bump!
+1 for this feature request.
I had a weird problem with my integration of SourceGear DiffMerge with Team Foundation today (my merge result got nerfed) and I am only guessing at this stage but I that the exit codes might have been the reason for the problem. Since different toolsets might use interpret exit codes differently, it might also be good if the exit codes are command-line configurable. (/exitsuccess=0 /exitabort=2 etc.)
+1 for this feature request.
I had a weird problem with my integration of SourceGear DiffMerge with Team Foundation today (my merge result got nerfed) and I am only guessing at this stage but I that the exit codes might have been the reason for the problem. Since different toolsets might use interpret exit codes differently, it might also be good if the exit codes are command-line configurable. (/exitsuccess=0 /exitabort=2 etc.)
Re: exit codes when writing / not writing merged files
I've added your "vote" to the feature request.
12990
12990
Linda Bauer
SourceGear
Technical Support Manager
SourceGear
Technical Support Manager
-
- Posts: 534
- Joined: Tue Jun 05, 2007 11:37 am
- Location: SourceGear
- Contact:
Re: exit codes when writing / not writing merged files
yeah, i'll add your vote for this. perhaps it would make sense to optionally have
an exit dialog that asks what the exit status should be....
jeff
an exit dialog that asks what the exit status should be....
jeff
-
- Posts: 534
- Joined: Tue Jun 05, 2007 11:37 am
- Location: SourceGear
- Contact:
Re: exit codes when writing / not writing merged files
SourceGear DiffMerge 3.3.0 is now available and addresses this problem.
When the /result=file option is used, DiffMerge will exit with an exit status
to indicate the result of the merge. There's a section in the new manual that
explains the various status codes.
Full details can be found at http://www.sourcegear.com/diffmerge/index.html.
jeff hostetler
When the /result=file option is used, DiffMerge will exit with an exit status
to indicate the result of the merge. There's a section in the new manual that
explains the various status codes.
Full details can be found at http://www.sourcegear.com/diffmerge/index.html.
jeff hostetler
Re: exit codes when writing / not writing merged files
Hi,
I cant figure out how to correctly use the current version of DiffMerge with Mercurial.
It seems my mercurial.ini (hgrc) isnt correct in order to correctly accept/reject merge results from diffmerge.
Could you maybe provide a sample showing how to do so?
I cant figure out how to correctly use the current version of DiffMerge with Mercurial.
It seems my mercurial.ini (hgrc) isnt correct in order to correctly accept/reject merge results from diffmerge.
Could you maybe provide a sample showing how to do so?
-
- Posts: 534
- Joined: Tue Jun 05, 2007 11:37 am
- Location: SourceGear
- Contact:
Re: exit codes when writing / not writing merged files
I haven't tried it with HG yet, but let me take a look.
What platform are you on and what have you tried so far?
(If you want to paste in a copy of the relevant part of your
mercurial.ini / .hgrc file, I'll take a look at it too.)
jeff
What platform are you on and what have you tried so far?
(If you want to paste in a copy of the relevant part of your
mercurial.ini / .hgrc file, I'll take a look at it too.)
jeff
Re: exit codes when writing / not writing merged files
Im Running on Windows currently, however will also try to run it on Mac OS X soon.
-
- Posts: 534
- Joined: Tue Jun 05, 2007 11:37 am
- Location: SourceGear
- Contact:
Re: exit codes when writing / not writing merged files
I ran some quick tests on Windows with HG (version 1.2.1) and and DiffMerge (version 3.3.0)
and the following seems to work OK. The "hg merge" or "hg resolve" will launch DiffMerge
with the output properly routed to the $output file. When DiffMerge is given the /result=
argument, the exit status is correctly set and this is detected by hg.
I only ran a few tests (and I'm in no way an expert on HG), so you may want to experiment
a little before going into production....
I haven't had time to try it on the Mac yet, but it should be similar. Be sure to check out
the shell script that I put on the .DMG in the CommandLine folder. That should help.
(See the readme for details.)
BTW, I also added a section for diffing 2 files using DiffMerge. In addition to "hg diff file"
you should be able to type "hg diffmerge file" and have DiffMerge show you the differences.
I'll log an action item to add this to the manual.
Let me know if you have questions or problems.
jeff hostetler
and the following seems to work OK. The "hg merge" or "hg resolve" will launch DiffMerge
with the output properly routed to the $output file. When DiffMerge is given the /result=
argument, the exit status is correctly set and this is detected by hg.
I only ran a few tests (and I'm in no way an expert on HG), so you may want to experiment
a little before going into production....
I haven't had time to try it on the Mac yet, but it should be similar. Be sure to check out
the shell script that I put on the .DMG in the CommandLine folder. That should help.
(See the readme for details.)
Code: Select all
[extensions]
hgext.extdiff =
[extdiff]
cmd.diffmerge = c:\Program Files\SourceGear\DiffMerge\DiffMerge.exe
[merge-tools]
diffmerge.executable = c:\Program Files\SourceGear\DiffMerge\DiffMerge.exe
diffmerge.args = /result=$output $base $local $other
diffmerge.binary = False
diffmerge.symlinks = False
diffmerge.gui = True
diffmerge.premerge = True
you should be able to type "hg diffmerge file" and have DiffMerge show you the differences.
I'll log an action item to add this to the manual.
Let me know if you have questions or problems.
jeff hostetler
-
- Posts: 534
- Joined: Tue Jun 05, 2007 11:37 am
- Location: SourceGear
- Contact:
Re: exit codes when writing / not writing merged files
Oops, the line:
diffmerge.args = /result=$output $base $local $other
should read:
diffmerge.args = /result=$output $local $base $other
That is, the base/ancestor should be in the middle.
Sorry,
jeff
diffmerge.args = /result=$output $base $local $other
should read:
diffmerge.args = /result=$output $local $base $other
That is, the base/ancestor should be in the middle.
Sorry,
jeff
-
- Posts: 534
- Joined: Tue Jun 05, 2007 11:37 am
- Location: SourceGear
- Contact:
Re: exit codes when writing / not writing merged files
I just tried it on Linux (Fedora 10) and Mac OS (10.5.6). Basically, the same .ini/.hgrc commands do the trick.
(Changing the path the executables, of course.)
To make it a little clearer, I added captions and panel titles. (You should be able to add these to the Windows version, too.)
On Mac OS, you'll want to install the diffmerge.sh shell script in /usr/bin or /usr/local/bin.
BTW, I did NOT add a merge= line to the [ui] section as describe in some of the docs; there was an issue with doing
that, but I don't remember all the details. I think HG wasn't picking up the .args line and thus not passing the /result
argument to DiffMerge so DiffMerge wasn't setting the exit status as expected.
Again, let me know if you have any problems or questions.
jeff hostetler
(Changing the path the executables, of course.)
Code: Select all
[extensions]
hgext.extdiff =
[extdiff]
cmd.diffmerge = /usr/bin/diffmerge
[merge-tools]
diffmerge.executable = /usr/bin/diffmerge
diffmerge.args = --result=$output -t1="Local Version" -t2=$output -t3="Other Version" --caption=$output $local $base $other
diffmerge.binary = False
diffmerge.symlinks = False
diffmerge.gui = True
diffmerge.premerge = True
On Mac OS, you'll want to install the diffmerge.sh shell script in /usr/bin or /usr/local/bin.
BTW, I did NOT add a merge= line to the [ui] section as describe in some of the docs; there was an issue with doing
that, but I don't remember all the details. I think HG wasn't picking up the .args line and thus not passing the /result
argument to DiffMerge so DiffMerge wasn't setting the exit status as expected.
Again, let me know if you have any problems or questions.
jeff hostetler