Search Unity

[Solved] Diff

Discussion in 'Unity Collaborate' started by RepoGames, Nov 27, 2016.

  1. RepoGames

    RepoGames

    Joined:
    Apr 15, 2016
    Posts:
    68
    Hmm how do I see the difference between commits? I cant see only the file changes but cant see the diff in file itself.
     
  2. ryanc-unity

    ryanc-unity

    Unity Technologies

    Joined:
    Mar 23, 2016
    Posts:
    1,474
    In the Collab Toolbar, you can get a high overview of all the changes that have been made. If you hover over a single change you should see an eye icon appear.
    Screen Shot 2016-11-28 at 10.13.26 AM.png

    If you have a Revision Control Diff/Merge tool specified in your Preferences (Apple File Merge is default on Macs, for Windows you'll need to install one, like P4 Merge, etc.) then clicking that icon will open up your diff tool so that you can compare your local changes with your last commit. I hope that answers your question.
     
    SirCodeX likes this.
  3. RepoGames

    RepoGames

    Joined:
    Apr 15, 2016
    Posts:
    68
    Well its said no diff tool is installed, but when i try to go edit->project settings->editor and set merge tool its said its not allowed in collaborate mode.

    That beta works really poor right now.
     
    SirCodeX likes this.
  4. ryanc-unity

    ryanc-unity

    Unity Technologies

    Joined:
    Mar 23, 2016
    Posts:
    1,474
    It seems you're looking in the wrong place. The diff tool setting isn't in the Editor Settings, it's in the Preferences menu. Go to Edit->Preferences->External Tools. You'll see the Revision Control Diff/Merge drop down there.
     
    SirCodeX likes this.
  5. noise256

    noise256

    Joined:
    Apr 7, 2013
    Posts:
    22
    Would someone explain how to install a diff/merge tool (P4 or whatever you recommend) for Collaborate? Please explain like I have know idea what I'm doing.
     
  6. jmjd

    jmjd

    Joined:
    Nov 14, 2012
    Posts:
    45
    I can't get the diff tool to work properly either. I have both TortoiseSVN and TortoiseGit installed on my pc, so the "Revision Control Diff/Merge" option had TortoiseMerge automatically selected. It's the only option, and I can't unselected it. I have other diff/merge tools installed on my machine. I prefer to use Code Compare, but as I said it's not available as an option.

    When I do a diff, I get this:
    upload_2017-1-13_23-4-45.png

    and I can't figure out how to get it to work.

    (I'm running Windows 10 and Unity 5.5.0f3)
     
  7. TitanUnity

    TitanUnity

    Joined:
    May 15, 2014
    Posts:
    180
    I could also use a bit of clarity on which files to use when performing a diff. If I look in my project's Library > Collab folder, I see the following folders when a conflict exists:

    - Base
    - Download
    - Merge
    - Original

    Each folder seems to contain a copy of the the file with a merge conflict (in our test case, the conflicted file is scene file). Can anyone offer some clarity on each of these folders? I also was using TortoiseMerge initially and I wasn't sure which files to use for each field "Base File", "Their File", and "My File".
     
  8. ryanc-unity

    ryanc-unity

    Unity Technologies

    Joined:
    Mar 23, 2016
    Posts:
    1,474
    Unfortunately TortoiseMerge is not officially supported by Collab yet (in that it doesn't automatically assign the conflicting files into the base, their, and my categories and that it won't automatically resolve the conflict in the Collab Toolbar after saving your changes). You can still use TortoiseMerge to view the differences and make changes by selecting Base for Base File, Download for Their File, and Original for My File.

    It's recommended that you use another free diff tool, like SourceGear DiffMerge or WinMerge. We'll update you once TortoiseMerge is supported.
     
  9. jmjd

    jmjd

    Joined:
    Nov 14, 2012
    Posts:
    45
    Thanks @ryanc-unity! When you guys work on integrating more diff/merge tools, please consider Code Compare! It's an awesome free tool that even has Visual Studio integration.
     
  10. ryanc-unity

    ryanc-unity

    Unity Technologies

    Joined:
    Mar 23, 2016
    Posts:
    1,474
    No problem, @jmjd. Thank you for mentioning Code Compare. We'll be sure to look into incorporating that as well. :) If you come up with any more useful diff tools, don't hesitate to comment them here.
     
  11. unidad3d

    unidad3d

    Joined:
    Jan 10, 2016
    Posts:
    30

    I only see this eye icon when I make the changes but not when some other team mates makes the chages. Is there a way to achieve this?

    Also I have another problem, probably because I'm a noob here. When clicking on the eye icon the SourceGear DiffMerge all code appear in one line, making really difficult to see anything there. Is there a way to see it with all lines like in visual studio?
     
  12. ryanc-unity

    ryanc-unity

    Unity Technologies

    Joined:
    Mar 23, 2016
    Posts:
    1,474
    The eye icon will appear after pulling another team members' changes if any of their changes conflict with yours. That way you can choose whose changes you'd like to take or mix-and-match your changes using an external diff tool.

    As for the formatting issue in DiffMerge, I'm not really sure what's going wrong there. Try giving SourceGear's forums a try. Hopefully they'll have the answer for that.
     
  13. unidad3d

    unidad3d

    Joined:
    Jan 10, 2016
    Posts:
    30
    Thanks for the answer, I will try that forums.

    As for the icon only appearing when there is a conflict. Will this be changed on the future? I mean it's nice to have such feature when there is a conflict, but I think it would be even more nice for my other team members if they can easily see what I have change on any script and don't need to make any conflict for that.
     
  14. ryanc-unity

    ryanc-unity

    Unity Technologies

    Joined:
    Mar 23, 2016
    Posts:
    1,474
    Happy to help.

    Currently there is no plan to make that available for non-conflicting merges but we are always looking for ways to improve the service. While we do have the Collab History window to show just which files have been modified in a commit, it can still be hard to see what exactly was modified in each script/asset. I'll be sure to pass this feature request along. Thank you for the suggestion!
     
    evans_unity187 likes this.
  15. jmjd

    jmjd

    Joined:
    Nov 14, 2012
    Posts:
    45
    I just want to second that feature request. Being able to diff different versions of a file is really more of a requirement for any source control system that I would use.

    But now that I'm thinking about it... instead of you guys having to re-implement all the features of a git client that only the more experienced people would use, maybe you guys could allow us to connect to the repository using our git client of choice. That way inexperienced users or people who don't need/use advanced features can just use the collaboration tab in the editor. And people who need more advanced features can use their own client.

    Also, thanks for taking the time to listen to us!
     
  16. Cliwo

    Cliwo

    Joined:
    Oct 12, 2016
    Posts:
    11
    Me too! and Please recommend me one. And Can I use Perforce for diff/merge tool?
     
  17. ryanc-unity

    ryanc-unity

    Unity Technologies

    Joined:
    Mar 23, 2016
    Posts:
    1,474
    @noise256 Installing a diff tool is a simple process. Just find one that you like (I often use SourceGear DiffMerge or WinMerge), find them online and follow their installation instructions. Once they're installed, open Unity, go to Preferences->External Tools, and select your preferred Revision Control Diff/Merge in the drop down list. Then, anytime there's a merge conflict, choose the external tool option instead of choosing theirs or mine in the Collab Toolbar to merge your changes.

    And @Cliwo yes you can use Perforce's diff/merge tool with Collab. Just select P4Merge in Preferences->External Tools->Revision Control Diff/Merge.
     
  18. columh

    columh

    Joined:
    May 29, 2013
    Posts:
    2
    Hi

    I have successfully installed SourceGear DiffMerge and can see the two conflicting versions of a script on the left and right side panels and a version which is empty on that line in the central panel.

    Can I use SourceGear DiffMerge to edit the middle panel to combine the left and right panel text int a unified text and then upload that to Unity Collaborate? What would be the steps for that please?

    Best regards

    Colum Higgins
    diff merge.JPG
     
  19. ryanc-unity

    ryanc-unity

    Unity Technologies

    Joined:
    Mar 23, 2016
    Posts:
    1,474
    Hi @columh! Yes, you can choose whichever side's changes you'd like first, then you can right-click on the change in the middle pane and select to either prepend or append the other side's changes, which will combine both changes. After doing that, you can Save in DiffMerge then go back to Unity. The conflict will be marked as resolved and you can then proceed to edit it further after that. I hope that answers your question. Let us know if run into any issues. :)
     
  20. CaristinaOfficial

    CaristinaOfficial

    Joined:
    Mar 17, 2017
    Posts:
    1
    Awesome, Wording there should be some new feature. Very excited to start my new game. Hack siber looking one more game. Yooo!!!!
     
  21. danl1240

    danl1240

    Joined:
    Oct 3, 2016
    Posts:
    3
    Is there support for Beyond Compare? How would I set that up?

    Also, how do I enter a path in to the External Script Editor? When I browse for emacs, which is a symlink to the executable, the file is grayed out.

    Thanks!
     
  22. ryanc-unity

    ryanc-unity

    Unity Technologies

    Joined:
    Mar 23, 2016
    Posts:
    1,474
    Yes, we do support Beyond Compare 4. To set it up, install Beyond Compare 4 from their site. Then open the Unity Editor and select it from the drop down list of Revision Control Diff/Merge tools in Preferences->External Tools. That's it! It'll be available to use any time you select "Launch external diff" to resolve a merge conflict or "See differences" when viewing changes.
     
  23. danl1240

    danl1240

    Joined:
    Oct 3, 2016
    Posts:
    3
    So I had Beyond Compare 4 installed, but it was not showing up in that drop down list.

    It turns out there's one more step that is necessary: run Beyond Compare and select the app menu "Beyond Compare" -> "Install Command Line Tools...", hit "Ok", then open Unity and select the external tool.

    Thanks,
    Dan
     
    ryanc-unity likes this.
  24. almaione-sdn

    almaione-sdn

    Joined:
    Jun 28, 2017
    Posts:
    13
    Hi,
    I usually use SVN or other toosl for versioning, but now I've passed to collaborate.
    I'd like to use Visual Studio vsDiffMerge tool (I love it!) for diffs but I cannot set it in Preferences.

    Is there any way to a set a custom diff tool in Unity?
    thx a lot in advance.
    Alex
     
    EpicCubeStudio likes this.
  25. ryanc-unity

    ryanc-unity

    Unity Technologies

    Joined:
    Mar 23, 2016
    Posts:
    1,474
    Hi @almaione-sdn! Currently, vsDiffMerge is not supported as a merge tool and there isn't a way to add a custom diff tool. That is a really good idea, though, and I'll bring that up as a feature request. If you're looking for good diff tools to use, I'd recommend SourceGear DiffMerge, Apple File Merge, WinMerge or TkDiff.
     
  26. almaione-sdn

    almaione-sdn

    Joined:
    Jun 28, 2017
    Posts:
    13
    thx @ryanc-unity .
    Now I'm using Win Merge as diff tool, but I've a problem: with collaborate I can see the differences between a modified file and the previous version, but it's not possible to save any change to compared file. If I make any change in the local file and I try to save it, a window asks me to save the file with a new name. Any setting in winmerge or this is the compare Unity policy? Is it possible to change it?

    thx in advance
     
  27. ryanc-unity

    ryanc-unity

    Unity Technologies

    Joined:
    Mar 23, 2016
    Posts:
    1,474
    @almaione-sdn This appears to be a bug with WinMerge when viewing just the differences as opposed to when you're resolving a merge conflict. I tested with SourceGear DiffMerge and it works fine when just viewing the file's differences. Sorry for the confusion.
     
  28. almaione-sdn

    almaione-sdn

    Joined:
    Jun 28, 2017
    Posts:
    13
    @ryanc-unity If I use winmerge to compare two files or folders everything works fine.
    The problem shows up when I see differences from collaborate and I try to make a merge from winmerge
     
  29. mthorade

    mthorade

    Joined:
    Jan 26, 2017
    Posts:
    3
    @ryanc-unity Could you add support for KDiff3 in the future?
    It is open-source, based on Qt and available for Linux, Windows and Mac.
    http://kdiff3.sourceforge.net/
    It is delivered with GitExtensions and used as default there and works well for me, even though there have not been new releases since 2014.
     
  30. ryanc-unity

    ryanc-unity

    Unity Technologies

    Joined:
    Mar 23, 2016
    Posts:
    1,474
    WinMerge should still allow you to save changes to the merged file if you are resolving a merge conflict. Just seeing the differences using WinMerge will not let you easily save your changes made inside of WinMerge. I'll look into it deeper to see if there's an error in how we're opening WinMerge for See Differences. Thanks for letting me know about that.
     
  31. ryanc-unity

    ryanc-unity

    Unity Technologies

    Joined:
    Mar 23, 2016
    Posts:
    1,474
    Hi @mthorade! We'll certainly look into adding support for more diff tools.
     
  32. chopps

    chopps

    Joined:
    Aug 20, 2013
    Posts:
    3
    I am having issues with collab and merges.

    When I merge using apple file merge and save the merged file in the project directory the file is not marked as resolved.
    Where are merged files supposed to be saved in order to be reconized by collab as resolved?
    Is there a manual to how collab works in the back ground with all the cached versions saved in the collab folder?
     
  33. ryanc-unity

    ryanc-unity

    Unity Technologies

    Joined:
    Mar 23, 2016
    Posts:
    1,474
    Hi @chopps!

    When resolving a merge conflict using Apple File Merge, are you Choosing an Action at the bottom right and picking to use both options, the left, or the right? If you're picking only your changes, then they won't appear as being changed/edited in the Project Browser or Collab Toolbar. Otherwise, they should appear as having been edited.

    Merged files are saved exactly where the original files are located. During and after a merge conflict, you can find your original copy of your asset, the version downloaded from the server, and the base version of the file before your own changes in the Original, Download, and Base folders inside of your Library/Collab folder.
     
  34. jeremytm

    jeremytm

    Joined:
    Jun 6, 2016
    Posts:
    29
    Is there somewhere we can see a list of supported diff tools?

    It would help with knowing whether an app showing/not showing is expected or not.

    Personally, I'm looking for Kaleidoscope on Mac OS.
     
  35. almaione-sdn

    almaione-sdn

    Joined:
    Jun 28, 2017
    Posts:
    13
    @ryanc-unity Hi Ryan,
    just a little update. In an early version of Unity Collaborate I was using Win Merge and I was able to save differences on local files. Now, if I try to do so, I get a prompt that asks me to save the file with another name or "discard all". Very frustrating... maybe Unity launches WinMerge with some argument that disables the saving of compared files?
    If it is not possible to fix this issue, could you suggest a diff tool to be used to save local files?
    I really need for it. Thx a lot in advance.
     
  36. ryanc-unity

    ryanc-unity

    Unity Technologies

    Joined:
    Mar 23, 2016
    Posts:
    1,474
    Hi @jeremytm! Here's a list of supported diff tools. We're looking to making it easier to add new diff tools in the future.

    OS X:
    • Apple File Merge
    Windows:
    • WinMerge
    OS X and Windows:
    • Beyond Compare 4
    • SourceGear DiffMerge
    • TkDiff
     
  37. ryanc-unity

    ryanc-unity

    Unity Technologies

    Joined:
    Mar 23, 2016
    Posts:
    1,474
    Hi @almaione-sdn! Which version of WinMerge are you using? I'm using 2.14.0.0 and I'm not seeing the "Save File with New Name" or "Discard All" options when I launch the external diff tool from the Collab Toolbar when using 2017.1.0f3. Which version of Unity are you using?
     
  38. almaione-sdn

    almaione-sdn

    Joined:
    Jun 28, 2017
    Posts:
    13
    Hi @ryanc-unity , thx for reply.
    I'm currently using 2017.1.1f1 Personal and Win Merge version is 2.14.0.0.
    Usage scenario with collaborate:
    - I select a locally modified file from Collaborate list
    - Collaborate->See Differences on the file
    - on the left side of winmerge I see the Collaborate versioned file. On the other side, the local one.
    - I try to modify the local file (by copying some lines or adding some code by hand) and SAVE
    - I get the error in the screenshot. It is in italian.
    It tells: save file failed. C:\e Denied Access. You want:
    . use a different name for the file (OK)
    . cancel current operation (CANCEL)
    - If I click OK, a save file prompt is shown to save the file with a different name on disk.

    For any dubt, I'm here.

    Thx a lot in advance
     

    Attached Files:

  39. ryanc-unity

    ryanc-unity

    Unity Technologies

    Joined:
    Mar 23, 2016
    Posts:
    1,474
    No problem :). It sounds like you might be running into a permissions problem on your Windows machine when you try to save a file. This article here sound similar to the problem that you're running into. And this page here has good steps on how to modify your permissions so that you can modify your files. Let me know if that helps to unblock you.
     
  40. almaione-sdn

    almaione-sdn

    Joined:
    Jun 28, 2017
    Posts:
    13
    Hi @ryanc-unity , thx for your prompt reply!
    I have changed the permissions for my project folder so the current user and administrator have full control over it.
    Moreover, I set "Run as Administrator" for winmerge executable. Now, if I try to seed differences on a file using Collaborate, WinMerge starts and when I try to save changes to local file, save now works... BUT... the file is not overwrittern :-S For a strange reason, the file is alwais saved to C:\e :-o A no-extesion file called "e" is created in C:\. Very very strange. After years, I'm taking in consideration to migrate from Win Merge to another diff tool.
     
  41. almaione-sdn

    almaione-sdn

    Joined:
    Jun 28, 2017
    Posts:
    13
    ...just installed Beyond Compare. It works fine with Collaborate! I'll use it from now on.
    Simplest solution :)
     
    ryanc-unity likes this.
  42. tomzigza

    tomzigza

    Joined:
    Aug 4, 2017
    Posts:
    23
    @ryanc-unity I see you mentioned there is no way to see changes that your co-workers are doing. As a project lead, this seems like a disastrous situation. No way to track whats going into your project. I looked at the roadmap which does contain branching for collaborate, but nothing about this. Do you have any feedback on when such a feature might be available. We really would like to move to this from git but its really hard to do that as is. I know you could download the file from the dashboard but that is quite a slow process.

    Thanks for your time.
     
  43. tomzigza

    tomzigza

    Joined:
    Aug 4, 2017
    Posts:
    23
    @ryanc-unity 2 more things I found while evaluating conflicts between 2 people
    1a) Both people touched a function in some file. These changes are going to be called A (person 1) and B (person 2)
    1b) Person 1 Published the change
    1c) Person 2 saw the publish and did an update creating a conflict
    1d) Person 2 resolved the conflict and put a new comment into the code to show it was resolved
    1e) Person 1 made another change in the same place
    1f) Person 2 (who has not done any publishing at this point) sees this new change and does an update
    1g) Person 2 sees a conflict but instead of the conflict being between his resolution of the first conflict, and the new change, its between the original B change and the new change.

    Its almost as if it only wanted to compare with the original change only and not future changes

    2a) Both people edited a for loop in the same file (this is immediatly after that first test scenario)
    2b) Person 1 changed the for loop to be from i=0 to i=1
    2c) Person 2 changed the for loop to be from i=0 to i=4
    2d) Person 1 published
    2e) Person 2 Updated
    At this point there was no conflict and the value in the file was i=4
    2f) Person 2 published
    2g) Person 1 Updated
    Person's 1 change is just gone and no conflict was ever raised.
     
  44. ryanc-unity

    ryanc-unity

    Unity Technologies

    Joined:
    Mar 23, 2016
    Posts:
    1,474
    Hi @tomzigza! I'm sorry you're running into these issues. Can I get a little more info from you so that I can better help figure out what's going on? Which version of Unity are you using? Do these steps you shared with me repro the bug every time or only sometimes?
     
  45. tomzigza

    tomzigza

    Joined:
    Aug 4, 2017
    Posts:
    23
    Using unity 2017 1.1p4
    Because the last 2 issues were show stoppers for us, we moved back to regular git. I didn't try to reproduce it.
     
  46. ryanc-unity

    ryanc-unity

    Unity Technologies

    Joined:
    Mar 23, 2016
    Posts:
    1,474
    I understand. To your first concern, you're right that our current design doesn't make it easy for you to view specific changes (outside of what files have been modified) before you pull them. We are aware of this limitation and plan to make improvements down the line. We don't have any specific timeline for these changes yet but we'll be sure to update our users when we have more information.

    For what it's worth, I tried to reproduce your second issue with both 2017.1.1f1 and 2017.2.0f3 but wasn't able to run into it. Using Apple File Merge or SourceGear DiffMerge I was able to compare the changes between each version without any of the earlier changes being skipped. I also would encounter merge conflicts when editing the same counter value in my for loop, so I'm really curious to know how you ran into this. If you do decide to try to reproduce this problem with a smaller project some day in the future, we'd really appreciate it if you could send us a bug report so that we could take a look at what's happening. Until then, best of luck on your project and we hope you'll give us another chance down the road!
     
  47. Archimagus

    Archimagus

    Joined:
    Sep 29, 2012
    Posts:
    16
    Just here to voice another vote for support of visual studio as a merge tool. Bonus points if you could add Team Explorer integration much like git has.
     
    DurbsDev likes this.
  48. almaione-sdn

    almaione-sdn

    Joined:
    Jun 28, 2017
    Posts:
    13
    winmerge save error.png
    Beyond compare license expired and returned to WinMerge. Switched to Unity 2017.3 but the issue remains. Any suggest @ryanc-unity ? Thx a lot in advance
     
  49. ryanc-unity

    ryanc-unity

    Unity Technologies

    Joined:
    Mar 23, 2016
    Posts:
    1,474
    Hi @almaione-sdn! Sorry for the late response! You could try using SourceGear DiffMerge or TkDiff for your Windows diff needs. Let me know if those work for you!
     
  50. almaione-sdn

    almaione-sdn

    Joined:
    Jun 28, 2017
    Posts:
    13
    hi @ryanc-unity , thanks fo your reply.
    Are you planning to integrate the Visual Studio built-in diff tool (the best ever tried) or to create a Unity brand-new one?
     
    DurbsDev likes this.
unityunity