CN-121979865-A - Metadata version control method
Abstract
The invention discloses a metadata version control method which comprises the steps of establishing a metadata version control system composed of a Git warehouse comprising a main branch and all user personal branches, a plurality of associated working trees serving as working directories and a database table for recording user states, storing metadata in the main branch of the version control system in the form of JSON text files, managing the metadata by the Git warehouse, using a file system as the working directories of the Git, providing complete metadata version control service for upper-layer applications by packaging the branching, submitting, merging, rollback and journaling capabilities of the Git, judging whether a target user personal working space exists or not when a target user in a browsing state initiates metadata writing operation, and executing operations such as creating the user personal working space according to judgment results.
Inventors
- DING BO
- LI YAQIANG
Assignees
- 北京涛思数据科技有限公司
Dates
- Publication Date
- 20260505
- Application Date
- 20260408
Claims (10)
- 1. A method of metadata version control, comprising: Establishing a metadata version control system consisting of a Git warehouse comprising a main branch and all user personal branches, a plurality of associated work trees serving as work catalogues and a database table for recording user states; storing metadata in a main branch of a version control system in the form of a JSON text file, and managing the metadata by the Git warehouse; using a file system as a working directory of the Git, and providing complete metadata version control service for upper-layer application by encapsulating the branching, submitting, merging, rollback and log capabilities of the Git; When a target user in a browsing state initiates metadata writing operation, the metadata version control system judges whether a personal working space of the target user exists or not; If the metadata version control system judges that the target user personal space does not exist, creating a target user personal work space which is completely isolated from the main branch and other users, and then switching the state of the target user to an Edit state Edit so that the target user can perform metadata version change operation in the personal work space; if the metadata version control system judges that the personal space of the target user exists, merging the latest metadata stored in the main branch into the personal branch of the target user, and switching the state of the target user to the Edit state Edit so that the target user can perform metadata version change operation in the personal working space of the target user; The target user personal workspace comprises user personal branches and personal work trees.
- 2. The method of metadata version control as recited in claim 1 wherein creating a target user personal workspace comprises creating a target user personal branch in a working directory in which a Git repository resides and creating a separate target user working tree for the target user branch.
- 3. The metadata version control method according to claim 1 or 2, wherein the metadata version change includes a metadata addition, deletion or modification operation performed by a target user in his personal workspace.
- 4. The method of claim 3, wherein the target user performs a Check In operation on the application interface for requesting a Git commit after completing a set of related modifications, wherein a Check In corresponds to a Git commit.
- 5. The method of claim 3, wherein after one or more Git submissions, the user initiates a merge request PR, and the metadata version control system merges all modified metadata versions on the target user's personal branches back to the primary branch in a simple merge mode or a review merge mode in response to the PR.
- 6. The method according to claim 5, wherein in the review merge mode, the metadata version control system automatically creates a merge request PR, merges the modified metadata version into the primary branch if the merge request PR passes the review, and then switches the user state back to the browse state.
- 7. The method of claim 6, wherein in the simple merge mode, the metadata version control system attempts to automatically merge the changed metadata version back into the main branch, and if the merge is successful, switches the user state back into the browse state.
- 8. The metadata version control method according to claim 7, wherein in a simple merge mode or a review merge mode, an administrator is notified of intervention if a merge fails to complete the merge in an interface provided by a metadata version control system.
- 9. The method of claim 5, wherein the metadata version control system provides an interface for a target user to browse a main branch Git submission history, and wherein the user performs GIT REVERT-based rollback operations via the interface.
- 10. The metadata version control method of claim 9 wherein the rollback operation undoes changes to the target user-specified Git commit by creating a new Git commit instead of deleting the history.
Description
Metadata version control method Technical Field The invention relates to the technical field of industrial metadata management, in particular to a method for carrying out version control on text metadata based on Git, which is suitable for industrial data asset management scenes requiring multi-user collaboration, change history tracing, controllable rollback and change auditing. Background Conventional industrial metadata management systems typically face the following challenges: Version tracing is difficult, namely, the modification history of metadata is unclear, and the author, time and reason of a certain change are difficult to trace. Rollback operations are complex, lack of a reliable rollback mechanism, manual recovery of historical versions is error prone, and may break data consistency. And the concurrent conflict is that when multiple users edit the same metadata at the same time, the conflict is easy to generate, and the modification of the later submitter is caused to cover the former. And the verification process is lacking, namely the change of the key metadata cannot be incorporated into the formal verification process, and management risks exist. The existing scheme depends on audit logs or manual backup of databases, and is difficult to meet the requirements of modern industrial scenes on collaboration efficiency, reliability and fine management. Related patent documents are CN120804030A and CN120723842A. Disclosure of Invention The invention aims to provide a metadata version control method taking Git as a core so as to overcome the defects of the prior art. The metadata version control method of the invention comprises the following steps: Establishing a metadata version control system consisting of a Git warehouse comprising a main branch and all user personal branches, a plurality of associated work trees (work catalogues) and a database table for recording user states; storing metadata in a main branch of a version control system in the form of a JSON text file, and managing the metadata by the Git warehouse; Using a file system as a working directory (working tree) of the Git, and providing complete metadata version control service for upper-layer application by encapsulating branching, submitting, merging, rollback and journaling capabilities of the Git; when a target user in a browsing state initiates metadata writing operation, the metadata version control system judges whether a personal working space of the target user exists or not by executing Check Out; If the metadata version control system judges that the target user personal space does not exist, creating a target user personal work space which is completely isolated from the main branch and other users, and then switching the state of the target user to an Edit state Edit so that the target user can perform metadata version change operation in the personal work space; if the metadata version control system judges that the personal space of the target user exists, merging the latest metadata stored in the main branch into the personal branch of the target user, and switching the state of the target user to the Edit state Edit so that the target user can perform metadata version change operation in the personal working space of the target user; wherein the target user personal workspace comprises user personal branches and personal work trees, and the Git is a distributed version control system. Preferably, creating the target user personal workspace comprises creating a target user personal branch in a working directory of the Git warehouse and creating an independent target user working tree for the target user branch. Preferably, the metadata version alteration includes a metadata addition, deletion or modification operation by the target user in his personal workspace. Preferably, after the target user completes a set of related modifications, a Check In operation is performed on the application interface for requesting a Git commit, wherein one Check In corresponds to one Git commit. Preferably, after one or more Git submissions, the user initiates a merge request PR, and the metadata version control system responds to the PR to merge all the changed metadata versions on the personal branches of the target user back to the main branch through a simple merge mode or a review merge mode. Preferably, in the review merge mode, the metadata version control system automatically creates a merge request PR, merges the changed metadata version into the main branch if the merge request PR passes the review, and then switches the user state back to the browse state. Preferably, in the simple merge mode, the metadata version control system attempts to automatically merge the changed metadata versions back into the main branch, and if the merge is successful, switches the user state back to the browse state. Preferably, if in the simple merge mode or the review merge mode, an administrator is notified of the intervention if the me