Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Smart Merge not working

Discussion in 'Formats & External Tools' started by cyrusthegreater, Apr 2, 2015.

  1. jdrewsen

    jdrewsen

    Unity Technologies

    Joined:
    Mar 28, 2011
    Posts:
    204
    I recommend that you try out another tool (e.g. tortoisegit) to see if it is a general problem in your setup.

    Additionally, check your git config if you have a mergetool configured there. Maybe it conflicts with your sourcetree setup (it shouldn't but give it a shot). 'git config -l' in the repo directory will show your git config settings.

    That default fallback file is located next to the unityyamlmerge executable and called mergespecfile.txt. In any case here is current version of it: https://gist.github.com/jcd/7b5417cb6c8f275ad4a5
     
  2. SidarVasco

    SidarVasco

    Joined:
    Feb 9, 2015
    Posts:
    163
    Thanks for the reply,


    I just tried tortoisegit and when I try to merge it says " success" but when i open my scene in Unity is still says there are merge conflicts.

    Edit:

    NVM I got it working. Yalmmerge cmd tool showed up and then I marked conflict with resolved. Ill just do that in the future. Sourcetree is broken for me then,
     
    Last edited: Oct 15, 2015
  3. jdrewsen

    jdrewsen

    Unity Technologies

    Joined:
    Mar 28, 2011
    Posts:
    204
    Glad you got it to work... It seems you should bug sourcetree devs to get your sourcetree setup working then.
     
  4. SidarVasco

    SidarVasco

    Joined:
    Feb 9, 2015
    Posts:
    163
    Hey, It's me again.

    YalmMerge crashes trying to merge one of my scenes. Does Yalmmerge output a log file?

    Currently in the mids of updating unity to 5.2.2f1, So i have to check if that solves anything.

    Edit:
    That didn't help. Any suggestions?


    Edit2:

    https://drive.google.com/file/d/0Bw1JcvaePEK_ZVFyaVVFWTJIM1U/view?usp=sharing

    Here are the local, remote and base.

    Edit 3:

    Adding a few more updates to remote and pulling that helped getting me merged. But I hope you still can fix a potential bug with the files i gave you!
     
    Last edited: Oct 22, 2015
  5. jdrewsen

    jdrewsen

    Unity Technologies

    Joined:
    Mar 28, 2011
    Posts:
    204
    Hi @SidarVasco

    Thanks for the files. I will definitely try to reproduce!
     
  6. jdrewsen

    jdrewsen

    Unity Technologies

    Joined:
    Mar 28, 2011
    Posts:
    204
    @SidarVasco

    Reproduced and made a fix for it. Thanks again for the repro files.
     
  7. SidarVasco

    SidarVasco

    Joined:
    Feb 9, 2015
    Posts:
    163
    Glad I could help! Anything obvious why it crashes the yalm merger?
    Perhaps we did something wrong in our project.

    Also where is the executable up for download?
    With different projects and their Unity versions it's probably best if we could download the tool separately and make sure we can easily get the latest patches for UnityYAMLMerge
     
  8. jdrewsen

    jdrewsen

    Unity Technologies

    Joined:
    Mar 28, 2011
    Posts:
    204
    You didn't do anything wrong, but you scenes were just triggering an edge case that had a bug.

    The fix will get into a patch release. I agree that with external tools like UnityYAMLMerge it would be nice to have a separate download and I will think about how that could be done.
     
  9. AlexHell

    AlexHell

    Joined:
    Oct 2, 2014
    Posts:
    167
    Last edited: Oct 28, 2015
  10. AlexHell

    AlexHell

    Joined:
    Oct 2, 2014
    Posts:
    167
    I have a question: is I do this correctly? - I run YAMLMerge with parameters "merge -p -o out.txt --describe base new1 base result" to see diff new1/ base in output file.
     
    Last edited: Oct 28, 2015
  11. jdrewsen

    jdrewsen

    Unity Technologies

    Joined:
    Mar 28, 2011
    Posts:
    204
    Thanks for the bug report... I will have a look at it.
     
  12. jdrewsen

    jdrewsen

    Unity Technologies

    Joined:
    Mar 28, 2011
    Posts:
    204
    The mergetool doesn't support showing a diff yet. It is only for merging. What is the use case for it? It shouldn't be hard to add.
     
  13. onimitch

    onimitch

    Joined:
    Mar 26, 2014
    Posts:
    7
    Hey Jonas! First of all many thanks for developing this tool, it is literally a god send.

    I'm having some issues merging several scene files at the moment (have 6 of them) which result in a Segmentation Fault. I've uploaded the first with remote, local and base files if you're able to take a look. https://dl.dropboxusercontent.com/u/5550879/YAMLMerge Seg Fault.zip

    Thanks!

    P.S. If you want the other scene files too, let me know. Although I suspect the issue is the same.

    P.S.S. I'm running Unity 5.2.2f1
     
  14. jdrewsen

    jdrewsen

    Unity Technologies

    Joined:
    Mar 28, 2011
    Posts:
    204
    Thanks... I will have a look
     
  15. onimitch

    onimitch

    Joined:
    Mar 26, 2014
    Posts:
    7
    Thanks Jonas. I'm also getting a "std::exception" error with some different scene files. Uploaded here:

    https://dl.dropboxusercontent.com/u/5550879/YAMLMerge std exception.zip

    The output is literally just:

     
  16. jdrewsen

    jdrewsen

    Unity Technologies

    Joined:
    Mar 28, 2011
    Posts:
    204
  17. SidarVasco

    SidarVasco

    Joined:
    Feb 9, 2015
    Posts:
    163
    Early this day we had a case where YalmMerge would start but not really complete ( we think ). Memory consumption would run up to 1.5 gigs and just continue going. My coworker fixed it by just clicking " using theirs" . So I lost track of which files were used.

    Maybe the tool gets stuck in a loop or something? Next time ill make sure ill get the files in question.
     
  18. jdrewsen

    jdrewsen

    Unity Technologies

    Joined:
    Mar 28, 2011
    Posts:
    204
    Yes please capture the files for me if possible. Also there is something in the pipeline to reduce memory usage a great deal which will help if memory usage is actually the cause of the problem you are experiencing.
     
  19. jdrewsen

    jdrewsen

    Unity Technologies

    Joined:
    Mar 28, 2011
    Posts:
    204
    Looking at the files the structure look rather uncommon. Are they generated? Or do you have some tooling doing special stuff?
     
  20. SidarVasco

    SidarVasco

    Joined:
    Feb 9, 2015
    Posts:
    163
    As I've mentioned before about suggesting to have the tool separate: Sometimes we update our unity with a patch and apparently mergespecfile is overriden everytime thus losing the path to our fallback tool.
    I don't mind keeping track of this myself but our 3D and 2D artists shouldn't have to. I hope you guys offer the binaries as a seperate download soon enough. Having one central place to manage the tool seems more ideal.

    Other than you guys hardcoding where the yalmmerge tool resides for Unity, is there any other reason why it's setup like this?
     
  21. jdrewsen

    jdrewsen

    Unity Technologies

    Joined:
    Mar 28, 2011
    Posts:
    204
    The structure also looks uncommon for these files. So same question as for the other one applies here.
     
  22. jdrewsen

    jdrewsen

    Unity Technologies

    Joined:
    Mar 28, 2011
    Posts:
    204
    You can just copy the mergespecfile somewhere else and set it as command line argument to the tool. That should fix you problems when upgrading.

    The reason it is part of the Unity install is that is seems like a natural thing to bundle with it. I think a better solution is to make the tool check for a <homefolder>/.mergespecfile or something like that and use that if present and only then fallback to the one shipped with unity. Will put that on the roadmap.
     
  23. onimitch

    onimitch

    Joined:
    Mar 26, 2014
    Posts:
    7
    Ah right. We are using a plugin called Advanced Additive Scenes which I think might be saving the file using an Asset function rather than SaveScene. Is it possible to work around the issues in the YAMLMerge tool (we rely quite heavily on the plugin unfortunately)?
     
  24. SidarVasco

    SidarVasco

    Joined:
    Feb 9, 2015
    Posts:
    163
    This also means that the only way to get the latest version with any bug fixes is to download the latest unity? I'm not sure how that is natural with keeping the tool itself up to date.

    Also how would I make yalmmerge to look for the mergespecfile file elsewhere?
     
  25. jdrewsen

    jdrewsen

    Unity Technologies

    Joined:
    Mar 28, 2011
    Posts:
    204
    Unfortunately not. Unity itself ensures that object ids in the scene stays the same when it saves which makes it possible to relate objects between versions. The plugin you mention doesn't keep the id of objects and also reuses ids for different kinds of objects which makes it impossible to match between versions. Best bet is to contact the author of the plugin and get him to fix that.
     
  26. jdrewsen

    jdrewsen

    Unity Technologies

    Joined:
    Mar 28, 2011
    Posts:
    204
    It is natural in the way that when a new version of Unity is out the tool may need to be updated to handle new stuff in Unity. I do see how you may want to not upgrade Unity but still want fixes in a new merge tool though. I will put it on the roadmap.

    Also how would I make yalmmerge to look for the mergespecfile file elsewhere?[/QUOTE]

    use the --fallback command line option. Thinking about it mergespecfile is actually a bad name and should really be mergefallbacks or something.
     
  27. SidarVasco

    SidarVasco

    Joined:
    Feb 9, 2015
    Posts:
    163
    To be clear I can just add that to the end of my command for yalmmerge in sourcetree?

    Thanks.
     
  28. jdrewsen

    jdrewsen

    Unity Technologies

    Joined:
    Mar 28, 2011
    Posts:
    204
    Not at the end but before listing the files to be merge e.g. after the -p switch like "UnityYamlMerge.exe -p --fallback mymergespecfile .......".
    You can always try to run the tool from the command line with no arguments to see help on usage.
     
  29. AlexHell

    AlexHell

    Joined:
    Oct 2, 2014
    Posts:
    167
    I'm looking for a way for (not very often; in some cases in the spirit of "changed slightly == all ok") "code-review" of unity scene files and prefabs. I tried to look diff of scenes/prefabs in mercurial, but it's huge and unusable, may be because of unity inner format. Often the problem root is ID change or change parent, etc, but it creates a huge diff output, when user action is only slightly change prefab or scene.
     
    Last edited: Nov 20, 2015
  30. onimitch

    onimitch

    Joined:
    Mar 26, 2014
    Posts:
    7
    OK. Thanks for looking into it Jonas, it's really helpful to understand the problem.
     
  31. jdrewsen

    jdrewsen

    Unity Technologies

    Joined:
    Mar 28, 2011
    Posts:
    204
    Yes. Conventional tools doesn't handle this well. The diff feature for UnityYAMLMerge was actually implemented to start out with but we decided to disable it since the out diff format was a custom one. But for code review processes that may still be useful. I'll see if I can revamp it.
     
  32. jdrewsen

    jdrewsen

    Unity Technologies

    Joined:
    Mar 28, 2011
    Posts:
    204
    I've now revamped the diff command. Can't tell when it will get released yet though.
     
  33. samvis

    samvis

    Joined:
    Oct 14, 2014
    Posts:
    6
    Hi,
    we have larger scene in our project and most of the time the UnityYAMLMerge tool is working, but on last SVN update it stops working when merging and does not merge anything. I am attaching also SVN files that caused the crash.
    Can you look at these files and possibly tell us where the problem is? Thanks.
     

    Attached Files:

  34. jdrewsen

    jdrewsen

    Unity Technologies

    Joined:
    Mar 28, 2011
    Posts:
    204
  35. jdrewsen

    jdrewsen

    Unity Technologies

    Joined:
    Mar 28, 2011
    Posts:
    204
    @samvis Found a bug causing your issue and have a fix in the pipeline.
     
  36. jdrewsen

    jdrewsen

    Unity Technologies

    Joined:
    Mar 28, 2011
    Posts:
    204
  37. samvis

    samvis

    Joined:
    Oct 14, 2014
    Posts:
    6
    @jdrewsen That was a fast response. Thank you very much for your effort. I will try it tomorrow.
     
  38. rioneye

    rioneye

    Joined:
    Aug 10, 2015
    Posts:
    12
    I've been trying to add The smart merge capability to my Plastic SCM setup but I keep getting an error:

    Error in merge tool "C:\Program Files\Unity\Editor\Data\Tools\UnityYAMLMerge.exe merge -p “@basefile” “@sourcefile” “@destinationfile” “@output”" execution. Merge tools in client.conf are incorrectly defined

    This is what the client.conf file looks like:

    <?xml version="1.0"?>
    <ClientConfigData xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <Language>en</Language>
    <WorkspaceServer>ssl://USER-PC:8088</WorkspaceServer>
    <WorkingMode>NameWorkingMode</WorkingMode>
    <SecurityConfig />
    <CurrentWorkspace>c:\Users\Public\Documents\Unity Projects\TapCreo</CurrentWorkspace>
    <MergeTools>
    <MergeToolData>
    <FileExtensions>.unity;.prefab</FileExtensions>
    <Tools>
    <string>C:\Program Files\Unity\Editor\Data\Tools\UnityYAMLMerge.exe merge -p “@basefile” “@sourcefile” “@destinationfile” “@output”</string>
    </Tools>
    </MergeToolData>

    <MergeToolData>
    <FileExtensions>.doc;.docx</FileExtensions>
    <Tools>
    <string>"C:\Program Files\PlasticSCM5\client\diffscripts\merge-doc.exe" "@destinationfile" "@sourcefile" "@output"</string>
    </Tools>
    </MergeToolData>
    <MergeToolData>
    <FileType>enTextFile</FileType>
    <FileExtensions>*</FileExtensions>
    <Tools>
    <string>mergetool -b="@basefile" -bn="@basesymbolic" -bh="@basehash" -s="@sourcefile" -sn="@sourcesymbolic" -sh="@sourcehash" -d="@destinationfile" -dh="@destinationhash" -a -r="@output" -t="@filetype" -i="@comparationmethod" -e="@fileencoding" -m="@mergetype" -re="@resultencoding" --progress="@PROGRESS" --extrainfofile="@extrainfofile"</string>
    </Tools>
    </MergeToolData>
    <MergeToolData>
    <FileType>enBinaryFile</FileType>
    <FileExtensions>*</FileExtensions>
    <Tools>
    <string>binmergetool -b="@basefile" -bn="@basesymbolic" -bh="@basehash" -s="@sourcefile" -sn="@sourcesymbolic" -sh="@sourcehash" -d="@destinationfile" -dh="@destinationhash" -a -r="@output" -m="@mergetype"</string>
    </Tools>
    </MergeToolData>
    </MergeTools>
    <DiffTools>
    <DiffToolData>
    <FileExtensions>.doc;.docx</FileExtensions>
    <Tools>
    <string>wscript.exe "C:\Program Files\PlasticSCM5\client\diffscripts\diff-doc.js" "@sourcefile" "@destinationfile" //E:javascript</string>
    </Tools>
    </DiffToolData>
    <DiffToolData>
    <FileExtensions>.xls;.xlsx</FileExtensions>
    <Tools>
    <string>wscript.exe "C:\Program Files\PlasticSCM5\client\diffscripts\diff-xls.js" "@sourcefile" "@destinationfile" //E:javascript</string>
    </Tools>
    </DiffToolData>
    <DiffToolData>
    <FileExtensions>.ppt;.pptx</FileExtensions>
    <Tools>
    <string>wscript.exe "C:\Program Files\PlasticSCM5\client\diffscripts\diff-ppt.js" "@sourcefile" "@destinationfile" //E:javascript</string>
    </Tools>
    </DiffToolData>
    <DiffToolData>
    <FileType>enTextFile</FileType>
    <FileExtensions>*</FileExtensions>
    <Tools>
    <string>$internal_tool</string>
    </Tools>
    </DiffToolData>
    <DiffToolData>
    <FileType>enBinaryFile</FileType>
    <FileExtensions>*</FileExtensions>
    <Tools>
    <string>binmergetool -s="@sourcefile" -sn="@sourcesymbolic" -d="@destinationfile" -dn="@destinationsymbolic" -a -t="@filetype" -i="@comparationmethod" -e="@fileencoding"</string>
    </Tools>
    </DiffToolData>
    </DiffTools>
    <SetFilesAsReadOnly>no</SetFilesAsReadOnly>
    <SetRevisionFileDate>no</SetRevisionFileDate>
    <SupportSmbWorkspaces>no</SupportSmbWorkspaces>
    <PerformAddPlusCi>no</PerformAddPlusCi>
    <CheckFileContentForChanged>no</CheckFileContentForChanged>
    <CaseSensitiveFsOnMac>no</CaseSensitiveFsOnMac>
    <SameItemDifferentCaseError>no</SameItemDifferentCaseError>
    <CacheServer />
    <CheckinQueuesSize>50</CheckinQueuesSize>
    <DownloadPoolSize>1</DownloadPoolSize>
    <UploadCompressionSize>1</UploadCompressionSize>
    <PendingChangesOnSwitchAction>Fail</PendingChangesOnSwitchAction>
    </ClientConfigData>

    Am I missing something?

    Note: I followed the instructions on the smart merge page for plastic scm
     
    Last edited: Jan 25, 2016
  39. oscarb92

    oscarb92

    Joined:
    Jan 28, 2016
    Posts:
    2
    Hello,

    I've been trying to setup UnityYAMLMerge as merge tool with Unity 5.3.1 and Git in Windows 10.

    Unfortunately I'm not sure how to make it work. Here's what I've done based on what I've read on these links:
    http://docs.unity3d.com/Manual/SmartMerge.html
    https://www.reddit.com/r/Unity3D/comments/39bdq5/how_to_solve_scene_conflicts_with_unitys_smart/

    1) Set up both .gitconfig (global) and .git/config (local project) by adding this:

    [merge]
    tool = unityyamlmerge

    [mergetool "unityyamlmerge"]
    trustExitCode = false
    cmd = 'C:\\Program Files\\Unity\\Editor\\Data\\Tools\\UnityYAMLMerge.exe merge' -p "$BASE" "$REMOTE" "$LOCAL" "$MERGED"

    2) Installed Perforce P4V and added merge apps

    3) Set up mergespecfile.txt modifying the uncommented lines so they look like this:
    unity use "C:\Program Files\Perforce\p4merge.exe" "$BASE" "$LOCAL" "$REMOTE" "$MERGED"
    prefab use "C:\Program Files\Perforce\p4merge.exe" "$BASE" "$LOCAL" "$REMOTE" "$MERGED"

    Me and my teammate have edited a scene, and when I pull the changes (git bash) it just shows me the typical error message:
    warning: Cannot merge binary files: Assets/Scenes/GameScene.unity (HEAD vs. 81d75fc59feed35563a24b8dd609fa29deb5ec46)
    Auto-merging Assets/Scenes/GameScene.unity
    CONFLICT (content): Merge conflict in Assets/Scenes/GameScene.unity
    Automatic merge failed; fix conflicts and then commit the result.

    I'm not sure if I'm missing something. I hope someone can help us.

    Thanks.
     
  40. jdrewsen

    jdrewsen

    Unity Technologies

    Joined:
    Mar 28, 2011
    Posts:
    204
    Seems like you are using binary serialization mode in your project. Change til in menu "Edit -> Project Settings -> Editor" under "Assert Serialization" select "force text". This will become standard at some point in the future but for now it defaults to mixed mode.
     
  41. jdrewsen

    jdrewsen

    Unity Technologies

    Joined:
    Mar 28, 2011
    Posts:
    204
    I am not an expert in PlasticSCM but comparing the UnityYAMLMerge.exe entry and the merge-doc.exe entry it seems that the quotation marks are different and may cause trouble? Or maybe you need to quote the path to the program and/or the option flags?
     
  42. oscarb92

    oscarb92

    Joined:
    Jan 28, 2016
    Posts:
    2
    Hey. Thanks for the reply.

    We already figured that out just yesterday. Now we are able to solve conflicts in the old fashioned way.

    Thank you very much.
     
  43. John-Gray

    John-Gray

    Joined:
    Nov 27, 2012
    Posts:
    133
    Hi guys,

    We have recently set up Smart Merge on our Perforce server and it is functional but we have discovered that some of the behaviour of the tool is undesirable and were wondering if there was something built into the tool to get around the following:

    We have a scene as a test which contains a single object (a cube) centred on the world origin.

    If one user moves the cube from (0, 0, 0) to (1, 0, 0), and another user moves the cube to (0, 0, 1), then the result of the merge is (1, 0, 1). This is extremely undesirable as it matches neither scene. I would expect the merge to be able to detect this and flag that the lights are both different and force the user performing the merge to choose one rather than accumulating the values into what is essentially a new setting.

    We have the same issues with lights, for example starting with a light with RGB values of (0, 0, 0), one user changes to (255, 0, 0) and another (0, 0, 255) as the colour of the light. We would expect the merge to catch this as a conflict as the scenes are different but what actually happens is that the red light and the blue light are merged, resulting in a purple light in the merged scene.

    Is there any way around this? Instead of treating a Vector3 as a structure in its own right, it compares the components of the Vector3 which is no good when merging scene files.

    Any advice on this would be appreciated.

    Cheers,

    John
     
  44. quesadillas

    quesadillas

    Joined:
    May 1, 2015
    Posts:
    23
    Hello!
    I had a couple questions about some stuff in the YAML merge tool that I haven't been able to find online.

    One issue I had when I was merging two very large scene files is that there were "m_RootOrder" merge conflicts. Part of this is a known issue in an old version of UFPS that creates some weird timer objects, and those were the objects that created this weird conflict. But there were also some other miscellaneous objects, like a fence object in our level, that would cause this. I guess what I wanna know is... what does m_RootOrder mean? I thought it meant something about the object hierarchy but then I dunno why something has a hierarchy of 276...

    Another problem I had was some child objects that disappeared when I merged. Instead I got an error that looked like:

    "Broken Text PPtr in file([unity file path shown here]. Local file identifier ([some object id shown here]) doesn't exist!"

    I know that the error is being produced because my parent object still had those ids but those object ids weren't found on the level, but what concerns me is that I don't know how those objects disappeared. Both branches of this scene had these objects, and neither of us deleted them. It wasn't a big deal to remake them, I'm just scared that it will happen again later.
    Thank you for your time!
     
  45. ELineCEng

    ELineCEng

    Joined:
    Sep 13, 2014
    Posts:
    8
    Hello,

    I have gotten TortoiseSVN to use UnityYAMLMerge for conflict solving with P4Merge as the fallback. I discovered that I had to include the --force switch, otherwise UnityYAMLMerge appears to do no work, falling back to P4Merge immediately.

    I am feeding UnityYAMLMerge files of extension .unity.rOLDREV (the base file), .unity.rNEWREV (the remote file), .unity.mine (the local file), and .unity (the merged file). Could these suffixes be the reason --force is needed? If so, this probably should be mentioned in the SmartMerge documentation (along with a TortoiseSVN section perhaps).

    Thanks,
    Chris
     
    Last edited: Mar 3, 2016
  46. ELineCEng

    ELineCEng

    Joined:
    Sep 13, 2014
    Posts:
    8
    Does UnityYAMLMerge provide any indication whether the merge was successful, whether handled by it or the fallback? I am trying to write a batch script to automatically resolve conflicts in TortoiseSVN upon successful merges, but UnityYAMLMerge does not appear to return a value or set an error level to make this straightforward.

    Thanks,
    Chris
     
    JustAnotherDude likes this.
  47. samvis

    samvis

    Joined:
    Oct 14, 2014
    Posts:
    6
    We encountered another error when merging our big scene. This time, error message box with text "Cannot do a double change on the same key in a mapping" appeared. I'm sending scene versions that caused this error. @jdrewsen, can you look at it? Thanks.
     

    Attached Files:

  48. JustAnotherDude

    JustAnotherDude

    Joined:
    Oct 28, 2013
    Posts:
    279
    I came here to post this, a feedback from the tool is really missing...
     
  49. jdrewsen

    jdrewsen

    Unity Technologies

    Joined:
    Mar 28, 2011
    Posts:
    204
    Yes... that is why force is needed.
     
  50. jdrewsen

    jdrewsen

    Unity Technologies

    Joined:
    Mar 28, 2011
    Posts:
    204
    The tool exits with 1 in case of error, 2 in case of conflicts when not using a fallback. When using a fallback it will exit with the exit code of the fallback app.
     
    ELineCEng likes this.