How to use UltraCompare as merge tool in SourceTree (or any other version control system)?

How to use UltraCompare as merge tool in SourceTree (or any other version control system)?

231
Basic UserBasic User
231

    Sep 18, 2015#1

    I want to use UltraCompare as merge tool in SourceTree. This is a tool for managing Git projects. In this program I can configure a command line tool with two input and one output file. These options I found all in the UltraCompare documentation.

    My problem is, that SourceTree thinks, when the merge tool is closed, the merge is complete. It is so that when I start UltraCompare with all my needed options from the command line, UltraCompare start and after this, at the command line, the prompt is back. So it is only a kick starter, and it doesn't wait until saving my merged files.

    In my Git folder I found some temporary merge files and my merge job isn't ready.

    So the question is, can I start UltraCompare from the command line in that way, that the command line will waits till I close the merge tab or close the complete application?

    Regards,

    Mario

    6,688587
    Grand MasterGrand Master
    6,688587

      Sep 19, 2015#2

      uc.exe is a Windows GUI application. On starting a Windows GUI application from within a command prompt window, the GUI application is started in a new process and the command process continues which of course is not good when running UltraCompare from within another tool.

      There is a general Windows solution for starting a GUI application from within a process and waiting for termination of the separate process as well as an UltraCompare specific solution.

      The general Windows solution is using command start of command processor cmd.exe. You can get help on this command by running in a command prompt window start /?. An example:

      start "UC Read Only Merge" /wait "%ProgramFiles(x86)%\IDM Computer Solutions\UltraCompare\uc.exe" -rom "C:\Path\First File.txt" "C:\Path\Second File.txt" "C:\Path\Merge Results File.txt"

      Note: Help of start lists the title UC Read Only Merge as optional. But command start interprets first string in double quotes as title. Therefore it is nearly always necessary to specify a title in double quotes which can be simply also just "", i.e. an empty title string.

      However, as UltraCompare should be often called (and not started) from within other tools especially version management tools, IDM installs together with uc.exe one more application: uc.com.

      uc.com is NOT a 16-bit DOS application as most other *.com files were in the past. It is a 32-bit Windows console application written for being called from within other applications or from command prompt or a batch file. uc.com supports exactly the same parameters as uc.exe because it just starts uc.exe and passes to GUI version of UltraCompare the parameters passed to uc.com with the additional information that uc.com started ue.exe. Then uc.com waits for termination of uc.exe resulting in halting the process from within uc.com was called.

      The GUI version of UltraCompare makes the job according to the parameters. And additionally as knowing being started from uc.com, it returns back to console wrapper application uc.com on exit information about success or failure of the task.

      uc.com prints the information get from GUI version of UC to stdout of the console window and then exits with appropriate exit code which could be evaluated in a batch file via errorlevel variable. The usage of uc.com in batch files makes it easier to further process results of the comparison or merge in comparison to starting uc.exe with command start. No information from GUI UltraCompare is written to console if using start, and exit code evaluation is much more difficult because errorlevel has the exit code of command start after uc.exe terminated.

      So all you need to do in SourceTree is calling uc.com instead of uc.exe to get UltraCompare working as merge tool as expected by you.
      Best regards from an UC/UE/UES for Windows user from Austria

      231
      Basic UserBasic User
      231

        Sep 19, 2015#3

        Hello Mofi,

        thanks a lot. uc.com works as you described it. It waits for closing the application.

        I saw the uc.com file and I tried it also, but before I did a mistake. I set the parameter for a third file. I thought, the third file is for the result of the merge. But it isn't. It is for the protocol of the compare.

        So I have a "half" solution. For compare I can use uc.com as well, but not for merge, because in SourceTree I need a third file for the result of the merge.

        Is there any solution?

        Regards,

        Mario

        6,688587
        Grand MasterGrand Master
        6,688587

          Sep 19, 2015#4

          You would have found the answer on your new question by yourself if you would have looked better on my example using start because it demonstrates the usage of read only merge often required for merge operations in version control systems. The UltraCompare help page about the Command Line Options explains read only merge mode. This help page can be also found in uc.chm installed with UltraCompare in section Getting Started on Contents tab.
          Best regards from an UC/UE/UES for Windows user from Austria

          231
          Basic UserBasic User
          231

            Sep 19, 2015#5

            Dear Mofi,

            thanks a lot, thats it: "-rom". Do you know the meaning of the German proverb "One does not see the wood for the trees"?

            Regards, Mario

            6,688587
            Grand MasterGrand Master
            6,688587

              Sep 19, 2015#6

              mario_lorenz wrote:Do you know the meaning of the German proverb "One does not see the wood for the trees"?
              Selbstverständlich kenne ich: "Den Wald vor lauter Bäumen nicht sehen."
              Best regards from an UC/UE/UES for Windows user from Austria