Merge the difference from 2 files into a third file.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • nagse02
    Visitor
    • Apr 2009
    • 4

    Merge the difference from 2 files into a third file.

    Hello,

    I'm working with different branches in source control.
    If I do a change to in branch then I need to do the same change in another branch but for the same file. The files are 99% identical.

    Is there a way to merge the change that I made in one branch in to a third file that belongs to another branch, but only that change and no other ones.

    Example:

    File1:
    Branch1
    test1
    test2
    test3

    File2:
    Branch1
    test1
    test2
    newtest
    test3

    File3:
    Branch2
    test1
    test2
    test3

    After merge File3 I need to look like:
    Branch2
    test1
    test2
    newtest
    test3

    Is this possible? I can't 2 or 3-way merge do what I'm looking for.

    Thanks in advance.

    Regards,
  • Aaron
    Team Scooter
    • Oct 2007
    • 16026

    #2
    Hello,

    If I understand the request correctly, then unfortunately we cannot. We do not track which changes you merge manually when creating newtest, so we cannot propagate those same "Take Left" here, or "Take Center" there to another set of files.

    If your changes do not need manual input, and the /automerge command line switch can automatically merge your files, then you may be able to work with that.

    You can send example screenshots, files, or any private examples to [email protected]. Please include a link to this forum post as well.
    Aaron P Scooter Software

    Comment

    • nagse02
      Visitor
      • Apr 2009
      • 4

      #3
      Hi AAron,

      Thank you for your feedback.

      What I was looking for was a 2-way compare with the possibility to click on an "arrow" or something to merge the result of the 2-way compare in a third file, even if it's line by line.

      Something like:
      (compare (compare a to b) to c)

      like a 2-way compare that compares the result of another 2-way compare to a third file

      This is very helpful for developers that have to add changes in 2 different branches and they need to put only that one difference not all the differences between the files. Instead of comparing the file that has the latest change + other changes to the file from the other branch and trying to find the latest change in the file from branch one. this way I compare the version x to x-1 and get the different and add it to the file from branch2.

      Hope that this clarifies my need

      Regards,

      Comment

      • Aaron
        Team Scooter
        • Oct 2007
        • 16026

        #4
        Hello,

        Yes, that does help clarify. Thanks!

        We have a Text Merge Session type in BC3 Pro which allows for 2 or 3 files to be merged into an Output (3rd or 4th file).

        Here is a screenshot of the Text Merge in 3-way mode. The center top pane is optional.
        http://www.scootersoftware.com/morei...moreinfo_merge
        Aaron P Scooter Software

        Comment

        • Aaron
          Team Scooter
          • Oct 2007
          • 16026

          #5
          We also have a /savetarget command line which can be passed in. This will make the first/any save point to the specific file instead of overwriting the file in the 2nd pane. You can see examples of this here. Search for the text /savetarget.

          http://www.scootersoftware.com/suppo...?zz=kb_vcs.php
          Aaron P Scooter Software

          Comment

          • nagse02
            Visitor
            • Apr 2009
            • 4

            #6
            Thank you Aaron,

            This took me closer to my need. Is there a way to force the conflicts to not be automatically merged?

            I have this conflict:
            static const char * const xyxyxyx_c_RCSID = "@(#)$Id: xyxyxyx.c,v 1.357.1.2.1.11 2009/04/27 05:11:36 yyyyyyy Exp xxxxxxx $";
            static const char * const xyxyxyx_c_RCSID = "@(#)$Id: xyxyxyx.c,v 1.357.1.17 2009/04/27 05:03:11 yyyyyyy Exp xxxxxxx $";
            static const char * const xyxyxyx_c_RCSID = "@(#)$Id: xyxyxyx.c,v 1.357.1.18 2009/05/13 17:32:50 xxxxxxx Exp $";

            to my new file automatically is added:
            static const char * const xyxyxyx_c_RCSID = "@(#)$Id: xyxyxyx.c,v 1.357.1.17 2009/04/27 05:03:11 yyyyyyy Exp xxxxxxx $";

            Why the merged line is the one from center and not from left?

            I would like if there is a conflict keep the left one , since this is what I noticed that this is the file where everything get's merged, unless I manually merge it.

            Regards,

            Comment

            • Aaron
              Team Scooter
              • Oct 2007
              • 16026

              #7
              Hello,

              So you are using BC3 Pro's Text Merge session type, correct? That section should be marked as a Conflict section, since all three do not match.

              If you are using the command line, then /automerge should not create the output, and /reviewconflicts would prompt if any were found.

              Are you using the graphical interface or script or command line to attempt the merge? You can post detailed steps here, or email them to [email protected] to keep the information private.

              If you do email us, please include a link back to this forum post.
              Aaron P Scooter Software

              Comment

              • nagse02
                Visitor
                • Apr 2009
                • 4

                #8
                Aaron,

                Yes, I'm using BC3 Pro's Text Merge.
                I tried command line, graphical and the same result.

                The command line that I used is
                BComp.exe xxx.c.1.357.1.2.1.11 xxx.c.1.357.1.18 xxx.c.1.357.1.17 /automerge /reviewconflicts

                It marks that line as conflict but in the output file it defaults to the line from the center file, I would expect to default to the left one, since that's the file into which we want to merge the change, but now I realized that it defaults to the center one because we don't have shortcuts/arrows to pick the center one to resolve a conflict and I think this is hard coded so that in a conflict to always take the line from the center by default and let the user select the left or right one. Is my theory correct?

                Regards,

                Comment

                • Aaron
                  Team Scooter
                  • Oct 2007
                  • 16026

                  #9
                  There should be a default filled in (in this case, from the Center/Base column), but it should be marked as a Conflict section (with a red !) and should not automatically merge until the conflicts are resolved. You can review conflicts by using the Next/Prev Conflict commands.
                  Aaron P Scooter Software

                  Comment

                  Working...