# Re: UltraCompare: 3rd Party Diff Tool

From: Stefan Küng <tortoisesvn_at_gmail.com>
Date: Wed, 20 May 2009 21:16:00 +0200

Simon Large wrote:
> 2009/5/18 Eric Stegemoller <estegemoller_at_idmcomp.com>:
>> Hello Simon,
>
> Hi Eric,
>
> Thanks for taking this up. I have copied this to the TortoiseSVN
> developers mailing list so that others can participate in the
> discussion. You can subscribe to the list by sending an email to
> dev-subscribe_at_tortoisesvn.tigris.org. Or just ask responders to copy
>
>> to UltraCompare for providing view titles for temporary files when SVN
>> invokes UltraCompare to perform a difference comparison. I have included the
>> original message at the bottom of this message. We wish to include this and
>> more into our next release of UltraCompare. Our goal is to offer full
>> support for UltraCompare-SVN integration to our users. In order to do this
>> we need to know more about the command line that SVN passes to UltraCompare.
>> Perhaps the following questions will help us move in the right direction:
>
> First off, I should say that this is specifically for TortoiseSVN
> which is a Windows client for SVN, and probably the most popular
> Windows client, but it's not the only one. Other SVN clients will have
> different ways of integrating external diff tools.
>
>> 1.) Do you have any switches that you pass and if so what is their meaning
>> and purpose?
>
> The interface to external tools is user-defined in TortoiseSVN. We
> can't expect other tools to change to a fixed format, so we provide a
> way to use as many switches as the external tool provides. The user
> defines a command line that will be sent to the tool, which can
> include any tool-specific switches. Certain parameters in that
> definition like %base will be substituted at call time with real data.
>
>> 2.) From your documentation I assume %base and %mine are the repository
>> version of the file and local version of the file respectively. Are they
>> passed in this order? Also, is there a convention to the order in which
>> things are passed ie. filenames, switches etc?
>
> %base is the original version as it existed in the repository before I
> started editing. %mine is the local version as it is now after I have
> made some changes. They are passed in the order the user specifies in
> his command line definition. If you need them in a specific order then
> we can add that to the examples in our docs.
>
>> 3.) What syntactical conventions do you use for quotes, spaces etc.?
>
> Good question. I think filenames end up being quoted, and I remember
> seeing a post on this just a few days ago, but can I find it now?
> Stefan - how does the quoting work and are there any tricky edge
> cases?

The params passed to the diff/merge tools are enquoted, but double
quotes are removed. So for example if the tool is configured like this:
diff.exe "%base" "%mine"
then TSVN first replaces this with
diff.exe ""path\to\base"" ""path\to\mine""
and then replaces all double quotes with single quotes, which leads to
diff.exe "path\to\base "path\to\mine"

>
>> 4.) For "View Title" names how do you specify what is the file path name and
>> what is the "View Title" name? Do you use a special separator character?
>> What are the conventions here? (I see you discussed this in the original
>> message. Is this still the case?)
>
> That's up to you. You implemented it in the last release using a
> semicolon between the filename and view title and I explained why that
> would not work (problems with quoting, and semicolon is also a legal
> filename character). I suggest adding separate switches to introduce
> the titles.

If possible, TSVN also passes the view titles with the params
%bname, %yname, %tname, %mname
but not all diffs/merges have those filled in. TortoiseMerge creates the
view titles itself if those params are empty.

>> 5.) Do you ever send more than two files for comparison at a time? If so how
>> is this information passed?
>
> There can be 4 files if you are viewing merge results, but
> 1. The common ancestor (base)
> 2. The file with my changes (mine)
> 3. The file from the repository with changes I want to merge (theirs)
> 4. The resultant merged file
> But unless you already support merging in this way I suggest sticking
> to the 2-way diff.
>
>> 6.) I see that SVN creates a temp file locally to represent the file from
>> the repository. Should we allow users to edit this or is it intended purely
>> for the sake of comparison? (I assume it is).
>
> It depends how you invoke the diff tool. If you compare 2 files in the
> repository then you have 2 temp files. If you compare a file against
> its BASE version then neither is a temp file. The BASE file in a
> subversion working copy is read-only and must never be edited, but it
> is useful to be able to edit the file in your working copy. I'm not
> sure whether we set the temp files to be read-only, but we could do
> so. In that case you could assume that if a file is writeable then it
> is editable.

The temp files are set to readonly if they really are just temp files
and don't represent 'real' files in a working copy.

>
>> 7.) Some of our users have reported that other diff applications have
>> options that when enabled will automatically configure SVN to use the
>> application. If this is something that SVN supports what is the method for
>> doing this. Is this something that is passed on the command line or does it
>> require editing a configuration setting programmatically?
>
> That's not something I have heard of, and we don't generally do
> automatic changes - people don't like surprises ;-)

Those diff tools create/change the registry entries TSVN uses to
configure those tools.
But if you do that, please don't do this without asking the user first!

>> 8.) Are there any upcoming changes to SVN that will affect any of this?
>
> I don't think so.

No, even if we change something, the 'old' way will still work. We try
to stay compatible as much as possible.

Stefan

--
___
oo  // \\      "De Chelonian Mobile"
(_,\/ \_/ \     TortoiseSVN
\ \_/_\_/>    The coolest Interface to (Sub)Version Control
/_/   \_\     http://tortoisesvn.net
------------------------------------------------------
http://tortoisesvn.tigris.org/ds/viewMessage.do?dsForumId=757&dsMessageId=2334203
To unsubscribe from this discussion, e-mail: [dev-unsubscribe_at_tortoisesvn.tigris.org].