Software version management method and device, electronic equipment and computer program product
By using a virtual branch management system and copy-on-write technology, the problems of storage overhead and code conflicts in version control are solved, achieving efficient software version control and improving development efficiency and storage costs.
Patent Information
- Application Number
- CN202511155920.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-08-18
- Publication Date
- 2025-11-28
AI Technical Summary
In existing technologies, manually merging version code leads to chaotic version management, increases storage overhead and code conflicts, and affects development efficiency and continuous delivery efficiency.
A virtual branch management system is adopted, which manages versions through lightweight metadata and pointer structures, avoiding full data copying. Only pointers and incremental modifications are stored when a branch is created. The modified data is stored in the incremental patch file using copy-on-write technology, and the configuration management data is dynamically merged.
Significantly reduce storage overhead, improve branch creation and retrieval efficiency, avoid code conflicts, enhance the flexibility and operational efficiency of software version management, and reduce storage and labor costs.
Smart Images

Figure CN121029221A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of cloud computing, and more specifically, to a software version management method, apparatus, electronic device, and computer program product. Background Technology
[0002] In software development and configuration management environments within related technologies, configuration administrators employ a feature branching strategy to manage the configuration of different software versions. This involves creating a separate branch for each new version or feature requirement for development and testing. During the version development cycle, the simultaneous development of multiple versions results in multiple parallel branches within the system, which increases the complexity of configuration management to some extent.
[0003] When creating each feature branch, administrators need to completely copy the base version's data to ensure branch independence and data integrity. This copying process leads to a linear increase in storage overhead as the number of branches increases. In large configuration repositories, the increase in storage costs becomes particularly significant, posing challenges to resource management and cost control. The initialization time of physical branches is affected by the size of the base data. For large configuration repositories, creating a branch can take several minutes, impacting development efficiency and flexibility. In environments with rapid iteration and continuous integration / continuous delivery, this latency can become a bottleneck. When multiple feature branches simultaneously modify the same configuration items, the merging process becomes complex and error-prone. Administrators need to manually intervene to resolve conflicts during the merging process, which not only consumes significant time and human resources but may also lead to the loss or corruption of configuration items due to misoperation, directly impacting the efficiency of continuous software delivery.
[0004] There is currently no effective solution to the problem of version management chaos and code conflicts caused by manually merging version code in related technologies. Summary of the Invention
[0005] The main objective of this application is to provide a software version management method, device, electronic device, and computer program product to solve the problem of code conflicts caused by the chaotic version management due to the manual merging of version codes in related technologies.
[0006] To achieve the above objectives, according to one aspect of this application, a software version management method is provided. The method includes: obtaining a target virtual branch created by a target user from a virtual branch management system, wherein the virtual branch management system stores user-created virtual branches, each virtual branch representing a new version obtained after the user modifies the software version; extracting a target pointer and target modification records from the target metadata stored in the target virtual branch, wherein the target pointer points to a snapshot of the main branch code, and the target modification records are records of incremental code modifications made by the target user to the main branch code; extracting snapshot data of the main branch code from the virtual branch management system based on the target pointer, and determining target configuration items modified by the target user based on the target modification records; extracting target update data from the incremental patch file corresponding to the target configuration items from the virtual branch management system, merging the target update data into the snapshot data to obtain configuration management data for the target software version corresponding to the target virtual branch, and managing the target software version based on the configuration management data.
[0007] Optionally, before obtaining the target virtual branch code created by the target user from the virtual branch management system, the method further includes: receiving a virtual branch creation request from the target user through the user interface layer of the virtual branch management system; creating a target virtual branch in the virtual branch management system based on the virtual branch creation request; generating a metadata record for the target virtual branch through the virtual branch management layer of the virtual branch management system; associating the target virtual branch with a snapshot of the main branch code based on the metadata record, wherein the metadata record contains a target pointer and the initial state of the target virtual branch; and storing the incremental code modification data in an incremental patch file through the physical storage layer of the virtual branch management system if the target user is detected to have modified the initial state.
[0008] Optionally, storing incremental code modification data in the incremental patch file through the physical storage layer of the virtual branch management system includes: determining the target configuration item modified by the target user, loading a snapshot of the main branch code based on the target pointer; copying the original data corresponding to the target configuration item from the snapshot of the main branch code to the target storage space of the physical storage layer, modifying the original data in the target storage space to obtain the updated target data; generating a target modification record based on the updated target data, updating the target modification record to the target metadata, and storing the updated target data in the incremental patch file.
[0009] Optionally, merging the target updated data into the snapshot data includes: determining whether there is a conflict between the target updated data and the snapshot data; issuing a prompt message if there is a conflict between the target updated data and the snapshot data, wherein the prompt message contains the conflicting data between the target updated data and the snapshot data; and merging the target updated data into the snapshot data if there is no conflict between the target updated data and the snapshot data.
[0010] Optionally, after obtaining the target virtual branch created by the target user from the virtual branch management system, the method further includes: if a deletion request for the target virtual branch is detected from the target user, deleting the target metadata in the virtual branch management layer of the virtual branch management system based on the deletion request; and deleting the incremental patch file of the target virtual branch in the physical storage layer of the virtual branch management system.
[0011] Optionally, extracting snapshot data of the main branch code from the virtual branch management system based on the target pointer includes: determining the version number of the main branch code pointed to by the target pointer; and extracting snapshot data of the main branch code corresponding to the version number from the physical storage layer of the virtual branch management system based on the version number.
[0012] Optionally, before obtaining the target virtual branch created by the target user from the virtual branch management system, the method further includes: obtaining the main branch code of the initial version of the software and storing the main branch code in the physical storage layer of the virtual branch management system.
[0013] To achieve the above objectives, according to another aspect of this application, a software version management apparatus is provided. The apparatus includes: an acquisition unit, configured to acquire a target virtual branch created by a target user from a virtual branch management system, wherein the virtual branch management system stores user-created virtual branches, each virtual branch representing a new version obtained after the user modifies the software version; an extraction unit, configured to extract a target pointer and a target modification record from the target metadata stored in the target virtual branch, wherein the target pointer points to a snapshot of the main branch code, and the target modification record is a record of incremental code modifications made by the target user to the main branch code; a first determination unit, configured to extract snapshot data of the main branch code from the virtual branch management system based on the target pointer, and determine the target configuration item modified by the target user based on the target modification record; and a management unit, configured to extract target update data from the incremental patch file corresponding to the target configuration item from the virtual branch management system, merge the target update data into the snapshot data to obtain configuration management data for the target software version corresponding to the target virtual branch, and manage the target software version based on the configuration management data.
[0014] In this embodiment, the target virtual branch created by the target user is obtained from the virtual branch management system. The virtual branch management system stores the virtual branches created by the user, and each virtual branch represents a new version obtained after the user modifies the software version. The target pointer and target modification record are extracted from the target metadata stored in the target virtual branch. The target pointer points to a snapshot of the main branch code, and the target modification record is a record of incremental code modifications made by the target user to the main branch code. Based on the target pointer, the snapshot data of the main branch code is extracted from the virtual branch management system, and the target configuration items modified by the target user are determined based on the target modification record. The target update data corresponding to the target configuration item is extracted from the incremental patch file of the virtual branch management system, and the target update data is merged into the snapshot data to obtain the configuration management data of the target software version corresponding to the target virtual branch. By managing the target software version based on the configuration management data, and using a lightweight metadata and pointer structure, the full data copying during branch creation is avoided, significantly reducing storage overhead. The construction of virtual branches involves only reading and writing metadata, without copying large amounts of data, which improves the efficiency of branch creation and reading. By generating configuration management data through incremental code modifications and merging them into the main branch code snapshot, even if multiple branches are operated on simultaneously, it will not affect the main branch code itself, thus achieving the goal of avoiding code conflicts. This achieves the technical effect of improving the flexibility of software version management, and solves the technical problem of code conflicts caused by manual merging of version code, which leads to chaotic version management. Attached Figure Description
[0015] The accompanying drawings, which form part of this application, are used to provide a further understanding of this application. The illustrative embodiments and descriptions of this application are used to explain this application and do not constitute an undue limitation of this application. In the drawings:
[0016] Figure 1 A hardware structure block diagram of a computer terminal (or mobile device) for implementing a software version management method is shown.
[0017] Figure 2 This is a flowchart of a software version management method provided according to an embodiment of this application;
[0018] Figure 3 This is a schematic diagram of a virtual branch management system provided according to an embodiment of this application;
[0019] Figure 4 This is a schematic diagram of a software version management device provided according to an embodiment of this application;
[0020] Figure 5 This is a structural block diagram of an electronic device according to an embodiment of this application. Detailed Implementation
[0021] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present application, and not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative effort should fall within the scope of protection of the present application.
[0022] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0023] It should be noted that the information collected in this application (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for display, data used for analysis, etc.) are information and data authorized by the user or fully authorized by all parties. Furthermore, the collection, storage, use, processing, transmission, provision, disclosure, and application of this data all comply with relevant laws, regulations, and standards, necessary confidentiality measures have been taken, and they do not violate public order and good morals. Corresponding access points are provided for users to choose to authorize or refuse. For example, interfaces are set up between this system and relevant users or organizations, providing users with corresponding access points to choose to agree to or refuse automated decision-making results; if the user chooses to refuse, the process proceeds to the expert decision-making stage.
[0024] Example 1
[0025] According to an embodiment of this application, a method embodiment for software version management is also provided. It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions. Furthermore, although a logical order is shown in the flowchart, in some cases, the steps shown or described may be executed in a different order than that shown here.
[0026] The method embodiment provided in Embodiment 1 of this application can be executed on a mobile terminal, computer terminal, or similar computing device. Figure 1A hardware block diagram of a computer terminal (or mobile device) for implementing a software version management method is shown. Figure 1 As shown, the computer terminal 10 (or mobile device) may include one or more processors 102 (shown as 102a, 102b, ..., 102n in the figure) 102 (processor 102 may include, but is not limited to, processing devices such as MCU (Microcontroller Unit) or FPGA (Field-Programmable Gate Array), memory 104 for storing data, and transmission device 106 for communication functions. In addition, it may also include: a display, input / output interfaces (I / O interfaces), a USB (Universal Serial Bus) port (which may be included as one of the ports of a BUS (Business Bus), a network interface, a power supply, and / or a camera. Those skilled in the art will understand that... Figure 1 The structure shown is for illustrative purposes only and does not limit the structure of the aforementioned electronic device. For example, computer terminal 10 may also include... Figure 1 The more or fewer components shown, or having the same Figure 1 The different configurations shown.
[0027] It should be noted that the aforementioned one or more processors 102 and / or other data processing circuits are generally referred to herein as "data processing circuits". These data processing circuits may be embodied, in whole or in part, in software, hardware, firmware, or any other combination thereof. Furthermore, the data processing circuits may be a single, independent processing module, or may be integrated, in whole or in part, into any other element within the computer terminal 10 (or mobile device). As involved in the embodiments of this application, the data processing circuits serve as a processor control mechanism (e.g., selection of a variable resistor termination path connected to an interface).
[0028] The memory 104 can be used to store software programs and modules of application software, such as the program instructions / data storage device corresponding to the software version management method in this embodiment. The processor 102 executes various functional applications and data processing by running the software programs and modules stored in the memory 104, thereby realizing the above-mentioned software version management method. The memory 104 may include high-speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 104 may further include memory remotely located relative to the processor 102, and these remote memories can be connected to the computer terminal 10 via a network. Examples of such networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof.
[0029] The transmission device 106 is used to receive or send data via a network. Specific examples of the network described above may include a wireless network provided by the communication provider of the computer terminal 10. In one example, the transmission device 106 includes a Network Interface Controller (NIC), which can connect to other network devices via a base station to communicate with the Internet. In another example, the transmission device 106 may be a Radio Frequency (RF) module, used for wireless communication with the Internet.
[0030] The display may be, for example, a touchscreen LCD display that allows the user to interact with the user interface of the computer terminal 10 (or mobile device).
[0031] In the above operating environment, this application provides a software version management method. Figure 2 This is a flowchart of a software version management method provided according to an embodiment of this application, such as... Figure 2 As shown, the method includes:
[0032] Step S201: Obtain the target virtual branch created by the target user from the virtual branch management system. The virtual branch management system is used to store the virtual branches created by the user. Each virtual branch represents the new version obtained after the user modifies the software version.
[0033] In step S201, the virtual branch management system can be a system deployed on a distributed server for managing software version code. This system acts as a centralized management platform, storing information about all virtual branches created by users. Target users can create, read, update, and delete their own virtual branches from the virtual branch management system. When a target user needs to manage the software version corresponding to a created target virtual branch, they can read the target virtual branch from the virtual branch management system.
[0034] Step S202: Extract the target pointer and target modification record from the target metadata stored in the target virtual branch. The target pointer is used to point to a snapshot of the main branch code, and the target modification record is a record of incremental code modifications made by the target user to the main branch code.
[0035] In step S202, the target pointer is the core identifier of the virtual branch, containing the following information: `parent`, pointing to the parent branch (e.g., the main branch); `base_snapshot`, pointing to the base snapshot version of the main branch (e.g., `snapshot_123`); and `modified_keys`, a list of configuration items modified in the current branch (key-value tracking). The target modification record records all modified code items in the virtual branch, each with a key-value pair, enabling the system to quickly locate which parts need to be processed or stored separately. The target pointer and target modification record are extracted by reading the target metadata of the target virtual branch.
[0036] Step S203: Extract snapshot data of the main branch code from the virtual branch management system based on the target pointer, and determine the target configuration items modified by the target user based on the target modification record.
[0037] In step S203, based on the target pointer, snapshot data of the main branch code is extracted. After the snapshot data is downloaded, a complete view of the main branch code is built locally or in the cache. The key-value list in the target modification record is read; this key-value list records the specific configuration items for incremental modifications made to the main branch code by the target user, i.e., the target configuration items.
[0038] Step S204: Extract target update data from the incremental patch file corresponding to the target configuration item from the virtual branch management system, merge the target update data into the snapshot data, obtain the configuration management data of the target software version corresponding to the target virtual branch, and manage the target software version based on the configuration management data.
[0039] In step S204, when a target user modifies a configuration item in the main branch code within the virtual branch, this modification is saved through the target modification record and stored in the incremental patch file. The incremental update data to be merged, i.e., the target update data, is determined from the incremental patch file corresponding to the target configuration item. The extracted target update data is merged with the snapshot data of the main branch code as needed. The merge operation is dynamic; for each specific configuration item, its original state in the snapshot is checked, and it is compared and integrated with the update data in the incremental patch file. Through the merge process, a dynamic view of the current configuration management data for the target virtual branch is generated. This view includes the unmodified portion of the main branch snapshot and the latest state of all modified configuration items in the virtual branch.
[0040] The merged configuration management data reflects the complete state of the target software version within the target virtual branch. Based on this data, configuration files for the target software version can be updated or generated. Without modifying the main branch, the software version in the target virtual branch can independently possess the latest configuration state, suitable for testing, development, or specific deployment environments.
[0041] The software version management method provided in this application obtains target virtual branches created by target users from a virtual branch management system. The virtual branch management system stores user-created virtual branches, each representing a new version obtained after the user modifies the software version. Target pointers and target modification records are extracted from the target metadata stored in the target virtual branch. The target pointers point to snapshots of the main branch code, and the target modification records record incremental code modifications made by the target user to the main branch code. Based on the target pointers, snapshot data of the main branch code is extracted from the virtual branch management system, and target configuration items modified by the target user are determined based on the target modification records. Target update data corresponding to the target configuration items is extracted from the incremental patch files of the virtual branch management system, and the target update data is merged into the snapshot data to obtain configuration management data for the target software version corresponding to the target virtual branch. The target software version is managed based on this configuration management data. By using lightweight metadata and pointer structures, full data copying during branch creation is avoided, significantly reducing storage overhead. The construction of virtual branches involves only reading and writing metadata, without copying large amounts of data, which improves the efficiency of branch creation and reading. By generating configuration management data through incremental code modifications and merging them into the main branch code snapshot, even if multiple branches are operated on simultaneously, it will not affect the main branch code itself, thus achieving the goal of avoiding code conflicts. This achieves the technical effect of improving the flexibility of software version management, and solves the technical problem of code conflicts caused by manual merging of version code, which leads to chaotic version management.
[0042] The target user stores the target virtual branch created through the virtual branch management system. Optionally, in the software version management method provided in this application embodiment, before obtaining the target virtual branch code created by the target user from the virtual branch management system, the method further includes: receiving the target user's virtual branch creation request through the user interface layer of the virtual branch management system, creating the target virtual branch in the virtual branch management system based on the virtual branch creation request; generating metadata records of the target virtual branch through the virtual branch management layer of the virtual branch management system, associating the target virtual branch with a snapshot of the main branch code based on the metadata records, wherein the metadata records contain the target pointer and the initial state of the target virtual branch; and storing the incremental code modification data in the incremental patch file through the physical storage layer of the virtual branch management system when it is detected that the target user has modified the initial state.
[0043] In some embodiments, Figure 3 This is a schematic diagram of a virtual branch management system provided according to an embodiment of this application, such as... Figure 3 As shown, the system includes: a user interface layer, a virtual branch management layer, and a physical storage layer. The user interface layer provides standardized interfaces to support dynamic access from platforms such as the configuration center of container orchestration management platforms and cloud-native application management platforms. For example, the code for a virtual branch creation request is as follows:
[0044]
[0045] Virtual branch management layer: Stores lightweight metadata, or metadata records, through a memory-based key-value store system. These records contain branch parent-child relationships, baseline snapshot references, and modification records (single metadata record < 1KB). An example of the metadata format is shown below:
[0046]
[0047] Physical storage layer: Full snapshots of the main branch code are stored in the object storage service system, while difference data is stored as incremental patch files on demand. Example paths are shown below:
[0048] oss: / / bucket / main / snapshot_123 / diff / v1 / <timestamp>.patch).
[0049] Traditional branches require a full copy of the main branch's data, while virtual branches only store pointers to the main branch's baseline snapshot and incremental modifications, achieving zero-redundancy storage and millisecond-level branch creation. The target user initiates a virtual branch creation request through the user interface layer. The actual data of the virtual branch is linked to the main branch snapshot via pointers, triggering lazy loading only when the branch is modified for the first time. Based on the virtual branch creation request, the virtual branch management system creates the target virtual branch at the virtual branch management layer. This process essentially generates a set of metadata records in a memory-based key-value store system. Through the target pointer in the metadata, the target virtual branch is linked to the snapshot of the main branch code. This means that the code of the target virtual branch is actually based on a snapshot of the main branch code, but in practice, the snapshot data of the main branch code is only loaded when modifications occur, thereby reducing operational latency and storage overhead.
[0050] When a target user modifies the initial state of the target virtual branch (i.e., the state based on the main branch code snapshot), the virtual branch management system immediately detects this change. The system does not directly modify the main branch code snapshot; instead, it uses copy-on-write technology to store the modified configuration items as incremental patch files. Only the modified data is stored; unmodified parts still share the main branch snapshot. Incremental code modification data is stored in the incremental patch file via the physical storage layer. Simultaneously, the system updates the target virtual branch's metadata in the virtual branch management layer, adding the modified configuration item key-value pairs to the virtual branch management layer's key-value list, thus recording which data items have been modified.
[0051] This embodiment achieves intelligent and efficient management of main branch code snapshots under a virtual branch architecture through a virtual branch management system. It improves the flexibility and responsiveness of configuration management, reducing storage overhead from GB levels to KB levels (tens of MB of metadata are required for tens of thousands of branches). Since only one metadata record needs to be written to the virtual branch management layer, branch creation time is reduced from minutes to milliseconds. Copy-on-write technology reduces redundant data by 78%, and storage costs for tens of thousands of branches are reduced by 91%. This reduces storage costs, enables millisecond-level branch creation, supports thousands of concurrent requests, features key-value conflict detection and automatic synchronization, reduces manual costs by 70%, separates metadata from storage, and supports horizontal scaling of millions of branches. The virtual branch system can support large-scale, high-concurrency branch creation and modification, while intelligent conflict detection and automatic synchronization mechanisms reduce maintenance labor costs and the complexity of continuous delivery.
[0052] To reduce redundant data in branch code, incremental code modification data is stored in an incremental patch file using copy-on-write technology. Optionally, in the software version management method provided in this application embodiment, storing incremental code modification data in an incremental patch file through the physical storage layer of the virtual branch management system includes: determining the target configuration item modified by the target user; loading a snapshot of the main branch code based on the target pointer; copying the original data corresponding to the target configuration item from the snapshot of the main branch code to the target storage space of the physical storage layer; modifying the original data in the target storage space to obtain updated target data; generating a target modification record based on the updated target data; updating the target modification record to the target metadata; and storing the updated target data in the incremental patch file.
[0053] In some embodiments, when a target user modifies the target configuration item `config.item1` in the target virtual branch, the system loads the main branch snapshot `snapshot_123` from the object storage service system using the pointer `base_snapshot`. Through copy-on-write technology, the incremental code modification data is isolated to an independent storage space, i.e., the target storage space. In the target storage space, the target user modifies the copied original data to obtain the updated target data. This modification does not affect the original snapshot `snapshot_123` of the main branch because the data is copied to an independent storage space. The system generates a target modification record based on the updated target data, recording which specific configuration items have changed and their new values. The newly generated target modification record is then updated in the metadata of the target virtual branch. Finally, the system stores the updated target data in an incremental patch file. The incremental patch file contains only the modified data fragments, not a copy of the entire snapshot, thus greatly reducing storage space requirements.
[0054] This embodiment writes all modifications to the incremental patch file, keeping the main branch data read-only. When reading the configuration, the main branch snapshot and incremental patch are dynamically merged to generate the final view. Branch preparation time is reduced from 5 minutes in the traditional approach to 50 milliseconds. Storage costs are reduced by 91%, enabling precise tracking and efficient processing of user modification behavior, ensuring version control and consistency of configuration data, and optimizing storage and operational efficiency.
[0055] If it is necessary to manage the version code corresponding to the target virtual branch created by the target user, the target update data can be merged into the snapshot data. Optionally, in the software version management method provided in this application embodiment, merging the target update data into the snapshot data includes: determining whether there is a conflict between the target update data and the snapshot data; if there is a conflict between the target update data and the snapshot data, issuing a prompt message, wherein the prompt message includes the conflict data between the target update data and the snapshot data; if there is no conflict between the target update data and the snapshot data, merging the target update data into the snapshot data.
[0056] In some embodiments, modified configuration item key values are compared between the main branch snapshot data and the target update data. Changes are quickly located using hash digests through key-value level difference analysis. If a configuration item is modified in both the main branch snapshot and the target update data, and these modifications conflict (e.g., different modified values or incompatible modification logic), a conflict is identified; otherwise, no conflict is identified. When a conflict is detected, the system issues a notification to the administrator or target user. The notification may include the specific conflicting configuration item key value and the conflicting modified value, allowing for manual intervention. If there is no conflict between the target update data and the snapshot data, the system automatically merges the target update data into the snapshot data, generating an integrated configuration view.
[0057] For example, a difference comparison technique can employ a comparison algorithm: based on key-value level difference analysis (not file-level), using hash digests to quickly locate changes. After the main branch is updated, a new snapshot, snapshot_124, is generated. The system traverses all sub-branches and calculates the difference rate between base_snapshot and snapshot_124. The conflict handling logic is as follows:
[0058]
[0059] For low-conflict scenarios, differences are automatically merged (e.g., newly added configuration items have no conflicts), reducing manual intervention by 70%. For high-conflict scenarios, the administrator is notified via email with conflict details (e.g., config.item1 has been modified in both the main branch and branches).
[0060] This embodiment automatically merges data in conflict-free situations, preventing potential data corruption and ensuring data integrity and consistency in the virtual branch system. In conflict situations, the system provides detailed conflict information and a manual confirmation process to ensure the controllability and accuracy of data changes. This improves storage efficiency and real-time operation, reduces operational complexity, and enhances the intelligence and flexibility of configuration management.
[0061] Virtual branches created by the target user can also be deleted. Optionally, in the software version management method provided in this application embodiment, after obtaining the target virtual branch created by the target user from the virtual branch management system, the method further includes: if a deletion request for the target virtual branch is detected by the target user, deleting the target metadata in the virtual branch management layer of the virtual branch management system based on the deletion request; and deleting the incremental patch file of the target virtual branch in the physical storage layer of the virtual branch management system.
[0062] In some embodiments, the user interface layer of the virtual branch management system receives a deletion request from a target user for a specific virtual branch, such as a target virtual branch. The system locates the metadata records associated with the target virtual branch in the virtual branch management layer. Then, it performs a deletion operation, completely removing the metadata of the target virtual branch. Next, the system moves to the physical storage layer and locates all incremental patch files associated with the target virtual branch. All incremental patch files associated with the target virtual branch are traversed and deleted, completely erasing the physical data of the virtual branch.
[0063] This embodiment provides a virtual branch deletion operation, which enables the virtual branch management system to effectively clean up unnecessary branches, release resources, maintain data integrity and consistency, reduce storage overhead, optimize resource allocation, simplify operation and maintenance processes, and improve the overall system robustness and flexibility.
[0064] The snapshot data of the main branch code pointed to by the target pointer can be obtained. Optionally, in the software version management method provided in this application embodiment, extracting the snapshot data of the main branch code from the virtual branch management system based on the target pointer includes: determining the version number of the main branch code pointed to by the target pointer; and extracting the snapshot data of the main branch code corresponding to the version number from the physical storage layer of the virtual branch management system based on the version number.
[0065] In some embodiments, the metadata record of the target virtual branch is parsed to obtain the target pointer `base_snapshot`, which points to a snapshot version of the main branch, such as `snapshot_123`, where 123 is the version number of the main branch code. The physical storage layer is searched for the main branch code snapshot data corresponding to version number 123. This snapshot data contains the complete configuration or code state of the main branch at a given moment. This snapshot data is then read and loaded.
[0066] This embodiment accurately locates and reads snapshot data of the main branch using a target pointer, laying a solid foundation for subsequent data processing. It achieves millisecond-level branch creation and on-demand loading, reducing storage costs, improving real-time operation, and ensuring data security and accurate version control.
[0067] When managing target software through a virtual branch management system, the main branch code needs to be stored first. Optionally, in the software version management method provided in this application embodiment, before obtaining the target virtual branch created by the target user from the virtual branch management system, the method further includes: obtaining the main branch code of the initial version of the software and storing the main branch code in the physical storage layer of the virtual branch management system.
[0068] In some embodiments, the initial version of the main branch code is checked out from the software's version control system. To store the main branch code in the physical storage layer of the virtual branch management system, a snapshot of the code needs to be generated. This transforms the main branch code into a static, fully recoverable version for easy storage and recovery. The generated snapshot of the main branch code is uploaded to the object storage service in the physical storage layer. During upload, the system assigns a unique identifier (e.g., snapshot_123) to the snapshot, which serves as the basis for subsequent virtual branch creation and data recovery.
[0069] This embodiment securely stores the main branch code of the initial version of the software in the physical storage layer of the virtual branch management system, making it the base point for all subsequent virtual branches. This provides the necessary data support for version control, ensuring efficient storage and data traceability.
[0070] It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions, and although a logical order is shown in the flowchart, in some cases the steps shown or described may be executed in a different order than that shown here.
[0071] Example 2
[0072] This application also provides a software version management device. It should be noted that the software version management device of this application can be used to execute the software version management method provided in this application. The software version management device provided in this application is described below.
[0073] According to an embodiment of this application, an apparatus for implementing the above-described software version management method is also provided. Figure 4 This is a schematic diagram of a software version management device provided according to an embodiment of this application, such as... Figure 4 As shown, the device includes:
[0074] The acquisition unit 401 is used to acquire the target virtual branch created by the target user from the virtual branch management system. The virtual branch management system is used to store the virtual branches created by the user. Each virtual branch represents the new version obtained after the user modifies the software version.
[0075] Extraction unit 402 is used to extract target pointer and target modification record from target metadata stored in target virtual branch. The target pointer is used to point to a snapshot of the main branch code, and the target modification record is a record of incremental code modifications made by the target user to the main branch code.
[0076] The first determining unit 403 is used to extract snapshot data of the main branch code from the virtual branch management system based on the target pointer, and to determine the target configuration items modified by the target user based on the target modification record;
[0077] Management unit 404 is used to extract target update data from the incremental patch file corresponding to the target configuration item from the virtual branch management system, merge the target update data into the snapshot data, obtain the configuration management data of the target software version corresponding to the target virtual branch, and manage the target software version based on the configuration management data.
[0078] The software version management device provided in this application embodiment obtains a target virtual branch created by a target user from a virtual branch management system through an acquisition unit 401. The virtual branch management system stores virtual branches created by the user, and each virtual branch represents a new version obtained after the user modifies the software version. An extraction unit 402 extracts a target pointer and a target modification record from the target metadata stored in the target virtual branch. The target pointer points to a snapshot of the main branch code, and the target modification record is a record of incremental code modifications made by the target user to the main branch code. A first determination unit 403 extracts snapshot data of the main branch code from the virtual branch management system based on the target pointer and determines the target configuration item modified by the target user based on the target modification record. A management unit 404 extracts target update data from the incremental patch file corresponding to the target configuration item from the virtual branch management system, merges the target update data into the snapshot data, and obtains the configuration management data of the target software version corresponding to the target virtual branch. The target software version is managed based on the configuration management data. By using lightweight metadata and pointer structures, full data copying when creating a branch is avoided, and storage overhead is greatly reduced. The construction of virtual branches involves only reading and writing metadata, without copying large amounts of data, which improves the efficiency of branch creation and reading. By generating configuration management data through incremental code modifications and merging them into the main branch code snapshot, even if multiple branches are operated on simultaneously, it will not affect the main branch code itself, thus achieving the goal of avoiding code conflicts. This achieves the technical effect of improving the flexibility of software version management, and solves the technical problem of code conflicts caused by manual merging of version code, which leads to chaotic version management.
[0079] Optionally, in the software version management device provided in this application embodiment, the device further includes: a receiving unit, configured to receive a virtual branch creation request from a target user through the user interface layer of the virtual branch management system, and create a target virtual branch in the virtual branch management system based on the virtual branch creation request; a generating unit, configured to generate a metadata record of the target virtual branch through the virtual branch management layer of the virtual branch management system, and associate the target virtual branch with a snapshot of the main branch code based on the metadata record, wherein the metadata record includes a target pointer and the initial state of the target virtual branch; and a first storage unit, configured to store incremental code modification data in an incremental patch file through the physical storage layer of the virtual branch management system when it is detected that the target user has modified the initial state.
[0080] Optionally, in the software version management device provided in this application embodiment, the first storage unit includes: a first determining module, used to determine the target configuration item modified by the target user, and load a snapshot of the main branch code based on the target pointer; a copying module, used to copy the original data corresponding to the target configuration item from the snapshot of the main branch code to the target storage space of the physical storage layer, modify the original data in the target storage space, and obtain the updated target data; and an updating module, used to generate a target modification record based on the updated target data, update the target modification record to the target metadata, and store the updated target data in the incremental patch file.
[0081] Optionally, in the software version management device provided in this application embodiment, the management unit 404 includes: a judgment module, used to judge whether there is a conflict between the target update data and the snapshot data; a prompting module, used to issue a prompting message when there is a conflict between the target update data and the snapshot data, wherein the prompting message includes conflicting data between the target update data and the snapshot data; and a merging module, used to merge the target update data into the snapshot data when there is no conflict between the target update data and the snapshot data.
[0082] Optionally, in the software version management device provided in the embodiments of this application, the device further includes: a first deletion unit, configured to delete the target metadata in the virtual branch management layer of the virtual branch management system based on the deletion request when a deletion request for the target virtual branch is detected by a target user; and a second deletion unit, configured to delete the incremental patch file of the target virtual branch in the physical storage layer of the virtual branch management system.
[0083] Optionally, in the software version management device provided in this application embodiment, the first determining unit 403 includes: a second determining module, used to determine the version number of the main branch code pointed to by the target pointer; and an extraction module, used to extract snapshot data of the main branch code corresponding to the version number from the physical storage layer of the virtual branch management system based on the version number.
[0084] Optionally, in the software version management device provided in the embodiments of this application, the device further includes: a second storage unit, used to obtain the main branch code of the initial version of the software and store the main branch code in the physical storage layer of the virtual branch management system.
[0085] It should be noted that the acquisition unit 401, extraction unit 402, first determination unit 403, and management unit 404 mentioned above correspond to steps S201 to S204 in Embodiment 1. The four units and their corresponding steps implement the same instances and application scenarios, but are not limited to the content disclosed in Embodiment 1. It should be noted that the above modules or units can be hardware or software components stored in memory (e.g., memory 104) and processed by one or more processors (e.g., processors 102a, 102b, ..., 102n). The above modules or units can also be part of a device and run in the computer terminal 10 provided in Embodiment 1.
[0086] Example 3
[0087] Embodiments of this application may provide an electronic device. Figure 5 This is a structural block diagram of an electronic device according to an embodiment of this application. Figure 5 As shown, the electronic device may include: one or more ( Figure 5 Only one of the components is shown: processor 502, memory 504, memory controller, and peripheral interface, wherein the peripheral interface is connected to the radio frequency module, audio module, and display.
[0088] The memory can be used to store software programs and modules, such as the program instructions / modules corresponding to the methods and apparatus in the embodiments of this application. The processor executes various functional applications and data processing by running the software programs and modules stored in the memory, thereby implementing the above-described methods. The memory may include high-speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory may further include memory remotely located relative to the processor, and these remote memories can be connected to the terminal via a network. Examples of such networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof.
[0089] The processor can access information and applications stored in memory via a transmission device to perform the following steps: Obtain the target virtual branch created by the target user from the virtual branch management system, where the virtual branch management system stores user-created virtual branches, each representing a new version obtained after the user modifies the software version; extract the target pointer and target modification records from the target metadata stored in the target virtual branch, where the target pointer points to a snapshot of the main branch code, and the target modification records are records of incremental code modifications made by the target user to the main branch code; extract snapshot data of the main branch code from the virtual branch management system based on the target pointer, and determine the target configuration items modified by the target user based on the target modification records; extract target update data from the incremental patch file corresponding to the target configuration items from the virtual branch management system, merge the target update data into the snapshot data to obtain configuration management data for the target software version corresponding to the target virtual branch, and manage the target software version based on the configuration management data.
[0090] The processor can also access information and applications stored in memory via a transmission device to perform the following steps: receiving a virtual branch creation request from a target user through the user interface layer of the virtual branch management system, and creating a target virtual branch in the virtual branch management system based on the virtual branch creation request; generating a metadata record for the target virtual branch through the virtual branch management layer of the virtual branch management system, and associating the target virtual branch with a snapshot of the main branch code based on the metadata record, wherein the metadata record contains a target pointer and the initial state of the target virtual branch; and storing the incremental code modification data in an incremental patch file through the physical storage layer of the virtual branch management system if the target user is detected to have modified the initial state.
[0091] The processor can also access information and applications stored in memory via a transmission device to perform the following steps: determine the target configuration item modified by the target user, load a snapshot of the main branch code based on the target pointer; copy the original data corresponding to the target configuration item from the snapshot of the main branch code to the target storage space in the physical storage layer, modify the original data in the target storage space to obtain the updated target data; generate a target modification record based on the updated target data, update the target modification record to the target metadata, and store the updated target data in the incremental patch file.
[0092] The processor can also call the information and application stored in the memory through the transmission device to perform the following steps: determine whether there is a conflict between the target update data and the snapshot data; if there is a conflict between the target update data and the snapshot data, issue a prompt message, wherein the prompt message contains the conflicting data between the target update data and the snapshot data; if there is no conflict between the target update data and the snapshot data, merge the target update data into the snapshot data.
[0093] The processor can also invoke information and applications stored in memory via a transmission device to perform the following steps: upon detecting a deletion request from a target user for a target virtual branch, delete the target metadata in the virtual branch management layer of the virtual branch management system based on the deletion request; delete the incremental patch file of the target virtual branch in the physical storage layer of the virtual branch management system.
[0094] The processor can also access information and applications stored in memory via a transmission device to perform the following steps: determine the version number of the main branch code pointed to by the target pointer; and extract snapshot data of the main branch code corresponding to the version number from the physical storage layer of the virtual branch management system based on the version number.
[0095] The processor can also access information and applications stored in memory via a transmission device to perform the following steps: obtain the main branch code of the initial version of the software, and store the main branch code in the physical storage layer of the virtual branch management system.
[0096] This application provides a method for obtaining a target virtual branch created by a target user from a virtual branch management system. The virtual branch management system stores user-created virtual branches, each representing a new version of the software after modification by the user. Target pointers and target modification records are extracted from the target metadata stored in the target virtual branch. The target pointer points to a snapshot of the main branch code, and the target modification record records incremental code modifications made by the target user to the main branch code. Based on the target pointer, snapshot data of the main branch code is extracted from the virtual branch management system. Based on the target modification record, the target configuration items modified by the target user are determined. Target update data corresponding to the target configuration items is extracted from the incremental patch file of the virtual branch management system. The target update data is merged into the snapshot data to obtain configuration management data for the target software version corresponding to the target virtual branch. The target software version is then managed based on this configuration management data. By using lightweight metadata and pointer structures, full data copying during branch creation is avoided, significantly reducing storage overhead. The construction of virtual branches involves only reading and writing metadata, without copying large amounts of data, which improves the efficiency of branch creation and reading. By generating configuration management data through incremental code modifications and merging them into the main branch code snapshot, even if multiple branches are operated on simultaneously, it will not affect the main branch code itself, thus achieving the goal of avoiding code conflicts. This achieves the technical effect of improving the flexibility of software version management, and solves the technical problem of code conflicts caused by manual merging of version code, which leads to chaotic version management.
[0097] Those skilled in the art will understand that Figure 5 The structure shown is for illustrative purposes only. Electronic devices can also be smartphones, tablets, handheld computers, mobile internet devices (MIDs), PADs, and other terminal devices. Figure 5 This does not limit the structure of the aforementioned electronic device. For example, electronic devices may also include components that are more... Figure 5 The more or fewer components shown (such as network interfaces, display devices, etc.), or having the same Figure 5 The different configurations shown.
[0098] Those skilled in the art will understand that all or part of the steps in the various methods of the above embodiments can be implemented by a program instructing the hardware related to the terminal device. The program can be stored in a computer-readable storage medium, which may include: flash drive, read-only memory (ROM), random access memory (RAM), disk or optical disk, etc.
[0099] Example 4
[0100] Embodiments of this application also provide a storage medium. Optionally, in this embodiment, the storage medium can be used to store the program code executed by the software version management method provided in Embodiment 1.
[0101] Optionally, in this embodiment, the storage medium may be located in any computer terminal in a group of computer terminals in a computer network, or in any mobile terminal in a group of mobile terminals.
[0102] This application also provides a computer program product that, when executed on a data processing device, is suitable for performing software version management method steps.
[0103] The sequence numbers of the embodiments in this application are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments.
[0104] In the above embodiments of this application, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions of other embodiments.
[0105] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. The device embodiments described above are merely illustrative; for example, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the displayed or discussed mutual coupling, direct coupling, or communication connection may be through some interfaces; the indirect coupling or communication connection between units or modules may be electrical or other forms.
[0106] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0107] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.
[0108] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as a USB flash drive, read-only memory (ROM), random access memory (RAM), portable hard drive, magnetic disk, or optical disk.
[0109] The above description is only a preferred embodiment of this application. It should be noted that for those skilled in the art, several improvements and modifications can be made without departing from the principle of this application, and these improvements and modifications should also be considered within the scope of protection of this application.< / timestamp>
Claims
1. A software version management method, characterized in that, include: The target virtual branch created by the target user is obtained from the virtual branch management system, wherein the virtual branch management system is used to store the virtual branches created by the user, and each virtual branch is used to represent the new version obtained after the user modifies the software version; Extract the target pointer and target modification record from the target metadata stored in the target virtual branch, wherein the target pointer is used to point to a snapshot of the main branch code, and the target modification record is a record of incremental code modifications made by the target user to the main branch code; Based on the target pointer, the snapshot data of the main branch code is extracted from the virtual branch management system, and the target configuration items modified by the target user are determined based on the target modification record; The target update data corresponding to the target configuration item is extracted from the incremental patch file of the virtual branch management system, and the target update data is merged into the snapshot data to obtain the configuration management data of the target software version corresponding to the target virtual branch. The target software version is managed based on the configuration management data.
2. The method according to claim 1, characterized in that, Before retrieving the target virtual branch code created by the target user from the virtual branch management system, the method further includes: The virtual branch creation request from the target user is received through the user interface layer of the virtual branch management system, and the target virtual branch is created in the virtual branch management system based on the virtual branch creation request. The virtual branch management layer of the virtual branch management system generates a metadata record for the target virtual branch, and the target virtual branch is associated with a snapshot of the main branch code based on the metadata record. The metadata record contains a target pointer and the initial state of the target virtual branch. If the target user is detected to have modified the initial state, the incremental code modification data is stored in the incremental patch file through the physical storage layer of the virtual branch management system.
3. The method according to claim 2, characterized in that, The process of storing incremental code modification data to incremental patch files through the physical storage layer of the virtual branch management system includes: Determine the target configuration item modified by the target user, and load a snapshot of the main branch code based on the target pointer; Copy the original data corresponding to the target configuration item from the snapshot of the main branch code to the target storage space of the physical storage layer, modify the original data in the target storage space, and obtain the updated target data; The target modification record is generated based on the updated target data, and the target modification record is updated in the target metadata. The updated target data is then stored in the incremental patch file.
4. The method according to claim 1, characterized in that, Merging the target update data into the snapshot data includes: Determine whether there is a conflict between the target updated data and the snapshot data; If there is a conflict between the target update data and the snapshot data, a prompt message is issued, wherein the prompt message contains the conflicting data between the target update data and the snapshot data; If there is no conflict between the target update data and the snapshot data, the target update data will be merged into the snapshot data.
5. The method according to claim 1, characterized in that, After obtaining the target virtual branch created by the target user from the virtual branch management system, the method further includes: If a deletion request from the target user for the target virtual branch is detected, the target metadata in the virtual branch management layer of the virtual branch management system is deleted based on the deletion request; Delete the incremental patch file of the target virtual branch in the physical storage layer of the virtual branch management system.
6. The method according to claim 1, characterized in that, The snapshot data of the main branch code extracted from the virtual branch management system based on the target pointer includes: Determine the version number of the main branch code pointed to by the target pointer; Based on the version number, the snapshot data of the main branch code corresponding to the version number is extracted from the physical storage layer of the virtual branch management system.
7. The method according to claim 1, characterized in that, Before retrieving the target virtual branch created by the target user from the virtual branch management system, the method further includes: Obtain the main branch code of the initial version of the software and store the main branch code in the physical storage layer of the virtual branch management system.
8. A software version management device, characterized in that, include: The acquisition unit is used to acquire the target virtual branch created by the target user from the virtual branch management system, wherein the virtual branch management system is used to store the virtual branches created by the user, and each virtual branch is used to represent the new version obtained after the user modifies the software version; The extraction unit is used to extract a target pointer and a target modification record from the target metadata stored in the target virtual branch. The target pointer is used to point to a snapshot of the main branch code, and the target modification record is a record of incremental code modifications made by the target user to the main branch code. The first determining unit is used to extract snapshot data of the main branch code from the virtual branch management system based on the target pointer, and to determine the target configuration item modified by the target user based on the target modification record; The management unit is used to extract target update data from the incremental patch file corresponding to the target configuration item from the virtual branch management system, merge the target update data into the snapshot data to obtain the configuration management data of the target software version corresponding to the target virtual branch, and manage the target software version based on the configuration management data.
9. An electronic device, characterized in that, include: Memory, which stores executable programs; A processor for running the program, wherein the program executes the software version management method according to any one of claims 1 to 7 when it runs.
10. A computer program product comprising computer instructions, characterized in that, When the computer instructions are executed by the processor, they implement the steps of the software version management method according to any one of claims 1 to 7.