How to auto merge .csv files

I’m doing a merge like this:

cm merge /main/branch/test2 --machinereadable --fieldSeparator=; --endlineSeparator=[[END_LINE]] --merge

In my current branch there’s a .csv file with changes already merged from /main/branch/test1, so when I try to merge with test2 I get a non-automatic conflict, even if when I open plastic mergetool it already shows me the result file with both changes correctly added and I only need to push the “Mark as resolved” button.

Is there a way to tell the merge tool that I’m ok with the merge that it’s doing by default and do the “Mark as resolved” by itself so I don’t have to do it manually?

This is being done by our server script, so the idea is that it can resolve it for .csv files without human intervention.

I’ve tried using the mergetype try and forced options but they won’t resolve it either.

This is what our merge command for .csv files looks like, it’s basically the one from text files:

“mergetool.exe” xmerge -b=“@basefile” -bn=“@basesymbolic” -bh=“@basehash” -s=“@sourcefile” -sn=“@sourcesymbolic” -d=“@destinationfile” -dn=“@destinationsymbolic” -t=“@filetype” -i=“@comparationmethod” -e=“@fileencoding” -sh=“@sourcehash” -dh=“@destinationhash” -r=“@output” -a -m=“@mergetype” -re=“@resultencoding

Thanks.

Hi, I don’t fully understand. What type of merge conflict are you facing? If Plastic is determining the conflict as not automatic, it means that a manual resolution is necessary. For the merge conflicts that require a manual resolution, you can still automatize the contributor to keep is this is what you want. you can check all the details in the “cm merge --help” command:

eg:

    --keepsource              Accepts all changes from source contributor for
                              items with conflicts.
    --keepdestination         Preserves changes from destination contributor
                              for items with conflicts.
    --automaticresolution     Used to resolve directory conflicts. This option
                              lets you choose whether the source or the
                              destination contributor should be automatically
                              selected to resolve the conflict.
                              Use a semicolon to separate conflict types.
                              See Remarks for more info.

We want to keep both source and destination changes.

Here’s the merge:

As a .csv file, each row is its own entry, and we want it to just put all the new lines in the new resulting file, which is doing with the merge. We don’t care about the row being in a specific line, since each row is it’s own thing.

For example…

Source has

line 3 “001, xxxx”
line 4 “002, yyyy”
line 5 “003, zzzz”

Destination has

line 3 “030, qqq”
line 4 “031, www”

We want the resulting merge to be just like what plastic is doing by default:

line 3 “001, xxxx”
line 4 “002, yyyy”
line 5 “003, zzzz”
line 6 “030, qqq”
line 7 “031, www”

In this case clicking “Mark as resolved” is the only thing you need to do keep the file as intended.

I’m not sure why this is happening for your .csv files. I’m guessing there are some other format changes in the files.
Can you attach some example files so we can try the same and debug what’s happening?

I’ve uploaded an example of what the original file would contain. Then a source and destination files each one with changes of its own in the same lines.

The merge can be done with the GUI, but it won’t do it with the command line.

9786270–1404087–csv_example_files.zip (415 Bytes)

Hi, I’m running the merge you shared with us (thanks for that). There is a manual conflict because the source and destination contributor are modifying the same lines:

The bundled external merge tool is asking you to resolve the conflict.
If I properly understand, you would like to keep both contributors in an automated way. Without the need to open the external merge tool and select to keep both contributors. Is this correct?

Yes, ideally I want to be able to do something from the console commands that allows plastic to resolve this kind of conflict by keeping both contributors, just like you do when you press “Mark as resolved” in the GUI.

By default, Plastic asks to launch the external merge tool when there is no automatic conflict. You can configure your desired external text merge tool.

But it’s true that if you use the default Mergetool, there are no other things you can do other than review the result and “Save and Exit”. The problem is the manual conflict is resolved by the external merge tool (not by Plastic itself) and that’s it needs to call to Mergetool to resolve it.

I see… I’ll think on an alternative solution for this kind of merges. Thanks!