A code version management method and management system
Through the synchronization of the client and the server and the distributed version control system Git, the inconsistency and complexity of code version management in software development are solved, real-time sharing of code and two-way version control are realized, and development efficiency and security are improved.
Patent Information
- Application Number
- CN202110468505.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-04-28
- Publication Date
- 2024-10-22
- Estimated Expiration
- 2041-04-28
AI Technical Summary
During the software development process, due to simultaneous editing and modification of the same project file by multiple developers, code versions are inconsistent, redundant, difficult to trace, and complex to integrate. There is a lack of timely updating and real-time tracking of historical versions of the code.
The client regularly synchronizes the code update status with the server, and sends reminder information to the client based on the update status to ensure timely update and submission of code versions. The distributed version control system Git is used for code management to achieve real-time sharing and historical versions of the code. tracking.
It solves the problems of code inconsistency, redundancy, difficulty in traceability and complex integration, improves development efficiency, realizes real-time sharing and two-way version control of code, and enhances security and reliability.
Smart Images

Figure CN113138794B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and more specifically, to a code version management method and management system. Background Art
[0002] Some software development projects require multiple developers to edit and modify one or more project files of the same project at the same time to achieve collaborative development. In the collaborative development process, the same or different parts of the same project file are edited and modified by multiple developers to form different code versions.
[0003] Due to the existence of multiple code versions, many problems are easily introduced in the software development process, such as code inconsistency, code redundancy, difficulty in code traceability, and high complexity of code integration. The solution to these problems depends on the timely updating of code versions.
[0004] Therefore, there is an urgent need for a method to timely update and track historical versions of codes in real time to achieve real-time sharing of codes and avoid the occurrence of the above problems while protecting the source code. Summary of the invention
[0005] The present application provides a code version management method and management system, in which the client periodically synchronizes the code update status with the server, and sends reminders to the client through the server so that the code can be updated in time and submitted to the server, thereby ensuring the update speed of the code version, solving the problems of code inconsistency, code redundancy, difficulty in code tracing, and high complexity of code integration, and improving development efficiency.
[0006] The present application provides a code version management method, including: receiving a code update status of a client; obtaining reminder information for the client according to the code update status; and sending reminder information corresponding to the client to the client.
[0007] Preferably, the code update status includes the current storage location of the updated code version and the submission identifier of the updated code version.
[0008] Preferably, obtaining reminder information for the client according to the code update status includes: if the submission mark of the updated code version indicates that it has not been submitted, generating a submission reminder.
[0009] Preferably, obtaining reminder information for the client according to the code update status further includes: if the current storage location of the updated code version is a work area, generating a first storage reminder, the first storage reminder indicating that the updated code version is stored in a cache area.
[0010] Preferably, obtaining reminder information for the client according to the code update status further includes: if the current storage location of the updated code version is a cache area, generating a second storage reminder, the second storage reminder indicating that the updated code version is stored in the warehouse area.
[0011] Preferably, the method further comprises: if the submission mark of the updated code version indicates that it has been submitted, displaying code update information.
[0012] The present application also provides a code version management system, including a server and multiple clients; the server is respectively connected to the multiple clients for communication, and the server executes the above-mentioned code version management method; the client obtains the code update status and sends it to the server.
[0013] Preferably, the client includes a work area, a cache area and a warehouse area; the code update status includes the current storage location of the updated code version and the submission identifier of the updated code version, and the current storage area is the work area, the cache area or the warehouse area.
[0014] Preferably, the client further comprises a first display unit, which displays the current storage area of the updated code version.
[0015] Preferably, the management system further includes a code version storage, and the code version storage is a distributed version control system.
[0016] Other features and advantages of the present application will become apparent from the following detailed description of exemplary embodiments of the present application with reference to the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] The accompanying drawings, which are incorporated in and constitute a part of the specification, illustrate embodiments of the application and, together with the description, serve to explain the principles of the application.
[0018] Figure 1 A diagram of the management system for the code version provided for this application;
[0019] Figure 2 This is a data transmission principle diagram of a code version management system of an embodiment provided by the present application;
[0020] Figure 3 It is a flowchart of the code version management method provided by this application;
[0021] Figure 4 It is a flowchart of a code version management method according to an embodiment of the present application. DETAILED DESCRIPTION
[0022] Various exemplary embodiments of the present application will now be described in detail with reference to the accompanying drawings. It should be noted that unless otherwise specifically stated, the relative arrangement of components and steps, numerical expressions and numerical values set forth in these embodiments do not limit the scope of the present application.
[0023] The following description of at least one exemplary embodiment is merely illustrative in nature and is in no way intended to limit the present application, its application, or uses.
[0024] Technologies, methods, and equipment known to ordinary technicians in the relevant art may not be discussed in detail, but where appropriate, the technologies, methods, and equipment should be considered part of the specification.
[0025] In all examples shown and discussed herein, any specific values should be interpreted as merely exemplary and not limiting. Therefore, other examples of the exemplary embodiments may have different values.
[0026] Embodiment 1
[0027] This application provides a code version management system. Figure 1 As shown, the code version management system includes a server, a code version storage, and multiple clients (only one client is shown in the figure).
[0028] The code version storage is used to store various versions of the code to facilitate code tracing and calling.
[0029] Preferably, the code version storage uses a distributed version control system Git. Version control is a system that records content modifications of one or more files or codes and can query changes to a specific version. It can perform version control on any type of project files or codes, facilitating collaborative development by different developers. As an open source distributed version control system, Git has been widely used due to its convenience and efficiency. Many traditional non-open source projects have gradually begun to use Git to manage versions of project files or codes. Git uses distributed version control, and distributed clients can not only extract the latest version of the file snapshot, but also mirror the entire code repository. Therefore, no matter which server fails, any other mirror can be used to restore the local client's warehouse area. Each cloning operation from the server to the local client is equivalent to a complete backup of the local client's warehouse area. For efficiency, if the project file or code is not modified, Git generally only adds data to the Git database, and most operations are performed locally, and the use of the branch function further ensures that a specific stable version of the code can be safely saved, so that code maintainers can modify the code with confidence.
[0030] On the basis of the above, if Figure 1 As shown, the client includes a work area, a cache area, a warehouse area, a code update status module and a first display unit. The client can be operated by a developer or a manager. The developer uses the client to edit, modify and other update operations on the code, and stores the updated code version in the cache area (for example, through an add operation), and the code in the cache area is stored in the warehouse area irregularly or regularly (for example, through a commit operation). As an embodiment, the storage method of the code version in the warehouse area is the same as Git.
[0031] Managers can view the code updates of developers through the client, which is convenient for managing development projects. At the same time, the client can obtain a complete code version from the server (for example, through a clone operation) and copy a code version (for example, through a fetch operation) to the repository area of the local client, or directly pull a code version from the server to the workspace to merge the code. As an embodiment, in a clone operation, a code version (for example, a code or code branch not stored in the local client) is copied to the local client, and a new code or code branch with the same name as the server is saved in the repository area. As an embodiment, in a fetch operation, the latest code version of the server is pulled to the local client, and the client operator decides whether to merge it into the corresponding code or code branch in the local client after checking the latest code version.
[0032] As an embodiment, the code update status module is a timed resident service in the client backend (eg, the code-status module of the client). Figure 1 As shown, the code update status module is connected to the warehouse area, cache area and work area, and it regularly checks the code update status, code update log, code storage status and code submission status in the local client directory, obtains the current storage location of the updated code version and the submission identifier of the updated code version, forms the code update status and sends the code update status to the server. Among them, the current storage area is the work area, cache area or warehouse area.
[0033] The first display unit provides a display for the client to facilitate the operation of the client. In the present application, preferably, the first display unit displays the code update status, so that the operator can intuitively understand the update status of the code in the local client, such as the current storage location of the updated code version, whether the updated code version has been submitted to the server, etc.
[0034] As an embodiment, the first display unit highlights the local code updates. As an embodiment, for the code or code branch cloned from the server, a new code or code branch with the same name as the server is created in the repository area of the local client. The code or code branch is opened from the work area to be consistent with the repository area. Once it is modified, the updated code version will be temporarily stored in the cache area, and the updated code version will be submitted to the local repository using the client commit operation. As a result, the updated code version exists in three storage states: work area, cache area, and warehouse area. The client displays the code update based on these three storage states, using different colors to distinguish them, and displaying them in a dynamic highlighting manner. This method implements local code version control.
[0035] At the same time, the local client can create new code or code branches and submit them to the server, so that all project managers and developers can share code versions, simplifying the code version control of the local client and server.
[0036] More preferably, the first display unit displays the reminder information sent by the server to the local client (described in detail below).
[0037] Preferably, the first display unit is provided with trigger modules of multiple functions (for example, buttons or touch areas of different functions, etc.), and the client operator only needs to turn on the trigger module of the corresponding function on the first display unit to manage the code. Specifically, as an embodiment, the functions that can be implemented by the trigger module include code pulling, code uploading, code merging, code submission, code branch management, code status query, etc.
[0038] It is understandable that the client also has other functions and modules known in the prior art, which will not be described in detail here.
[0039] The server is connected to multiple clients and code version storage. Figure 1 As shown, the server includes a statistical reminder module and a second display unit.
[0040] The statistical reminder module receives the code update status of each client, analyzes and counts the code update status, obtains reminder information for each client, and sends reminder information corresponding to the client to facilitate the client to save and submit the updated code version in time after receiving the reminder information.
[0041] As an embodiment, the server reminds the client by sending an email.
[0042] The server receives the updated code version submitted by the client (eg, through a push operation), and sends the updated code version to the code version storage for storage.
[0043] Preferably, for the updated code version that has been submitted to the server, the server displays the code update information through the second display unit. As an embodiment, the code update information indicates the update mark of the code, for example, the update marks of different codes or different code branches are displayed in different colors, or the update marks of different codes or different code branches are displayed in the form of a list. The visualization of the code update information helps the server operator understand and grasp the development progress of all clients, and provides a convenient way to manage the development project.
[0044] More preferably, the server further includes a code submission tracking module, which is used to obtain the updated content, update time, update personnel, etc. of the code version in response to a tracking query request for code submission records initiated by the server operator through the server operation interface, the project manager or the developer through the client operation interface. The query result of the code submission tracking module is displayed through the second display unit of the server or the first display unit of the client. The code submission tracking module can realize efficient query of the code version and facilitate the management and utilization of the code version.
[0045] When the client needs to obtain a certain code version, the server calls the code version from the code version storage and sends it to the client, making it convenient for the client to pull the entire code version, merge a certain code version, etc.
[0046] It is understandable that the server also has other functions and modules known in the prior art, which will not be described in detail here.
[0047] It is understandable that the interaction between the server and the client can also implement other functions, such as creating a new branch (such as a branch operation), deleting a file (such as a rm operation), merging branches (such as a merge operation), and so on.
[0048] Based on the above management system, such as Figure 2 As shown, the present application provides a data transmission principle of a management system of an embodiment.
[0049] As an embodiment, the client and the server communicate via the http protocol.
[0050] like Figure 2As shown, the client (such as a project manager or developer) sends an http request to the server, which includes a code version submission request, a code version acquisition request, a query request, and other requests. The server forwards the http request to the lightweight reverse proxy server Workhorse through the http protocol. Workhorse uploads and downloads the http request. The http request for Git package download is directly processed by calling the command parser git-shell. Git-shell processes Git commands and modifies the authorized keys list. For other requests, Workhorse forwards the request to the hosting server Unicorn through the http protocol for processing. Unicorn is the hosting server of the Git Rails framework and processes requests that Workhorse cannot process. The results of the http request processed by git-shell and Unicorn are returned to the server and client according to the original path.
[0051] Specifically, git-shell submits requests to the Git database through the http protocol and downloads code version data from the Git database through the SSH protocol. SSH authentication ensures the legitimacy of the SSH server, effectively avoids "man-in-the-middle" attacks, and ensures the security of the code version.
[0052] The code update status module of the client sends the code update status to the server through an http request and receives the information processing result.
[0053] As an embodiment, the server in this application is a web server. As an example, the web server is an Nginx server.
[0054] In the embodiment using Git, compared with the prior art, the server side of the present application can view the code updates of the client side in real time, which is beneficial for the project manager to control the client side in real time, so the present application realizes two-way version control.
[0055] Embodiment 2
[0056] The present application also provides a method for managing the code version on the server side matching the first embodiment. Figure 3 As shown, the management method includes the following steps:
[0057] S110: Receive a code update status from the client, where the code update status includes a current storage location of the updated code version and a submission identifier of the updated code version.
[0058] S120: Obtain reminder information for the client according to the code update status. Figure 4and corresponding description to illustrate the step.
[0059] S130: Send reminder information corresponding to the client to the client.
[0060] Figure 4 FIG. 1 is a flow chart of a method for managing a code version on a server side according to an embodiment of the present application. Figure 4 As shown, the management method includes the following steps:
[0061] S410: Receive the code update status of the client Please understand this step in conjunction with the description of the first embodiment and S310.
[0062] It should be noted that S420, S450 and S470 may be executed sequentially or simultaneously.
[0063] S420: Determine whether the submission mark of the updated code version indicates that it is not submitted. If so, execute S430; otherwise, execute S440.
[0064] S430: Generate a submission reminder, and then execute S490.
[0065] S440: Displaying the code update information on the second display unit of the server. As an embodiment, the code update information indicates the identification of the code update, for example, by displaying the update identification of different codes or different code branches in different colors, or by displaying the update identification of different codes or different code branches in the form of a list. The visualization of the code update information helps the server operator understand and grasp the development progress of all clients, and provides a convenient way to manage the development project.
[0066] S450: Determine whether the current storage location of the updated code version is a workspace. If so, execute S460.
[0067] S460: Generate a first storage reminder, the first storage reminder instructing to store the updated code version in the cache area. Then execute S490.
[0068] S470: Determine whether the current storage location of the updated code version is a cache area. If so, execute S480.
[0069] S480: Generate a second storage reminder, the second storage reminder instructing to store the updated code version in the warehouse area. Then execute S490.
[0070] S490: Send reminder information corresponding to the client to the client, the reminder information including the submission reminder generated in S430, the first storage reminder generated in S460, and the second storage reminder generated in S480.
[0071] The beneficial effects of this application are as follows:
[0072] 1. In this application, the client can see the historical record of the server-side code, and the server can also see the historical record of the client-side code, realizing two-way version control, facilitating the tracking and recording of historical versions in cross-regional multi-person collaborative development, and better managing project files or codes. While protecting the source code, it reduces the burden on developers, saves time, reduces human errors, improves development efficiency, and greatly enhances security, reliability, and availability.
[0073] 2. This application uses the server's statistical reminder module to detect the client's code submission and storage status, count and remind code updates, and realize the server-side control of the client's code submission.
[0074] Although some specific embodiments of the present application have been described in detail by way of example, it should be understood by those skilled in the art that the above examples are only for illustration, not for limiting the scope of the present application. It should be understood by those skilled in the art that the above embodiments may be modified without departing from the scope and spirit of the present application. The scope of the present application is defined by the appended claims.
Claims
1. A code version management method, It is characterized in that Applicable to servers, including: Receive the client's code update status; Obtaining reminder information for the client according to the code update status; Sending reminder information corresponding to the client to the client; The code update status includes the current storage location of the updated code version and the submission identifier of the updated code version. The server receives the updated code version submitted by the client. For the updated code version submitted to the server, the server displays the code update information through the second display unit, and the code update information indicates the code update identifier. The current storage area is a work area, a cache area or a warehouse area; The obtaining reminder information for the client according to the code update status includes: If the submission mark of the updated code version indicates that it has not been submitted, generating a submission reminder; If the current storage location of the updated code version is the work area, generating a first storage reminder, the first storage reminder instructing to store the updated code version in the cache area; If the current storage location of the updated code version is the cache area, a second storage reminder is generated, wherein the second storage reminder indicates that the updated code version is stored in the warehouse area.
2. A code version management system, It is characterized in that Includes a server and multiple clients; The server is respectively connected to the plurality of clients for communication, and the server executes the code version management method according to claim 1; The client obtains the code update status and sends it to the server; The client includes a work area, a buffer area and a warehouse area; The code update status includes the current storage location of the updated code version and the submission identifier of the updated code version, and the current storage area is a work area, a cache area or a warehouse area.
3. The management system according to claim 2, It is characterized in that The client further includes a first display unit configured to display a current storage area of the updated code version.
4. The management system according to claim 2, It is characterized in that The management system further includes a code version storage, which is a distributed version control system.
