UltraCompare Parameters for TFS

UltraCompare Parameters for TFS

2
NewbieNewbie
2

    Sep 19, 2012#1

    Has anyone used UltraCompare inside Visual Studio 2010 and Team Foundation Server (TFS) as a MERGE tool? I've set it up as a compare tool, but I'm not sure of the parameters needed for Merge.

    2362
    MasterMaster
    2362

      Sep 19, 2012#2

      Your questions brings up one of my own, and if someone else doesn't answer it soon, I'll email tech support for an answer.

      I am using TortoiseSVN. Instructions are quite clear in the Version Control Support help for UltraCompare Professional on how to get it set up as the Diff viewer, but there is nothing available for the Merge Tool that I can find.

      Also, there seem to be quite a lot of command line options for compare/diff, but I'm not seeing any "merge" command line parameters, which seems to suggest that this may not be possible. For now, I'm still using TortoiseMerge, but I'd rather use UltraCompare if possible.

      6,684586
      Grand MasterGrand Master
      6,684586

        Sep 20, 2012#3

        rhapdog wrote:but I'm not seeing any "merge" command line parameters, which seems to suggest that this may not be possible.
        That's not 100% correct. The help page Command Line Options lists also -rom ... read only merge mode.

        But I think, there is a little misunderstanding. In some other comparison tools there is a "compare only for differences mode" and a "compare and merge mode". UltraCompare always allow merging differences on comparison. Differences can be always merged from first to second, or from second to first or both at same time. The exception is read only merge mode where UC creates a copy of first file with name of third file, loads the third file into left pane and second file into right pane and allows merge operations only from right to left pane (second to third file).

        I'm not familiar with version control systems. For merge option of the version control system either same options as for a pure difference comparison can be used if the version control systems expects that a merge is done into first or second file, or the -rom option is used if the merge must be done into a new file.

        2362
        MasterMaster
        2362

          Sep 20, 2012#4

          Thanks Mofi. Perhaps if I knew more about the core workings of Version Control, I would have already figured this out. I basically use the SVN to keep incremental backups of my personal work, since I am retired. I always worked as a "one man show" as a programmer, and never on a team, so merging was never an issue for me in the past.

          @sdude: Perhaps sending the question to IDM to their support email could render an answer for you. The email is in a link at the top of the forums. I'm afraid that we users won't be able to answer this one for you.

          79
          Advanced UserAdvanced User
          79

            Sep 20, 2012#5

            A 'merge' operation (when talking about version control systems) involves four files, and typically occurs in a couple a of situations:

            1) when you make changes to a file that someone else has also made changes to and committed those changes back into the VCS (so your modified file doesn't contain the changes made by the other person)
            2) when separate branches that have been independently modified need to be merged (such as when you need to incorporate bug fixes made into a maintenance branch into a branch where feature work was being done)

            The four files involved are:

            1) the common base for the modified files
            2) the file with modifications made by the other person/on the other branch
            3) the file with modifications you made/changes made on the current branch
            4) the 'output' file that contains the merged changes (which might consist of changes automatically brought in by the tool if there is no conflict for the change, areas marked for conflict resolution, or changes that were manually made because of conflicts the tool could not automatically resolve).

            Just being able to move differences between two files being compared is not the same thing as a merge operation. The common base file is needed so the tool can determine where there's a conflict.

            6,684586
            Grand MasterGrand Master
            6,684586

              Sep 21, 2012#6

              mwb1100, thanks for this additional information.

              Well, UC supports also a 3-Way Text Compare which can be initiated also from command line.

              The second file loaded into middle pane should be common base to merge the differences from first and third file into this file.

              After merging the changes to second file using the commands in menu Merge or in context menu or the symbols between the panes, clicking into middle pane to make it active pane and using File - Save As makes it possible to save the file with the changes from first and second file with a new name.

              So the merge should not be a problem. But how to tell the version system which file contains the merge output could be a problem.

              2
              NewbieNewbie
              2

                Sep 25, 2012#7

                Here is a URL that has several compare/merge parameters for other tools, but it doesn't mention UltraCompare: diff/merge configuration in Team Foundation - common Command and Argument values. Does anyone have some ideas on the correct parameters to merge?

                This is a sample TFS page where the Operation can be set to Merge and the Command set to the UltraCompare executable. However, I don't know the best way to set up the arguments.


                BTW, for compare, I have the parameters arguments: %1 %2 -t --ne -B -b -lt

                6,684586
                Grand MasterGrand Master
                6,684586

                  Sep 25, 2012#8

                  Without being able to test anything below, I suggest following for diff:

                  Code: Select all

                  -B -b -lt-ne -t %1 %2 -title1 %6 -title2 %7
                  For a 2-way merge I suggest:

                  Code: Select all

                  -B -b -lt -ne -rom %1 %2 %4 -title1 %9 -title2 %7
                  I don't know if -title1 and -title2 work with option -rom at all. I have simply never tried it.


                  For a 3-way merge I think there is no possibility to call UltraCompare directly with the 4 files (3 input files + 1 output file for merged data). But it should be possible to workaround this problem with calling a batch file instead of uc.com directly. The batch file must contain 2 lines:

                  Code: Select all

                  @copy /y %3 %4 >nul
                  @uc.com -B -b -lt -ne -3 %1 %4 %2 -title1 %5 -title2 %6 -title3 %7
                  The options to specify in TFS are:

                  Code: Select all

                  %1 %2 %3 %4 %7 %9 %8
                  The merges must be done in UltraCompare to file in middle frame and this file must be saved. The batch file should execute:

                  Code: Select all

                  copy /y "base file" "merged file" >nul
                  uc.com -B -b -lt -ne -3 "original file" "merged file" "modified file" -title1 "original file label" -title2 "merged file label" -title3 "modified file label"
                  If it is not possible to specify different executables for diff and merge, it would be necessary to use the batch file as launcher of uc.com for all 3 operations. That is no problem as you can in this case specify as first parameter the information for the batch file which operation should be done. The batch file containing 3 different calls of uc.com passes then all other parameters from TFS to uc.com according to required operation as specified in first parameter.

                  1

                    Oct 03, 2012#9

                    Thank goodness for this post and Mofi.

                    I made the bat file that he suggested, but found that where I merged lines the carriage returns didn't always work out right. In the end I found that this worked:

                    Code: Select all

                    @copy /y %3 %4 >nul
                    @uc.com -3 %1 %4 %2 -title1 %5 -title2 %6 -title3 %7
                    Also, to return to TFS, just close UC with the red cross (top right) and say yes to the save file prompt.

                    I'm not sure that TFS is giving the correct parent file in %3 though...