Search Unity

Smart Merge not working

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

  1. tylo

    tylo

    Joined:
    Dec 7, 2009
    Posts:
    130
    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. ryanc-unity

    ryanc-unity

    Unity Technologies

    Joined:
    Mar 23, 2016
    Posts:
    1,220
    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. ryanc-unity

    ryanc-unity

    Unity Technologies

    Joined:
    Mar 23, 2016
    Posts:
    1,220
    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. ryanc-unity

    ryanc-unity

    Unity Technologies

    Joined:
    Mar 23, 2016
    Posts:
    1,220
    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:
    53
  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. ryanc-unity

    ryanc-unity

    Unity Technologies

    Joined:
    Mar 23, 2016
    Posts:
    1,220
    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:
    68
    same here. did you ever find a solution?
     
  10. greay

    greay

    Joined:
    Mar 23, 2011
    Posts:
    68
    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:
    6
    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
    tylo, Grumpy-Dot and greay like this.
  12. tylo

    tylo

    Joined:
    Dec 7, 2009
    Posts:
    130
    Any updates on the issue my scene files were having?
     
  13. ryanc-unity

    ryanc-unity

    Unity Technologies

    Joined:
    Mar 23, 2016
    Posts:
    1,220
    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. Felipe_Drude

    Felipe_Drude

    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:
    106
    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. ryanc-unity

    ryanc-unity

    Unity Technologies

    Joined:
    Mar 23, 2016
    Posts:
    1,220
    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:
    106
    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. NLSC-E-MS

    NLSC-E-MS

    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:
    68
    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:
    10
    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. ryanc-unity

    ryanc-unity

    Unity Technologies

    Joined:
    Mar 23, 2016
    Posts:
    1,220
    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:
    53
    (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
  25. Grumpy-Dot

    Grumpy-Dot

    Joined:
    Feb 29, 2016
    Posts:
    43
    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?