Search Unity

Smart Merge not working

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

  1. meyer272

    meyer272

    Joined:
    Apr 13, 2015
    Posts:
    1
    I have tried to use the Smart Merge tool to merge changes to my scene file. When I run git mergetool, it crashes. "YAM Merge Tool has stopped working". I have tested this in Windows 7 Command Prompt, Windows Git Bash, and Mac OS X 10.10.3. Both using Unity 5.1.1f1.

    On Windows:

    Unhandled exception at 0x000000013FBCB999 in UnityYAMLMerge.exe: 0xC0000005: Access violation reading location 0x0000000000000038.

    On OS X:
    git-mergetool--lib: line 130: 91388 Segmentation fault: 11 'Applications/Unity/Unity.app/Contents/Tools/UnityYAMLMerge' merge -p $BASE $REMOTE $LOCAL $MERGED
     
  2. jdrewsen

    jdrewsen

    Unity Technologies

    Joined:
    Mar 28, 2011
    Posts:
    153
    Unity 5.1.1 Patch 3 released today should fix this issue. Please try this release or the next non-patch release 5.1.2.

    Thanks
     
  3. aaaaaaaaaaaaaaaasdf

    aaaaaaaaaaaaaaaasdf

    Joined:
    Oct 16, 2013
    Posts:
    1
    OS X 10.10.3 and Unity 5.1.1p3 not working yet.

    git-mergetool--lib: line 132: 65378 Segmentation fault: 11 /Applications/Unity/Unity.app/Contents/Tools/UnityYAMLMerge merge -p "$BASE" "$REMOTE" "$LOCAL" "$MERGED"
     
  4. jdrewsen

    jdrewsen

    Unity Technologies

    Joined:
    Mar 28, 2011
    Posts:
    153
    Please file a bug and attach the base, remote and local files. I cannot reproduce the issue by just looking at the cmdline output you posted. Thanks.
     
  5. jdrewsen

    jdrewsen

    Unity Technologies

    Joined:
    Mar 28, 2011
    Posts:
    153
    Please file a bug and attach the base, remove and local files. I cannot reproduce the issue by just looking at the cmdline output you posted. Thanks.
     
  6. jdrewsen

    jdrewsen

    Unity Technologies

    Joined:
    Mar 28, 2011
    Posts:
    153
    Thanks... I can reproduce the error. Working on a fix..
     
  7. jdrewsen

    jdrewsen

    Unity Technologies

    Joined:
    Mar 28, 2011
    Posts:
    153
    The "Couldn't locate merge tool to handle extension xxxxx in c:\Program Files\Unity\Editor\Data\Tools\mergespecfile.txt" with xxxx being anything but unity/prefab is a known issue caused by the version control system used (in your case git).

    From the image you have attached I can see that the extension that Git gives the files it wants merged is not .unity or .prefab . Therefore you need a wildcard entry in your mergespecfile.txt like:

    * use "%programs%\WinMerge2011\WinMergeU.exe" "%l" "%r" "%b" "%d"
     
  8. jdrewsen

    jdrewsen

    Unity Technologies

    Joined:
    Mar 28, 2011
    Posts:
    153
    Fixed and will be in an upcoming maintenance release. Will tell which when I know.
     
  9. jdrewsen

    jdrewsen

    Unity Technologies

    Joined:
    Mar 28, 2011
    Posts:
    153
  10. jdrewsen

    jdrewsen

    Unity Technologies

    Joined:
    Mar 28, 2011
    Posts:
    153
    Thanks for the repro case. I have made a fix now that will be in an upcoming maintenance release.
     
  11. lpk323

    lpk323

    Joined:
    Jun 2, 2015
    Posts:
    4
  12. jdrewsen

    jdrewsen

    Unity Technologies

    Joined:
    Mar 28, 2011
    Posts:
    153
    Let me check up on that when I get back from vacation in 2 weeks.
     
  13. jdrewsen

    jdrewsen

    Unity Technologies

    Joined:
    Mar 28, 2011
    Posts:
    153
    Changes will be in the upcoming 5.1.2p3 release
     
  14. tylercook

    tylercook

    Joined:
    Apr 15, 2014
    Posts:
    31
    You know, it would be really great if this tool was a part of Unity's open bitbucket repos. I am not able to update Unity for every project I would like to use this in, especially this frequently. We don't often have time to keep up with all of the new Unity changes while a project is being developed.

    Is this tool so closely tied to Unity that it is impossible for it to be distributed on its own apart from the patch releases?
     
  15. jdrewsen

    jdrewsen

    Unity Technologies

    Joined:
    Mar 28, 2011
    Posts:
    153
    It is not closely coupled and it would make sense to be able to make releases out of sync with unity itself. It won't happen just yet though.
     
  16. tylercook

    tylercook

    Joined:
    Apr 15, 2014
    Posts:
    31
    Hello jdrewsen,

    I haven't tried your tool in awhile due to not upgrading Unity, but I just did recently. I wanted you to know that tool does not seem to work with Mercurial when it comes to integrating it using the hgrc file.

    An error occurs involving the file extension. Mercurial stores its internal files with what appears to be a random hash at the end of the name. For example, if i am trying to merge `scene.unity`, then it will really appear as `scene.unity~other.kxkdf0`

    This causes the following error to appear:

    "Couldn't locate merge tool to handle extension kxkdf0 in C:\Program Files\Unity\Editor\Data\Tools\mergespecificfile.txt"

    EDIT: I just realized adding --force to the hgrc file like so fixes it for Mercurial. You may want to have the documentation changed for this.

    unityyamlmerge.args = merge -p --force $base $other $local $output

    However, I think there is still a piece of the puzzle I am missing. I get the following output for my specific scene, but I don't have the scene marked as resolved or anything like that.

    Code (csharp):
    1. merging Assets/Scenes/canvasTest.unity
    2. Conflicts:
    3. Left  505390102.RectTransform.m_AnchoredPosition.x change to 7.24310017
    4. Right 505390102.RectTransform.m_AnchoredPosition.x change to 0
    5. Left  505390102.RectTransform.m_AnchoredPosition.y change to -7
    6. Right 505390102.RectTransform.m_AnchoredPosition.y change to 0
    7. Left  505390102.RectTransform.m_SizeDelta.x change to 10.9860001
    8. Right 505390102.RectTransform.m_SizeDelta.x change to 175
    9. Left  505390102.RectTransform.m_SizeDelta.y change to 14.6999998
    10. Right 505390102.RectTransform.m_SizeDelta.y change to 200
    11. Conflict handling:
    I am unsure if this tool is changing my scene, or outputting it somewhere, or if it is just throwing the changes away (if it is making any).

    EDIT2: I just realized that when UnityYAMLMerge.exe fails to solve all merge conflicts, it falls back on a 3-way mergetool. I was using WinMerge, which is only two-way. I ended up downloading one of the tools found in mergespecificfile.txt. Because it was free, it ended up being Perforce merge. Just be careful about not installing the other things that come along for the ride if you don't want them.
     
    Last edited: Aug 25, 2015
  17. jdrewsen

    jdrewsen

    Unity Technologies

    Joined:
    Mar 28, 2011
    Posts:
    153
    Thanks!... I will update the docs.

    Yes it will fallback to another mergetool to solve all remaining conflicts that it could not handle itself.
     
  18. Bas-Smit

    Bas-Smit

    Joined:
    Dec 23, 2012
    Posts:
    113
    I am trying to get the merge tool to work and got as far as git firing it up but it doesnt seem to do anything. Is there a log somewhere so I can try to figure out what is going on? If I launch the yamlmerge tool manually it resolves the conflict, which is just adding a cube and a sphere from two different git clones.

    My .gitconfig: (had to replace the single quotes with escaped double quotes to get it to run)

    [merge]
    tool = unityyamlmerge

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

    My console output:

    C:\yamltest\clone2>git mergetool
    Merging:
    Assets/scene.unity

    Normal merge conflict for 'Assets/scene.unity':
    {local}: modified file
    {remote}: modified file
    Hit return to start merge resolution tool (unityyamlmerge):
    Conflicts:
    Conflict handling:
    Assets/scene.unity seems unchanged.
    Was the merge successful? [y/n] n
    merge of Assets/scene.unity failed


    I also tried the tortoisegit route which resolves the conflict but leaves the BASE LOCAL and REMOTE files behind, is this a known issue?

    EDIT: I believe this is expected behaviour for tortoisegit as the files go away after resolving the conflict, which you should do after editing the conflict which runs yaml merge.

    Thanks, Bas
     
    Last edited: Aug 25, 2015
  19. jdrewsen

    jdrewsen

    Unity Technologies

    Joined:
    Mar 28, 2011
    Posts:
    153
    You might want to change the forward slashes in the path to back slashes and see if that helps.
     
  20. Bas-Smit

    Bas-Smit

    Joined:
    Dec 23, 2012
    Posts:
    113
    It does not, I get:

    fatal: bad config file line 10 in C:\Users\Bassie/.gitconfig

    The merger runs which you can see from the console output:

    Conflicts:
    Conflict handling:
     
  21. jdrewsen

    jdrewsen

    Unity Technologies

    Joined:
    Mar 28, 2011
    Posts:
    153
    One user is having success with:

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

    Can you try this out?
     
  22. Bas-Smit

    Bas-Smit

    Joined:
    Dec 23, 2012
    Posts:
    113
    Same result (upgraded to git 2.5 now):

    C:\yamltest\clone2>git mergetool
    Merging:
    Assets/scene.unity

    Normal merge conflict for 'Assets/scene.unity':
    {local}: modified file
    {remote}: modified file
    Conflicts:
    Conflict handling:
    Assets/scene.unity seems unchanged.
    Was the merge successful? [y/n] n
    merge of Assets/scene.unity failed
    Continue merging other unresolved paths (y/n) ? n

    Is there a log somewhere?

    Thanks, Bas
     
  23. jdrewsen

    jdrewsen

    Unity Technologies

    Joined:
    Mar 28, 2011
    Posts:
    153
    You can try to add --describe --timing after the -p flag to get some more info.
     
  24. Bas-Smit

    Bas-Smit

    Joined:
    Dec 23, 2012
    Posts:
    113
    I have no idea what happened but it works now, thanks for your help :)
     
  25. jdrewsen

    jdrewsen

    Unity Technologies

    Joined:
    Mar 28, 2011
    Posts:
    153
    No problem.
     
  26. khan-amil

    khan-amil

    Joined:
    Mar 29, 2012
    Posts:
    137
    This is really not clear in the documentation, so you might want to add a bit about that in the manual page.

    Could it be possible to have the mergerespecfile.txt have a fallback to kdiff3, as it's the merge tool that comes pre-packaged with TortoiseHg ?
    I don't know if it's the standard mercurial client on windows, so maybe it's asking for something too specific.
     
  27. jdrewsen

    jdrewsen

    Unity Technologies

    Joined:
    Mar 28, 2011
    Posts:
    153
    Thanks for the feedback. I will make sure we clarify this in the docs.

    I will add kdiff3 as as possible default fallback as well.
     
  28. Virayr

    Virayr

    Joined:
    Sep 9, 2013
    Posts:
    1
    I am using UnityYAMLMerge with Source tree, the fallback option is Apple File Merge (opendiff), but every time I resolve the conflict in merge tool and save the merge I get an empty scene file. However everything worked fine with p4merge. Am I doing something wrong with opendiff?

    Unity version 5.2.0f3
     
  29. jdrewsen

    jdrewsen

    Unity Technologies

    Joined:
    Mar 28, 2011
    Posts:
    153
    I will try to reproduce... might take a couple of weeks before I'll get to it though.
     
  30. matiasjpedro

    matiasjpedro

    Joined:
    Sep 3, 2015
    Posts:
    1
    I was testing this out:

    https://www.reddit.com/r/Unity3D/comments/39bdq5/how_to_solve_scene_conflicts_with_unitys_smart/

    And when I try to merge prefab I recieve a conflict to merge that one, then the difftool (in this case is the vsdiffmerge) opens... I press Ctrl+S to save the result between those files, then I sync the changes to the repo and when I go back to unity these errors appears:

    Broken YAML file(Assets/Resources/Game/Prefabs/Loading.prefab). Local file identifier (11485558) doesn't exist!

    Component MonoBehaviour could not be loaded when loading game object. Cleaning up!

    Here is my setup.

    http://imgur.com/KOhQ04O
    http://imgur.com/aQnuD9X
    http://imgur.com/c1qbIiK

    I'm doing it something wrong?
     
  31. jdrewsen

    jdrewsen

    Unity Technologies

    Joined:
    Mar 28, 2011
    Posts:
    153
    @matiasjpedro
    Seems like you are doing correctly. Would it be possible for you to send me the base, incoming and local files that is being merged and I will figure out what is happening?
     
  32. SidarVasco

    SidarVasco

    Joined:
    Feb 9, 2015
    Posts:
    163
    Hey,

    Using SourceTree i've setup my external tool using quotes (path to program files has a space so it needs to be quoted ). When I try to resolve my issue by merging Sourcetree shows a notification window that get's removed almost instantly ( it's the popup that allows you to abort if needed ). But nothing really happens. When I try to mark it as solved the scene is empty, Unity complains about merge conflicts and need to be solved.

    Any idea what im doing wrong?

    Edit :

    Unity 5.2 *
     
    Last edited: Oct 5, 2015
  33. jdrewsen

    jdrewsen

    Unity Technologies

    Joined:
    Mar 28, 2011
    Posts:
    153
    @SidarVasco Did you setup serialization mode to text in Unity?
     
  34. SidarVasco

    SidarVasco

    Joined:
    Feb 9, 2015
    Posts:
    163
    Yes I have set it to Force Text.

    Command:
    "C:\Program Files\Unity\Editor\Data\Tools\UnityYAMLMerge.exe"

    Argument:
    merge -p $BASE $REMOTE $LOCAL $MERGED

    Just like the manual said.
     
    Last edited: Oct 6, 2015
  35. jdrewsen

    jdrewsen

    Unity Technologies

    Joined:
    Mar 28, 2011
    Posts:
    153
    ok two things:

    Could you try to quote the arguments as well? ie.

    merge -p "$BASE" "$REMOTE" "$LOCAL" "$MERGED"

    If that doesn't help then would it be possible for you to send me the three versions being merged ie. base,remote and local files? Then I can try to repro locally.
     
    Last edited: Oct 6, 2015
  36. SidarVasco

    SidarVasco

    Joined:
    Feb 9, 2015
    Posts:
    163
    Last edited: Oct 6, 2015
  37. jdrewsen

    jdrewsen

    Unity Technologies

    Joined:
    Mar 28, 2011
    Posts:
    153
    Thanks... the base is shared parent that your local and remote version have. So looking in sourcetree:
    The "Uncommitted changes" is you local version. The "origin/8.x-1.x" commit could be your remote version. Then just follow the branch line of both down to where they meet. In this case it is the "7.x-1.0" commit.

    When you have identified the commit you can go to the command line and get that version. If you need help with that please tell me what version control system you are using.
     
  38. SidarVasco

    SidarVasco

    Joined:
    Feb 9, 2015
    Posts:
    163
    I just copied my repo and just reset my branch to that commit.
    The previous link is still valid, I've added the base file.

    Edit:
    I've updated git manually as the one from sourcetree is old. Now it looks like it's doing something but also looks like it's stuck. Ill look into it.
     
  39. jdrewsen

    jdrewsen

    Unity Technologies

    Joined:
    Mar 28, 2011
    Posts:
    153
    Ok just checked on the cmd line and it runs just fine. It has some unresolvable conflicts though so it will try to launch a 3rd party merge tool. Do you have that installed? And is it one listed in C:\Program Files\Unity\Editor\Data\Tools\mergespecfile.txt?
     
  40. SidarVasco

    SidarVasco

    Joined:
    Feb 9, 2015
    Posts:
    163
    I have P4merge installed so it should work fine, right?
     
  41. jdrewsen

    jdrewsen

    Unity Technologies

    Joined:
    Mar 28, 2011
    Posts:
    153
    Yes that should work out of the box. I just tried to setup a git repo with constructed history with the files you have provided me and the merge works just fine. You mention that it is stuck.. please give it a couple of minutes since your scene is not small (big performance improvements is the pipeline :) ).

    Are there weird characters in the path to the scenes being merged? Are there any spaces? Not that is should matter but seems like the only difference we have by now.
     
  42. SidarVasco

    SidarVasco

    Joined:
    Feb 9, 2015
    Posts:
    163
    I gave it a couple of minutes and nothing happened.
    I could retry and wait longer.

    My full path is : C:\Users\SidarTaleiVascoGames\Documents\Development\Unity\D3.4_TALS

    Perhaps the . and _ are messing it up?
    I do know that p4merge has worked before when moving some projects to git and testing out the workflow.
     
  43. jdrewsen

    jdrewsen

    Unity Technologies

    Joined:
    Mar 28, 2011
    Posts:
    153
    Could you take a look at the sourcetree log and see if there is some warning or errors:

    C:\Users\SidarTaleiVascoGames\AppData\Local\Atlassian\SourceTree\sourcetree.log
     
  44. SidarVasco

    SidarVasco

    Joined:
    Feb 9, 2015
    Posts:
    163
    It's running for 15+ minutes now and still no results.

    the log file has a bunch of lines non mentioning anything remotely close to the tools being used here. At the end all I read is "
    Sub items Errors: 2
    "

    Shouldn't the command line tool be running in the Task manager? I don't see it either.

    Edit:

    Set the Merge tool to P4merge, it's not even showing. I think my Sourcetree is broken ( im on windows ). The bugs are getting worse.

    edit:

    How do I make sure the tool is running?


    Edit 3:

    No merge tool is initiated. This is really working on my nerves now. I have no clue where to look.
     
    Last edited: Oct 6, 2015
  45. SidarVasco

    SidarVasco

    Joined:
    Feb 9, 2015
    Posts:
    163
    I might have set the fallback wrongly. At home currently, tomorrow ill look into it once im at work.

    Although the fact p4merge isn't launching on its own is a bit weird.
     
  46. SidarVasco

    SidarVasco

    Joined:
    Feb 9, 2015
    Posts:
    163
    Well, still no success. Sourcetree refuses to run anything with " Launch external merge tool". I even tried to mess up the fallback file which should give me an error, but not even that is showing up.
    No merge tool will launch either. Looks like Im going to waste more valuable time.

    Edit:

    I used resolve using mine and then tried a test case from my coworkers computer. His setup seems to work fine. My setup might be broken (certainly).
     
    Last edited: Oct 7, 2015
  47. jdrewsen

    jdrewsen

    Unity Technologies

    Joined:
    Mar 28, 2011
    Posts:
    153
    Sorry to hear that. I guess your best bet is to contact the sourcetree devs and let them figure out why your sourcetree is fighting back.
     
  48. SidarVasco

    SidarVasco

    Joined:
    Feb 9, 2015
    Posts:
    163
    Well up to this point I still havn't managed to get it working on my pc. I even uninstalled Sourcetree completely and still no luck.

    Could you elaborate on what would happen if there are no further conflicts beyond the Yalm merge?
    If I hit " external diff", P4Merge runs fine. But it's like the fallback is never called.
     
  49. jdrewsen

    jdrewsen

    Unity Technologies

    Joined:
    Mar 28, 2011
    Posts:
    153
    I guess with no sourcetree installed anymore you execute the unityyamlmerge.exe from the command line right?

    In that case it should automatically open p4merge for you in case of conflicts it cannot handle itself. In case all conflicts can be handled the mergetool will output the merged result to stdout or to the file set as the fourth argument. Try to run uniytyamlmerge.exe with not arguments and it will print usage information.
     
  50. SidarVasco

    SidarVasco

    Joined:
    Feb 9, 2015
    Posts:
    163
    Sorry I meant I uninstalled completely and reinstalled.

    I rather not work from command line every time there is a conflict. I'd have to get the base file manually each time. Unless I'm doing something wrong.

    YalmMerge and Sourcetree work fine for my coworkers. But alas I can't merge their files with mine. I'm just left frustrated, it's taking a huge chunk of my work time.

    I really can't figure out what tool is causing this. Sourcetree isn't dumping a log file either.

    Edit:

    In task manager I see many git.exe, I can't kill them either. Any idea what's up with this though?
    Also could you send me your fallback file?
     
    Last edited: Oct 15, 2015