Page 1 of 2 12 LastLast
Results 1 to 10 of 18
  1. #1
    Join Date
    Oct 2007
    Location
    Pennsylvania
    Posts
    1,772

    Default I need to force a merge even if there are conflicts

    I need to force a 3-way merge output file to be saved even if there are conflicts. The help file says:

    /force Forces /automerge to create an output file with CVS-style conflict markers if conflicts are found.

    However, I definitely do not want conflict markers saved in the file. I want BC3 to favor the side I specify and just save the output file. If you must alter the output file due to the conflicts, then I want a single line added to the very top of the file indicating that there were conflicts during the merge, but no markers inserted within the body of the file itself.

    I am working through a project in which I am merging over 1800 files. I have follow up tools to verify whether or not a merge was successful, and the presence of conflict markers would impact the validation (because the conflict markers would be detected as invalid code).
    BC v4.0.7 build 19761
    ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ

  2. #2
    Join Date
    Oct 2007
    Location
    Madison, WI
    Posts
    2,503

    Default

    It should be prety easy to do this from VBScript; just wrap the call to BC, check the exit code, and if it's a conflict do a search&replace on the conflict markers. This doesn't sound like a bad suggestion, but I can't see us adding yet more automerge flags without additional requests for it.
    Zoë P Scooter Software

  3. #3
    Join Date
    Oct 2007
    Location
    Pennsylvania
    Posts
    1,772

    Default

    When I call BC3 from a vbScript using the Windows Scripting Host shell.run command, error codes do not seem to be returned. Is there a better way to run BC3 from within a vbScript that will capture the errors?
    BC v4.0.7 build 19761
    ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ

  4. #4
    Join Date
    Oct 2007
    Location
    Madison, WI
    Posts
    2,503

    Default

    According to MSDN, shell.Run has an optional third parameter controlling whether to wait for the process, and if it's true the return value is the program's exit code. There's sample code at the link.
    Zoë P Scooter Software

  5. #5
    Join Date
    Oct 2007
    Location
    Pennsylvania
    Posts
    1,772

    Default

    Well, now, that kind of defeats the purpose, don't you think? I run a batch of compares, have them launch in separate tabs in BC3, then work through the sessions. I couldn't do that if I set the wait parameter to True, now could I? Working on each compare one at a time before the process continues would certainly impact my productivity. Hence my request for a way to force the save and review the files later!
    BC v4.0.7 build 19761
    ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ

  6. #6
    Join Date
    Oct 2007
    Location
    Pennsylvania
    Posts
    1,772

    Default

    When in the IDE, you can open a 3-way merge with conflicts. You can close the merge without addressing the conflicts. BC3 asks if you want to save the merge results. You can specify yes or no. I am simply asking for the same functionality in a command line initiated merge. A parameter that allows me to save the merge output with conflicts. I thought /force would do that for me. In my opinion, that is what /force should do. Howerver, since it does not, I am proposing an additional parameter (/noconflictmarkers) that simply turns off the conflict markers. How difficult could that be to implement?
    BC v4.0.7 build 19761
    ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ

  7. #7
    Join Date
    Oct 2007
    Location
    Madison, WI
    Posts
    2,503

    Default

    I'm obviously missing something here. You're using "/automerge /reviewconflicts" aren't you? /reviewconflicts and /force are mutually exclusive; you can use one or the other. If you use /reviewconflicts it opens the interactive merge. Any conflicts are resolved by taking non-conflicting lines from their respective sides and I think the conflicting lines are taken from the center. If you save interactively it does not add conflict markers.
    Zoë P Scooter Software

  8. #8
    Join Date
    Oct 2007
    Location
    Pennsylvania
    Posts
    1,772

    Default

    Yes, I am currently using /automerge /reviewconflicts.

    The reason I am using /automerge /reviewconflicts is because I did not have an option to /force with /noconflictmarkers.

    I agree that /force and /reviewconflicts are mutually exclusive. I was not suggesting otherwise. If I am not using /reviewconflicts, then I would like to use /force with /noconflictmarkers.
    BC v4.0.7 build 19761
    ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ

  9. #9
    Join Date
    Oct 2007
    Location
    Pennsylvania
    Posts
    1,772

    Default

    Quote Originally Posted by Craig View Post
    Any conflicts are resolved by taking non-conflicting lines from their respective sides and I think the conflicting lines are taken from the center.
    I would think that /favorright and /favorleft should override taking the conflicting lines from the center.

    Quote Originally Posted by Craig View Post
    If you save interactively it does not add conflict markers.
    Exactly! ... and I would like the same functionality from the command line.
    BC v4.0.7 build 19761
    ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ

  10. #10
    Join Date
    Oct 2007
    Location
    Madison, WI
    Posts
    2,503

    Default

    Use /automerge /force, pass the "wait" flag to shell.run, and when the program returns use WSH's RegEx support to find the conflict markers and replace them with just the favored side. The conflict markers look like:

    <<<<<<
    lines from left side
    ======
    lines from right side
    >>>>>>

    So it should be pretty easy to just pull out your favored side.
    Zoë P Scooter Software

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •