Problem/Motivation
In #2784921-137: Add Workspaces experimental module @catch presented a use case where a user may wish to pull content from one workspace, and push to a different workspace. In the analogy of git this may be similar to a merge.
The initial patch for the Workspace module in #2784921: Add Workspaces experimental module will only allow content replication to and from the live workspace. Therefore we need to look at how replication will work with other workspaces from both a technical and user point of view too.
In this issue we can discuss the possibly uses cases of content replication, and how users would like to be able to push, pull, and merge content between workspaces.
Proposed resolution
What we could do is change the repository plugins' purpose to only handle cross-site replication, and provide two additional services, one that will handle merging local workspaces and the other one to handle publishing a workspace to 'live'.
We should also have a new merge($workspace_id) method on the workspace entity, which will essentially bring all the revisions of $workspace_id into the current workspace, handle conflicts, etc.
And we probably want a publish() method as well, so we can execute the "publish to live" action from the context of a non-live workspace.
| Comment | File | Size | Author |
|---|---|---|---|
| #17 | interdiff-17.txt | 1.44 KB | amateescu |
| #17 | 2958752-17.patch | 41.78 KB | amateescu |
| #15 | interdiff-15.txt | 1.95 KB | amateescu |
| #15 | 2958752-15.patch | 38.12 KB | amateescu |
| #11 | interdiff-11.txt | 631 bytes | amateescu |
Comments
Comment #2
timmillwoodComment #3
amateescu commented@dixon, @timmillwood and myself discussed this issue a couple of days ago and I think that @catch brings up a very good point: merging between local workspaces and publishing the pending revision of a workspace to live will always be done in the same way, so there's no reason for them to be plugins.
So what we could do is change the repository plugins' purpose to only handle cross-site replication, and provide two additional services, one that will handle merging local workspaces and the other one to handle publishing a workspace to 'live'.
We should also have a new
merge($workspace_id)method on the workspace entity, which will essentially bring all the revisions of$workspace_idinto the current workspace, handle conflicts, etc.And we probably want a
publish()method as well, so we can execute the "publish to live" action from the context of a non-live workspace.Comment #4
amateescu commentedWe can start working on this in the contrib branch, so moving to that queue for now. And promoting to critical because this is a beta blocker for the core Workspace module.
Comment #5
amateescu commentedComment #6
catch+1.
Comment #7
timmillwoodThis issue is a "Discuss" issue, and maybe should've been given the "Plan" category.
With @catch's "+1" in #6 I feel we have consensus for some action. This discussion issue is a beta blocker, but is actioning on this discussion also a blocker for beta? Should we close this and open a follow up to implement the merge functionality?
Comment #8
catchSo #3 is very similar to what I thought of when I reviewed the original patch.
One service/method for 'publish a workspace'.
One service/method for 'merge two workspaces'.
Only use plugins for the remote publishing stuff (from a third service?)
Since this issue is short, going to try just retitling it and adding #3 to the issue summary.
Comment #9
amateescu commentedHere's an initial stab at this.
It removes the concept of repository plugins entirely, and provides a "workspace operation factory" service along with a "workspace publisher" class, since that's the only thing we support right now.
Comment #10
timmillwoodShould we cache this here or in WorkspaceDeployForm? Because it's called on line 79 and line 118, each time creating a new instance of the class.
Missing
returnhere.Comment #11
amateescu commented1. That class doesn't really have a long instantiation process, so I don't think it needs any caching.
2. Good catch, fixed :)
Comment #12
catchWhy a factory that returns an instance of this class, instead of a direct service with a publish($workspace) method?
Comment #13
timmillwood@catch - I asked this same question to Andrei in slack, he said:
The only other option I thought of was a
useWorkspace($workspace)orsetWorkspace($workspace)method, but that way you can't ensure it's been done, so would need some form of check in each method that the workspace was set.Comment #14
timmillwoodDo you think we should mark these as
@internal?1) I don't think custom/contrib code should call them directly (at least initially)
2) What if we need to change them before 8.7? I'm thinking once we implement Relaxed module in contrib and find something we didn't think of.
Comment #15
amateescu commentedGood point, let's do that :)
Comment #16
timmillwoodAwesome, looks good to me!
Comment #17
amateescu commentedI was doing a self-review for this patch and I noticed that there were two outstanding @todo's pointing to this very issue :)
Since we don't have the generic concept of repository handlers anymore, I think the documentation for the return values of
WorkspaceOperationInterface::getDifferringRevisionIdsOnTarget()andWorkspaceOperationInterface::getDifferringRevisionIdsOnSource()doesn't need to mention the possible variations (revision IDs vs. revision UUIDs). It's up to each implementation ofWorkspaceOperationInterfaceto return whatever identifier they need and handle it consistently.Comment #18
amateescu commentedComment #19
timmillwoodNice spot @amateescu.
Still RTBC.
Comment #20
catchOK this looks great. I don't love the factory, but if we think of something better later, we can change it then. Can't think of a good way around it at the moment.
Committed 0968d28 and pushed to 8.6.x. Thanks!
Comment #22
amateescu commentedFix component following module rename.