Search Unity

Smart Merge not working

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

  1. tylo

    tylo

    Joined:
    Dec 7, 2009
    Posts:
    154
    I am getting an error when I try to use SmartMerge to merge these scenes.

    The error returned is 'found unexpected end of stream' for each of my scene files (BASE,LOCAL,REMOTE).

    I have attached the scene files. They are from Unity 2017.3.0p3
     

    Attached Files:

    Last edited: Apr 20, 2018
  2. Ryan-Unity

    Ryan-Unity

    Joined:
    Mar 23, 2016
    Posts:
    1,993
    Hi @AndyMartin458! Would it be possible to get a copy of your scenes that are resulting in this error? It would help us a lot in debugging the issue. If you don't want to post them publicly here then you can DM me and I can help provide you a secure means to share them.
     
  3. Ryan-Unity

    Ryan-Unity

    Joined:
    Mar 23, 2016
    Posts:
    1,993
    Hi @tylo! Thank you for your repro project. We're investigating it now and we should get back to you soon on the cause of the issue.
     
    tylo likes this.
  4. Ryan-Unity

    Ryan-Unity

    Joined:
    Mar 23, 2016
    Posts:
    1,993
    Hi @jyfc! Thank you for the suggestion! I'll pass that along to the team and see if we can get it added.
     
    jyfc likes this.
  5. michael_kawick

    michael_kawick

    Joined:
    Apr 23, 2018
    Posts:
    1
    Hi guys. A few months ago, we ran into this problem where the merge tool suddenly started crashing. This was about the time that our only scene file reached about 35 Megs. Today, our scene is much larger, approaching 60 Megs. The windows crash message is "YAMLMerge has quit unexpectedly.".

    Is there a command-line param that we can use to expand the amount of RAM that YamlMerge uses or put it into 64bit mode? At the very least, we would like to see which errors that we may have or maybe it's just a size issue.

    If we have an error in our scene file, it seems to load just fine into Unity (2017.3.1p3) and we want to have multiple people working in this scene and simply merge the changes like we used to do. Any suggestions would be helpful. If you have the source for the YAML Merge app that you use, we can build it here and try that.
     
  6. AndyMartin458

    AndyMartin458

    Joined:
    Jul 15, 2012
    Posts:
    59
  7. 40detectives

    40detectives

    Joined:
    Apr 9, 2016
    Posts:
    74
    I'm using Git with the Unity YAML Merge tool. After the SmartTool processes the files, it opens P4Merge to see what needs to be fixed manually.

    When looking at the results of Smart Tool pre merge some values in the $BASE file are missing:

    It should show in the middle something like: m_LocalPosition: {x: 125, y: 1, z: 125}

    But if I check the $BASE file before it was passed to Unity YAML Merge, the base file contains the correct values for the location of the object:


    Is this the expected behaviour?
    If so, kind of misleading... =/
     
    Last edited: Apr 26, 2018
  8. Ryan-Unity

    Ryan-Unity

    Joined:
    Mar 23, 2016
    Posts:
    1,993
    Hi @40detectives! Thank you for bringing that up with us. That's definitely not intended behavior. We've opened a bug on that and will investigate it soon.
     
    40detectives likes this.
  9. greay

    greay

    Joined:
    Mar 23, 2011
    Posts:
    88
    same here. did you ever find a solution?
     
  10. greay

    greay

    Joined:
    Mar 23, 2011
    Posts:
    88
    so, I've tried using the tool to resolve an actual conflict in a scene file... and it didn't actually change the scene. After it was all said & done, the git conflict markers were still littered all through the file.
     
  11. unity_sxF4kWUhnH3bzw

    unity_sxF4kWUhnH3bzw

    Joined:
    Feb 16, 2018
    Posts:
    7
    I still really don't understand what the merge tool is supposed to DO. Information is very sparse and the documentation is mysterious. What does argument -p do? I know it says "premerge", as if everyone has heard of this word. I don't know what it means. It implies to me that no actual merge occurs. There aren't even great references to this term - there are some references in Mercurial documentation, but no definition.

    HOW does it resolve conflicts? It's supposed to use the files specified, but I don't see any information in there. Am I supposed to populate it with rules before it does anything?

    The documentation also alludes to the existence of the settings files but doesn't tell you where they are. As a foolish junior developer it took me several hours of googling for instructions and examples before I realized that I could run the command line option and get usage instructions for the tool. Please put this information in the documentation page. Couldn't hurt to also put all the arguments and their descriptions in there.

    I tried to use the tool with a more experienced developer and it didn't seem to do anything. Maybe our case is a fallback case, but we couldn't get the fallback tool to launch. So uh... how on earth does the tool decide which cases are fallback ones? In the case of a fallback, does the tool do anything or do you just have to manually compare the yaml files?

    I just would like MUCH, MUCH more information. I would like a FULL WALKTHROUGH of setting up the tool, including EXPLICIT STATEMENTS ABOUT WHAT, IF ANY, RULES FILES NEED TO BE MODIFIED FOR THE BASIC FUNCTIONING OF THE SYSTEM. Not allusions and insinuations about files that may exist and somewhere and might be useful. I'd like to know what the system looks like when it works, and what it looks like when it reverts to fallback behavior, and what causes it to go into fallback mode. We spent all day yesterday trying to figure out how to use the thing. I'd like examples, and though I usually hate tutorial videos, this tool is an excellent case for one because users have absolutely no idea what to expect - what the system looks like when it works, when it fails, etc.

    For now we have to go to a system of only allowing one user to work on a scene at a time because it's too complicated to get the tool working, and we don't even understand if it IS working as expected because it isn't clear what it's supposed to be doing. All the documents and references I've found just say stuff like "and BAM! merge problems solved!"

    Maybe it's just that our situation is an actual conflict, which necessitates a fallback resolution, which still becomes rapidly too difficult to manually resolve. There does seem to be no technical way to handle actual conflicts... which seems to suggest that a more stable development pattern is to just force different developers to work on different scenes anyway...
     
    Last edited: May 14, 2018
  12. tylo

    tylo

    Joined:
    Dec 7, 2009
    Posts:
    154
    Any updates on the issue my scene files were having?
     
  13. Ryan-Unity

    Ryan-Unity

    Joined:
    Mar 23, 2016
    Posts:
    1,993
    Hi @tylo! Sorry for being late getting back to you. We identified the issue and have a fix in the pipeline now. You should see it in 2017.4.4f1 and in an upcoming patch for 2018.1. In a few hours you should be able to search for the bug in the https://issuetracker.unity3d.com/ (1028596) to confirm its status and which versions you can find the fix in. Thank you for bringing the issue to our attention and let us know if you come across any more issues.
     
    AndyMartin458 likes this.
  14. Daruden

    Daruden

    Joined:
    Oct 12, 2016
    Posts:
    1
    Hi, I'm getting the following error :


    upload_2018-5-22_21-36-10.png


    My .gitconfig is like this:

    [merge]
    tool = unityyamlmerge

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

    Am I doing something wrong? I couldn`t find (or maybe understand) the solution to that reading this thread, so I thought I should ask. Thanks.
     
  15. Carpet_Head

    Carpet_Head

    Joined:
    Nov 27, 2014
    Posts:
    258
    Getting a strange error with this tool, all I get is:

    Deleted merge conflict for 'blablascene.unity':
    {local}: deleted
    {remote}: deleted

    any ideas? it is delete on none of the branches
     
  16. Ryan-Unity

    Ryan-Unity

    Joined:
    Mar 23, 2016
    Posts:
    1,993
    Hey @Carpet_Head! Would you be willing to share copies of your local, base, remote scene files that you're trying to merge that repro this error message with me? I'd like to help figure out what's going on.
     
  17. Carpet_Head

    Carpet_Head

    Joined:
    Nov 27, 2014
    Posts:
    258
    OK so I resolved the issue. I am not 100% sure of the problem, but it seems like the fix was using the latest version of git, rather than the embedded git that was part of sourcetree
     
  18. NTDC-DEV

    NTDC-DEV

    Joined:
    Jul 22, 2010
    Posts:
    593
    Ryan,

    Is it possible to use the latest version of UnityYAMLMerge.exe, let's say 2017.4.4f1, into a Unity 5.x (5.6.6) installation?

    We cannot upgrade our project to 2017 but would like to use the tool with the latest fix. Do you foresee any conflict in doing so or do we have to upgrade?

    Thank you.

    ----

    Edit; We've extracted the latest UnityYAMLMerge.exe available from a higher Unity version and are using it in our 5.6.6 project. So far so good. Would still appreciate a confirmation @ryanc-unity if you can. Thank you.
     
    Last edited: Jan 29, 2019
  19. greay

    greay

    Joined:
    Mar 23, 2011
    Posts:
    88
    I've updated to 2018.3.2f1 and I've still not managed to get unityyamlmerge to actually perform the merge. It still leaves the conflict markers in the supposedly "resolved" file.
     
  20. Firestar9114

    Firestar9114

    Joined:
    Jun 16, 2018
    Posts:
    11
    I am having the same issue
     
  21. jonathan_dana

    jonathan_dana

    Joined:
    Dec 13, 2018
    Posts:
    13
    SmartMerge seems to mess with our scene.

    Environment context
    UnityYAMLMerge.exe is setup as a custom Merge Tool in SourceTree, as recommended per the documentation:
    Code (CSharp):
    1. merge -p $BASE $REMOTE $LOCAL $MERGED
    The fallback application is p4merge (Perforce) and handled perfectly through mergespecfile.txt

    Unity version: 2017.4.24f1 (LTS)
    SourceTree: 3.1.2
    Git: 2.21.0
    Windows 10 (x64)
    P4merge: 2018.4.175.3667

    Reproduction scenario
    - create a scene with nothing but an empty GameObject that is shared on the Git repository (base)
    - a contributor deletes the GameObject, then push on the Git repository (remote)
    - another contributor (before pulling) adds a BoxCollider to the same GameObject then commits (local)

    -> He now needs to pull and resolve the conflict in order to be able to push

    Issues
    First issue is when dealing with the 3-way diff on p4merge, the transform component of the GameObject is ommitted on all versions (base, local, remote). Thus, no matter the conflict resolution, SourceTree is staging a Transform component removal that obviously Unity will complain about.

    Secondly, the BoxCollider component is present on all three versions (base, local remote) whereas it should only be on the local one. As a result, if I pick the base version Unity output an error because the GameObject is not referencing the BoxCollider that is currently attached to it. And if I pick the remote version, Unity error will be about a BoxCollider referencing a non-existing GameObject.

    Unity console errors related to missing transform component:
    Code (CSharp):
    1. - Broken text PPtr in file(Assets/Scenes/New Scene.unity). Local file identifier (583727351) doesn't exist! (personal note: this is the GUID of the transform component)
    2. - Component could not be loaded when loading game object. Cleaning up!
    3. - Transform component could not be found on game object. Adding one!
    4. - GameObject has multiple Transform components! Merged into single one.
    Unity console errors related to unreferenced BoxCollider:
    Code (CSharp):
    1. - CheckConsistency: GameObject does not reference component BoxCollider. Fixing.
    Unity console errors related to unanchored (GameObject destroyed) BoxCollider:
    Code (CSharp):
    1. - Broken text PPtr in file(Assets/Scenes/New Scene.unity). Local file identifier (583727350) doesn't exist!
    2. - BoxCollider component deleted: GameObject pointer is invalid
    Attached to this posts, the three .tmp files handled through p4merge.exe, including versions for all resolution choices (picking any version out of local/remote/base)
     

    Attached Files:

  22. Ryan-Unity

    Ryan-Unity

    Joined:
    Mar 23, 2016
    Posts:
    1,993
    Sorry for the late response. YAMLMerge is designed to be fully backwards compatible, so there should be no issues with taking newer versions of the tool and using them in older versions of Unity.
     
  23. Paul_Bronowski

    Paul_Bronowski

    Joined:
    Sep 3, 2014
    Posts:
    55
    (apologies, if this is redundant/stale information.)

    Unity (2018.3.9f1) seems to be leaving "stripped" sections in YAML, when removing PrefabEvolutions scripts in the prefab editor and saving...


    --- !u!4 &867059778370281911 stripped
    Transform:
    m_CorrespondingSourceObject: {fileID: 402950, guid: 26ee827b17674bd49b20f19726073d0f,
    type: 3}
    m_PrefabInstance: {fileID: 867059778370406321}
    m_PrefabAsset: {fileID: 0}


    Note also that the YamlDocument for the parent Transform still contains a reference to the stripped component...

    --- !u!4 &4623688170425086
    Transform:
    m_ObjectHideFlags: 0
    m_CorrespondingSourceObject: {fileID: 0}
    m_PrefabInstance: {fileID: 0}
    m_PrefabAsset: {fileID: 0}
    m_GameObject: {fileID: 1068550404735368}
    m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
    m_LocalPosition: {x: 0, y: 0, z: 0}
    m_LocalScale: {x: 1, y: 1, z: 1}
    m_Children:
    - {fileID: 867059778370281911}
    - {fileID: 4633740666678510}

    I haven't found a way to remove these via the Editor (re-importing, etc) so I'm manually removing them. A fix would be appreciated.

    - thanks
     
  24. 40detectives

    40detectives

    Joined:
    Apr 9, 2016
    Posts:
    74
    Now that I use Unity Hub for installing different versions of the editor on the same machine, the UnityYAMLMerge tool path changes a lot (each time I change the Unity version), so it's a bit of a chore to remember to check the path and change it in the config file. This could lead to not calling the tool at all if the version in the config file is no longer installed.

    For example for Git in Windows, till unity hub the default path was something like:
    cmd = 'C:\\Program Files\\Unity\\Editor\\Data\\Tools\\UnityYAMLMerge.exe' merge -p --describe --timing "$BASE" "$REMOTE" "$LOCAL" "$MERGED"


    Now for 2019.1.4 it could be something like:

    cmd = 'C:\\Program Files\\Unity\\Hub\\Editor\\2019.1.4f1\\Editor\\Data\\Tools\\UnityYAMLMerge.exe' merge -p --describe --timing "$BASE" "$REMOTE" "$LOCAL" "$MERGED"

    To work correctly I should change it in every config file in each project every time I upgrade. This is true for any kind of upgrade since it changes the path in any of the following ways:
    2019.1.4fX
    2019.1.Y.fX
    2019.Z.YfX
    20W.Z.YfX

    Have you guys thought of a way to automate this or make it easier?
     
    Last edited: Jun 5, 2019
    Fira-Soft likes this.
  25. Grumpy-Dot

    Grumpy-Dot

    Joined:
    Feb 29, 2016
    Posts:
    93
    I have set the Path user variable to contain also
    C:\Program Files\Unity\Hub\Editor\x.x.xf1\Editor\Data\Tools
    , so I only need to update it, and not change the git config.
    Sure it would be nice to have it automatically update whenever I get the latest version, but so would be to have Unity Hub to auto download the latest Unity version.
    So it would be a nice thing to have, but imho not that critical, changing one user variable per week is not hard work.
     
    40detectives likes this.
  26. 40detectives

    40detectives

    Joined:
    Apr 9, 2016
    Posts:
    74
    It's true that it isn't critical. Anyway it sounds like a good idea, if you have multiple projects only one change (your PATH) is needed. Thanks for the tip!
     
    Grumpy-Dot likes this.
  27. robin_v

    robin_v

    Joined:
    May 1, 2019
    Posts:
    2
    Hello!

    I just tried out Smart Merge for the first time today, and it works great!

    My question is: is it possible to use environment variables within, or pass other data to "mergespecfile.txt"?

    In my setup, a script sets up a few variables in the developers' system. Ex. we call
    SETX %GAME_ROOT%=%~dp0
    to set the root directory for tools scripts, etc.

    In order to minimize setup time and external dependencies, I like to ship my merge tool within my repo. Right now, I'm using DiffMerge and have it committed under
    %GAME_ROOT%\tools\DiffMerge\


    So, in my fallback, I'd like to do something like:

    unity use "%GAME_ROOT%tools\DiffMerge\sgdm.exe" ....
    prefab use "%GAME_ROOT%tools\DiffMerge\sgdm.exe" ....

    # Local DiffMerge
    * use "%GAME_ROOT%tools\DiffMerge\sgdm.exe" ....


    Is this possible?
     
  28. ramen_kilogold

    ramen_kilogold

    Joined:
    Jun 19, 2020
    Posts:
    5
  29. ramen_kilogold

    ramen_kilogold

    Joined:
    Jun 19, 2020
    Posts:
    5
  30. Mathius123

    Mathius123

    Joined:
    May 21, 2018
    Posts:
    14
    Please don't let this thread die.
     
  31. Mathius123

    Mathius123

    Joined:
    May 21, 2018
    Posts:
    14
    It seems the folks at Unity have stopped monitoring this: @ryanc-unity, @jdrewsen, @khris1rino - can we get an update please?

    Using Unity 2019.3.12f1 - Are the instructions in the mergespecfile.txt 100% accurate? I have attached the copy I use and it says the following at the top:

    # %l is replaced with the path of you local version
    # %r is replaced with the path of the incoming remote version
    # %b is replaced with the common base version
    # %d is replaced with a path where the result should be written to

    The problem I am running into is that when using Meld v3.20.2 to perform a 3way merge as my fallback merge tool, here is the command I have:

    unity use "%programs%\Meld\meld.exe" "%l" "%b" "%r" -o "%d" --auto-merge
    prefab use "%programs%\Meld\meld.exe" "%l" "%b" "%r" -o "%d" --auto-merge
    * use "%programs%\Meld\meld.exe" "%l" "%b" "%r" -o "%d" --auto-merge

    The results for %l and %r are being swapped. The left window (%l) shows the REMOTE contents, the middle window (%b) shows the BASE contents, and the right window (%r) shows the LOCAL contents. Are we sure that %l doesn't correspond to LEFT (theirs) and %r doesn't correspond to RIGHT (mine) as it does for the -l and -r parameters when using UnityYAMLMerge? I have attached a screenshot of the console using UnityYAMLMerge and here is a copy/paste of the instructions from UnityYAMLMerge using the command line:

    Unity YAML Merge Tool for scene or prefab files - version 1.0.1
    usage: UnityYAMLMerge merge [-l|-r|-p|-h] [-i file] [-o file]
    [--rules rulesfile]
    [--fallback fallbackspecfile]
    [--force] [--describe]
    <base> <left> <right> [dest]
    [premerge base dest] [premerge right dest]
    -l Resolve merge conflicts using left (theirs)
    -r Resolve merge conflicts using right (mine)
    -i file Resolve merge conflicts using merge file
    -o file File to write merge conflicts into
    -p Use premerging
    -h Use 'headless' mode (no error dialogs)
    --rules A files with merge rules
    --typeInfo A file with type information on objects in asset files
    --fallback Spec file defining fallback tools on conflicts if not using
    builtin. Can be set to 'none' to disable fallback.
    --force Force merging even on unknown file extensions
    --describe Include description of what has been done in the -o file.

    This is further evidenced by the fact that when I do not use a "merge -p" command and just use "merge" when running UnityYAMLMerge on a commit with a Scene named "Town", it opens the temporary "Town_LOCAL" Scene file (that UnityYAMLMerge creates in my Unity project along with the Town_BACKUP, Town_REMOTE, and Town_BASE files), on the right window in Meld which is supposed to be the %r parameter for the REMOTE file (theirs).

    Also, if you watch this video here, I am using the same setup that he is and you will note he has "%r" "%b" "%l" in that order for Meld and only then is he able to get LOCAL to show upon the left despite "%r" being labeled as REMOTE:
     

    Attached Files:

    Last edited: Sep 30, 2020
  32. Mathius123

    Mathius123

    Joined:
    May 21, 2018
    Posts:
    14
    @ryanc-unity, @jdrewsen, @khris1rino - can I please get an update from you all on this or can you please direct this to the person now responsible for maintaining UnityYAMLMerge?
     
  33. studentutu

    studentutu

    Joined:
    Oct 22, 2017
    Posts:
    121
    DId someone received YamlMerge.exe Bad allocation errror? It happened in our main prefab (large prefab, and there seems to be 50+ commits on it in the last few days) and now we can't proceed wihout it(
     
  34. Prince_of_Persia

    Prince_of_Persia

    Joined:
    Oct 20, 2012
    Posts:
    56
    I am using git and use UnityYAMLMerge for resolving merge conflicts (as mergetool).
    I receive following error when UnityYAMLMerge tries to merge conflicts:
    "Cannot find transform parent for fileID"


    Unity Version: 2019.2.19f1

    Do you have any idea how can I solve this issue?
     
  35. biomee

    biomee

    Joined:
    Aug 4, 2017
    Posts:
    5
    Sadly when I go to use git mergetool it uses unityyamlmerge but then doesn't actually change anything, always spits out that the scene file seems unchanged and nothing happens after "resolving conflicts" except that the scene is unchanged and asking if it worked. Any help with this?
     
  36. mikii123

    mikii123

    Joined:
    Jun 8, 2015
    Posts:
    5
    Hello.
    The merge tool just says "bad allocation" and exits.
    What does that mean?
     
    webik150 likes this.
  37. robal1991

    robal1991

    Joined:
    Mar 31, 2016
    Posts:
    33
    Hi guys. I'm using Unity 2019.4.38 and Perforce. Today when merging my biggest scene (about 5.5MB) I'm getting this error with the smart merge: "vector<bool> too long". See the attached screenshot.

    Any way to fix that?
     

    Attached Files:

  38. Roni92pl

    Roni92pl

    Joined:
    Jun 2, 2015
    Posts:
    396
    Seems like YAMLmerge doesn't work when there are whitespaces in file paths.
    Huge issue
     
  39. peteclowes

    peteclowes

    Joined:
    Apr 10, 2017
    Posts:
    1
    No idea, there does not seem to be any info online about it, I tryed just about everything I could and on a whim I changed the YAMLmerge to one from a old unity editor I had (5.6.3p1) and it worked fine.

    Not sure if that will help anyone but it saved me from manualy dealing with over 100 conflicts