-
Type: Improvement
-
Status: Resolved
-
Priority: Critical
-
Resolution: Fixed
-
Affects Version/s: 3.9.0
-
Fix Version/s: 3.10.0
-
Component/s: Technical / Transverse, Versioning & Branch management
-
Epic Link:
-
Tags:
-
Sprint:NOS 2019-03 02, NOS 11.1.6 - 2019-04 1
-
Story Points:5
Context
Currently, we have a lot of troubles with Studio workspace / JGit (NXS-5232), in particular the NXS-5212 Invalid ref name: HEAD problem. However, we don't know the root cause of the problem and it keeps impacting more and more customers. In regards to workspace, several things are not clear: its lifecycle, the responsibility of each class, and workspace pool (caching mechanism). This ticket aims to address these problems by refactoring the workspace usage.
Goals
We want to make workspace safer to use and easier understand. We also want to avoid using "workspace" everywhere, but replace by other more appropriate vocabulary. In more detail, it means:
- Understand workspace lifecycle
- Simplify the logic by removing useless class
- Distinguish user-specific actions (workspace), and project-common actions (repository)
- Distinguish read and write actions
- Reduce the workspace state changes — error-prone actions.
Source Code Changes
GitService is renamed from VersioningService (NXS-2938). Its primary goal is to interact with workspace. That's why we always use Workspace as input parameter, and avoid using File from now on. The service contains the following logic:
- Read operations (branches, tags, file changes, file content)
- Write operations which require a workspace (delete tag, commit, delete wip commit)
- Write operations which do not require a workspace (create branch, create WIP branch, delete branch, delete tags)
- WIP branch mechanism (saveWIP, commitWIP, pullWIP, pushWIP)
- Legacy operations (get history, compare file, merge, pull rebase)
ProjectDataService contains methods split from VersioningService. This is a business level service. Its goal is to provides information for a given project.
- Interact with project data (files)
- Deserialization and serialization of Java object, e.g. ApplicationDefinition
- Branch status (ahead commits, behind commits, possible WIP commit)
GitRepositoryService contains methods split from VersioningService. Its goal is to handle CRUD operations for Git repository. It only takes action at the beginning and end of the repository life cycle. It also provides useful information related to the repository (remote URL, credentials). The main difference between GitService and GitRepositoryService is that they take actions in different phrases in repository's life cycle. The service contains the following logic:
- Create repository
- Delete repository
- Rename repository
- Get repository URL
- Get credentials
ProjectImportService contains methods split from VersioningService. Its goal is to handle project import / export. The service contains the following logic:
- Push force
- Reconfigure repo after import
- Prepare repo before export
- prepare repo before import
WorkspaceService
Workspace
// TODO