mastodon-sc / mastodon-git

A plugin for Mastodon that allows to collaborate on a project via Git.
BSD 2-Clause "Simplified" License
0 stars 0 forks source link

Adapt latest Mastodon version beta 28 #4

Closed maarzt closed 7 months ago

maarzt commented 8 months ago

Fixes #3

The API of mastodon core components changed with the recent Mastodon releases (1.0.0-beta-27 and beta-28). This PR updates mastodon-git to be compatible with these changes.

Overview of the code changes

  1. In many places classes MamutAppModel and WindowManager where replaced with ProjectModel.
  2. Mastodon-git requires the ability to reload the currently open Mastodon project from disk. In the past this was implemented with a simple call to windowManager.getProjectManager().openWithDialog( project );. But this API was changed in beta-27. The projectmanager no longer exists. The open method is now a static method of the ProjectLoader an can not any longer be used to reload the project. The new "reload from disk" approach: is to use the projectModel.getModel().loadRaw(...) method. See: https://github.com/mastodon-sc/mastodon-git/blob/76233bf26719e09a4d642b7653c46357f32ed46b/src/main/java/org/mastodon/mamut/collaboration/utils/ReloadFromDiskUtils.java#L25-L31 This new approach has the advantage that the AppModel/ProjectModel remains the same. And now BDV/TrackScheme windows remain open. But there is a bug in mastodon-collection which must be fixed for this to work.
  3. Unit tests where added to make sure that mastodon-git still works after all the changes. See MastodonGitRepositoryTest
  4. Two bugs where found when implementing the unit tests, these are now fixed.
    • "Reset to remote banch" didn't work after creating and pushing a new branch.
    • Conflict tags sets are now automatically removed, when merging two branches finishes without conflicts.
  5. There is a class ModelAsserts, which allows to compare to Mastodon Models. This class is used in the new unit tests.
  6. There is a class CopyModelUtils. Which was used in the unit test but is no longer required. I still want to keep it, because I know it can be useful.