CN117608641A - Code synchronization method and device - Google Patents

Code synchronization method and device Download PDF

Info

Publication number
CN117608641A
CN117608641A CN202311628484.XA CN202311628484A CN117608641A CN 117608641 A CN117608641 A CN 117608641A CN 202311628484 A CN202311628484 A CN 202311628484A CN 117608641 A CN117608641 A CN 117608641A
Authority
CN
China
Prior art keywords
code
merging
conflict
branch
storage warehouse
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202311628484.XA
Other languages
Chinese (zh)
Inventor
康铎
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Agricultural Bank of China
Original Assignee
Agricultural Bank of China
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Agricultural Bank of China filed Critical Agricultural Bank of China
Priority to CN202311628484.XA priority Critical patent/CN117608641A/en
Publication of CN117608641A publication Critical patent/CN117608641A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/70Software maintenance or management
    • G06F8/71Version control; Configuration management
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/27Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Databases & Information Systems (AREA)
  • Computer Security & Cryptography (AREA)
  • Computing Systems (AREA)
  • Data Mining & Analysis (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The application discloses a code synchronization method and a device, when detecting that the code of a preset branch changes under a code storage warehouse of a production running system, the preset branch can be pulled to a local code storage warehouse, and then the code combination can be carried out on the preset branch and a parallel branch in the code storage warehouse of a parallel verification system based on a code combination instruction. By the method, code variation can be automatically detected, and code combination can be automatically completed according to the code combination instruction without manual operation. Meanwhile, when code conflict occurs in the merging process, the corresponding target branch can be selected according to the conflict configuration file, and the code conflict can be solved, so that the code merging is completed, and the code conflict is not required to be manually solved. Therefore, the code sum can be automatically completed through the code merging instruction, and the code conflict in the code merging process can be solved according to the conflict configuration file, so that the processing efficiency of the code synchronous merging process is improved.

Description

Code synchronization method and device
Technical Field
The present disclosure relates to the field of big data technologies, and in particular, to a code synchronization method and apparatus.
Background
The core system of the commercial bank at present generally comprises a production running system and a parallel verification system, wherein the production running system and the corresponding parallel verification system respectively use different code storage warehouses, when a project is put into production, the codes of the code storage warehouses of the production running system are firstly synchronized into the code storage warehouses of the parallel verification system, the parallel verification system is put into production after being adapted and modified, and the production running system is put into production after the parallel verification system is successfully verified.
Because the parallel verification system and the production running system are not completely consistent, codes in the parallel verification system and codes in the production running system are different, and the parallel verification system and the production running system need to be adapted and modified after synchronization. And code collisions may occur during the synchronous merging process.
However, currently, in the process of synchronous merging of codes, it is generally dependent on manually executing a code merging command and manually resolving code conflicts, which results in low processing efficiency of the process of synchronous merging of codes.
Disclosure of Invention
In view of this, the embodiments of the present application provide a method and apparatus for code synchronization, which aim to improve the processing efficiency of the code synchronization combining process.
In a first aspect, an embodiment of the present application provides a code synchronization method, where the method includes:
detecting codes of a preset branch under a code storage warehouse of a production running system in a preset time period, and pulling the preset branch to a local code storage warehouse when the codes change;
based on the code merging instruction, carrying out code merging on the preset branches and parallel branches in a code storage warehouse of a parallel verification system;
when code conflict occurs in the code merging process, selecting a corresponding target branch according to a conflict configuration file to obtain parallel branches after the code merging; the conflict configuration file is obtained after code synchronization is carried out according to a code storage warehouse of the production running system and a code storage warehouse of the parallel verification system.
Optionally, under the code storage warehouse of the production running system in the preset time period, detecting a code of a preset branch, when the code changes, pulling the preset branch to a local code storage warehouse, and before the step of pulling the preset branch to the local code storage warehouse, further includes:
synchronizing codes in a code storage warehouse of a production running system to a code storage warehouse of a parallel verification system, and adjusting the code storage warehouse of the parallel verification system to obtain an adjusted code storage warehouse of the parallel verification system;
creating a merging ignore file and a conflict configuration file based on the adjusted code storage warehouse of the parallel verification system; the merge ignore file includes the configuration file of the adjusted parallel validation system.
Optionally, the method further comprises:
and in the process of merging codes, running the merging neglected file.
Optionally, detecting a code of a preset branch under a code storage warehouse of a production running system in a preset time period, and pulling the preset branch to a local code storage warehouse when the code changes, including:
and detecting codes of a preset branch in a code storage warehouse of the production running system in a preset time period through a timing task, and pulling the preset branch to a local code storage warehouse when the codes change.
Optionally, based on the code merging instruction, the code merging the preset branch and the parallel branch in the code storage warehouse of the parallel verification system further includes:
and switching the preset branch to a parallel branch in a code storage warehouse of the parallel verification system.
Optionally, when a code conflict occurs in the process of merging the codes, selecting a corresponding target branch according to a conflict configuration file to obtain parallel branches after merging the codes, including:
when code conflict occurs in the code merging process, a conflict file list is obtained;
inquiring in the conflict configuration file according to the conflict file list to obtain an inquiry result;
and when the query result is that the query is successful, selecting a corresponding target branch to obtain parallel branches after the codes are combined.
Optionally, the method further comprises:
and when the query result is that the query is unsuccessful, sending the conflict file list to a developer.
In a second aspect, an embodiment of the present application provides a code synchronization apparatus, including:
the detection module is used for detecting codes of a preset branch under a code storage warehouse of the production operation system in a preset time period, and pulling the preset branch to a local code storage warehouse when the codes change;
the merging module is used for merging the codes of the branches and the parallel branches in the code storage warehouse of the parallel verification system based on the code merging instruction;
the selection module is used for selecting a corresponding target branch according to the conflict configuration file when the code conflict occurs in the code merging process, and obtaining parallel branches after the code merging; the conflict configuration file is obtained after code synchronization is carried out according to a code storage warehouse of the production running system and a code storage warehouse of the parallel verification system.
In a third aspect, an embodiment of the present application provides a code synchronization device, including:
a memory for storing a computer program;
a processor configured to execute the computer program to cause the apparatus to perform the code synchronization method of the foregoing first aspect.
In a fourth aspect, embodiments of the present application provide a computer storage medium, where a computer program is stored, and when the computer program is executed, a device running the computer program implements the code synchronization method described in the foregoing first aspect.
Compared with the prior art, the embodiment of the application has the following beneficial effects:
the embodiment of the application provides a code synchronization method and a code synchronization device, in the method, under a code storage warehouse of a production running system in a preset time period, codes of preset branches are detected, and when the codes change, the preset branches are pulled to a local code storage warehouse. And based on the code merging instruction, merging the parallel branches in the code storage warehouse of the branch and parallel verification system. When code conflict occurs in the process of code merging, a corresponding target branch is selected according to a conflict configuration file, parallel branches after code merging are obtained, and the conflict configuration file is obtained after code synchronization is carried out according to a code storage warehouse of a production running system and a code storage warehouse of a parallel verification system.
Therefore, when the code of the preset branch is detected to change under the code storage warehouse of the production running system, the preset branch can be pulled to the local code storage warehouse, and then the code combination can be carried out on the preset branch and the parallel branch in the code storage warehouse of the parallel verification system based on the code combination instruction. By the method, code variation can be automatically detected, and code combination can be automatically completed according to the code combination instruction without manual operation. Meanwhile, when code conflict occurs in the merging process, the corresponding target branch can be selected according to the conflict configuration file, and the code conflict can be solved, so that the code merging is completed, and the code conflict is not required to be manually solved. Therefore, the code sum can be automatically completed through the code merging instruction, and the code conflict in the code merging process can be solved according to the conflict configuration file, so that the processing efficiency of the code synchronous merging process is improved.
Drawings
In order to more clearly illustrate the present embodiments or the technical solutions in the prior art, the drawings that are required for the embodiments or the description of the prior art will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the present application, and that other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
Fig. 1 is an application scenario schematic diagram of a code synchronization method provided in an embodiment of the present application;
fig. 2 is a flowchart of a code synchronization method provided in an embodiment of the present application;
FIG. 3 is a flowchart of another code synchronization method according to an embodiment of the present application;
fig. 4 is a schematic structural diagram of a code synchronization device according to an embodiment of the present application.
Detailed Description
In order to make the present application solution better understood by those skilled in the art, the following description will clearly and completely describe the technical solution in the embodiments of the present application with reference to the accompanying drawings in the embodiments of the present application, and it is apparent that the described embodiments are only some embodiments of the present application, not all embodiments. All other embodiments, which can be made by one of ordinary skill in the art without undue burden from the present disclosure, are within the scope of the present disclosure.
The production running system refers to a core system used by banks in daily business, namely a production system for truly serving clients, such as transaction processing, account management, payment, settlement and the like. The parallel verification system is a parallel verification system of a distributed core system, and is not used for directly serving clients, and the actual transaction flow is copied to the parallel verification system through a technical means to perform closed operation and verification. The parallel verification system is used for verifying the validity and correctness of the production running system, is usually managed by operation and maintenance personnel of a bank, and can also use simulated transaction data and real data for testing.
Because the parallel verification system and the production running system are not completely consistent, such as a database table, a downstream server, business logic and the like, codes in the parallel verification system and codes in the production running system are different, and the parallel verification system needs to be adapted and modified after synchronization, for example, the parallel verification system is subjected to adjustment of the business logic level. In addition, code conflict can occur in the synchronous merging process, and the code conflict can be put into production for use only by manual intervention.
However, currently, in the process of synchronous merging of codes, it is generally dependent on manually executing a code merging command and manually resolving code conflicts, which results in low processing efficiency of the process of synchronous merging of codes.
Based on this, in order to solve the above-mentioned problem, in the embodiment of the present application, when detecting that the code of the preset branch changes under the code storage warehouse of the production running system, the preset branch may be pulled to the local code storage warehouse first, and then the parallel branch in the code storage warehouse of the preset branch and the parallel verification system may be code-combined based on the code combining instruction. By the method, code variation can be automatically detected, and code combination can be automatically completed according to the code combination instruction without manual operation. Meanwhile, when code conflict occurs in the merging process, the corresponding target branch can be selected according to the conflict configuration file, and the code conflict can be solved, so that the code merging is completed, and the code conflict is not required to be manually solved. Therefore, the code sum can be automatically completed through the code merging instruction, and the code conflict in the code merging process can be solved according to the conflict configuration file, so that the processing efficiency of the code synchronous merging process is improved.
For example, one of the scenarios of the embodiments of the present application may be applied to the scenario shown in fig. 1. The scenario includes a terminal 101 and a server 102, wherein the terminal 101 is configured to display a code storage repository of a production running system and a code storage repository of a parallel verification system, and the server 102 detects code variation by adopting an implementation manner provided in the embodiment of the present application, automatically completes code merging according to a code merging instruction, and selects a corresponding target branch according to a conflict configuration file, so as to solve a code conflict.
First, in the above application scenario, although the description of the actions of the embodiments provided in the embodiments of the present application is performed by the server 102; however, the embodiment of the present application is not limited in terms of execution subject, as long as the actions disclosed in the embodiments provided by the embodiment of the present application are executed.
Second, the above scenario is only one example of a scenario provided in the embodiments of the present application, and the embodiments of the present application are not limited to this scenario.
The following describes in detail, by way of embodiments, specific implementation manners of a code synchronization method and apparatus in the embodiments of the present application with reference to the accompanying drawings.
Referring to fig. 2, the flowchart of a code synchronization method provided in the embodiment of the present application, with reference to fig. 2, may specifically include:
s201: detecting the codes of the preset branches under a code storage warehouse of the production running system in a preset time period, and pulling the preset branches to a local code storage warehouse when the codes change.
In one possible implementation manner, the code storage warehouse may be a git warehouse, which is an open-source distributed version control system, and the git warehouse is a storage warehouse for storing codes, and includes a plurality of directories and source code files, which are used for distinguishing different systems and projects and may include a plurality of branches. The git command refers to an instruction set which interacts with the git and is used for managing files stored in a git warehouse. The Git branch refers to different versions of code snapshots.
Before the code combination is performed for the first time by using the method provided by the embodiment of the application, the generated git warehouse code of the running system needs to be manually synchronized into the git warehouse of the parallel verification system, and then the git warehouse of the parallel verification system is adapted and modified, specifically, the git warehouse of the parallel verification system can be subjected to logic adjustment in terms of application service, and the adjusted git warehouse of the parallel verification system can be obtained.
At present, during each synchronous merging, the git warehouse of the parallel verification system needs to be adapted and modified, and as the git warehouse of the parallel verification system is adjusted, during the next synchronous merging, the situation that the adjusted file content is covered by the file of the git warehouse of the production running system may occur.
Thus, after the adjustment is completed, two files need to be created under the root directory of the git repository of the parallel validation system, merging the ignore file and the conflict configuration file.
The Gitatttributes contains the relevant files of the adjusted parallel verification system configuration file, application configuration file, k8s arranging file and the like which are only used in the parallel verification environment. Because the merging neglected file is independently created after the parallel verification system is adjusted, the file change in the git warehouse from the production running system can be neglected in the synchronous merging process of the subsequent codes, and the influence of the next synchronous merging of the codes is avoided.
The conflict configuration file contains a policy file list of a git warehouse adopting a production running system or a git warehouse adopting a parallel verification system when code conflict occurs, and is generally a business logic source code file.
However, in the prior art, the code variation in the git warehouse of the production running system cannot be automatically detected, and only after the git warehouse of the production running system is changed, the code combination is performed manually.
In one possible implementation manner, in the embodiment of the present application, the code synchronization combination is implemented by using an open source interpreted programming language python, firstly, a timing task may be encoded by python, and the code of a preset branch under the git warehouse of the production running system in a preset time period may be automatically detected, and when the code under the preset branch changes, the preset branch under the git warehouse of the production running system is pulled into the local code storage warehouse.
By way of example, by means of the python encoded timing task, the commit record check command git log-online may be executed in a specific branch under the git repository of the production run system within a preset time frame, so that the submitted code may be detected, whether the commit ID of the specific branch changes may be compared with the commit Identification (ID) of the specific branch, and when the commit ID under the specific branch changes, it is indicated that the code submitted under the specific branch changes, so that the specific branch under the production run system may be pulled to the local git repository.
S202: and based on the code merging instruction, carrying out code merging on the preset branch and the parallel branch in a code storage warehouse of the parallel verification system.
In one possible implementation, the git repository of the production run system and the git repository of the parallel validation system may be added locally by adding the local repository command git remote add [ repository name ] before pulling the preset branch to the local git repository. The bin name refers to the git bin name added to the production run system and the git bin name of the parallel validation system.
Then, the remote branch command, namely the gate warehouse name of the production running system where the preset branch is located, can be pulled, namely the latest preset branch in the gate warehouse of the production running system can be pulled to the local gate warehouse by pulling the remote branch command.
And finally, executing a detected branch command gitcheck out [ parallel branch ], wherein the parallel branch refers to a preset branch of a parallel verification system git warehouse needing to be combined, and switching the preset branch into the parallel branch needing to be subjected to code synchronous combination through detecting the branch command. After the switching is completed, a code merging command gitmerger [ production branch ] may be executed, so that code merging of a preset branch and a parallel branch may be realized.
The code change of the production operation system git warehouse is automatically detected, the code combination instruction is automatically synchronized to the parallel verification system git warehouse, manual operation is not needed, the code is only submitted to the production operation system git warehouse in the actual application process, the processing efficiency in the code synchronous combination process is improved, the manpower resources are saved, and the possibility of human errors is reduced.
S203: when code conflict occurs in the process of code merging, a corresponding target branch is selected according to a conflict configuration file, parallel branches after code merging are obtained, and the conflict configuration file is obtained after code synchronization is carried out according to a code storage warehouse of a production running system and a code storage warehouse of a parallel verification system.
In the process of merging codes, the situation of code conflict can occur, wherein the code conflict refers to that when two branches with common ancestors are merged, the same row of codes in the same file are simultaneously modified, the conflict can occur, and the code merging can be completed only after the conflict is resolved. In the prior art, the conflict files are edited and solved manually in sequence.
In the merging process, a merging neglect file can be firstly operated, and the merging neglect file contains the configuration file of the adjusted parallel verification system, so that in the code merging process, the operation of the merging neglect file can neglect file modification from a git warehouse of a production operation system, the configuration of the adjusted parallel verification git warehouse is ensured not to be influenced by the code merging, the completed adaptation modification in the git warehouse of the parallel verification system is protected, and the adaptation adjustment on the git warehouse of the parallel verification system is not required to be repeated each time.
In one possible implementation, when a code conflict occurs, a list of conflicting files is obtained by obtaining the file status command git status. The conflict file list is used for recording the positions of code conflicts and the codes with the conflicts. And then, inquiring in the conflict configuration file according to the conflict file list, so as to obtain an inquiring result.
If the query result is that the query is successful, that is, the code representing the conflict occurrence recorded in the conflict file list, a corresponding solution can be found in the conflict configuration file, that is, a corresponding target branch can be selected according to the policy file list in the conflict configuration file. In this case, if the conflict configuration file describes a git repository of the parallel verification system, a parallel branch may be selected.
Specifically, the conflict may be resolved by executing a resolve conflict command gitcheck out [ conflict filename ] -the hands or the outer. The conflicting file name refers to the conflicting file name in the obtained conflicting file list. After the conflict is resolved in this way, the code combination can be completed, and the parallel branches after the code combination can be obtained. The conflict generated in the merging process can be automatically solved through the conflict configuration file, the processing efficiency in the merging process is improved, the manpower resources are saved, and the possibility of manpower errors is reduced.
If the query result is that the query fails, whether the conflict file list contains files which are not existed in the conflict configuration files or not can be continuously checked, if so, the conflict file list can be sent to a developer, and the conflict can be manually resolved. As an example, when the query result is a query failure, the developer may be sent a list of conflicting files in the form of mail, or be notified of a manual resolution of the code conflict in the form of a short message to ensure that the code merging process is completed smoothly.
The above is a code synchronization method provided in the embodiments of the present application, in which, under a code storage warehouse of a production running system in a preset time period, a code of a preset branch is detected, and when the code changes, the preset branch is pulled to a local code storage warehouse. And based on the code merging instruction, merging the parallel branches in the code storage warehouse of the branch and parallel verification system. When code conflict occurs in the process of code merging, a corresponding target branch is selected according to a conflict configuration file, parallel branches after code merging are obtained, and the conflict configuration file is obtained after code synchronization is carried out according to a code storage warehouse of a production running system and a code storage warehouse of a parallel verification system.
Therefore, when the code of the preset branch is detected to change under the code storage warehouse of the production running system, the preset branch can be pulled to the local code storage warehouse, and then the code combination can be carried out on the preset branch and the parallel branch in the code storage warehouse of the parallel verification system based on the code combination instruction. By the method, code variation can be automatically detected, and code combination can be automatically completed according to the code combination instruction without manual operation. Meanwhile, when code conflict occurs in the merging process, the corresponding target branch can be selected according to the conflict configuration file, and the code conflict can be solved, so that the code merging is completed, and the code conflict is not required to be manually solved. Therefore, the code sum can be automatically completed through the code merging instruction, and the code conflict in the code merging process can be solved according to the conflict configuration file, so that the processing efficiency of the code synchronous merging process is improved.
Referring to fig. 3, fig. 3 is a flowchart of another code synchronization method, in this embodiment of the present application, the code synchronization method may be implemented by a code change detection module, a code pull merging module, a code conflict resolution module, and a code conflict feedback module, where the modules call up a git command through python coding, so as to implement code synchronization merging.
And when the code synchronization is performed for the first time, manually synchronizing the code in the git warehouse of the production operation system into the git warehouse of the parallel verification system, and then performing adaptation transformation on the git warehouse of the parallel verification system. After the transformation is completed, a merging ignore file and a conflict configuration file are created under a git warehouse of the parallel verification system.
And then in the code fluctuation detection module, a timing task coded by python can be called, a git command for checking the submitted record is executed under an instruction branch of a production and operation system git warehouse, whether the submitted ID of a designated branch fluctuates is compared, if the submitted ID fluctuates, the code under the designated branch changes, and the code pulling and merging module can be executed.
In the code pulling and merging module, a production running system git warehouse and a parallel verification system git warehouse are all added to the local firstly through adding a git command of the local warehouse. The newly designated branch under the production run system git warehouse is then pulled locally by pulling the far-end branch's git command. Finally, the code merging can be completed by detecting the git command of the branch, switching the appointed branch to the parallel branch and executing the git command of the code merging.
The code conflict resolution module is used for resolving code conflicts in the merging process, merging neglected files configured in a parallel verification system git warehouse in advance can be operated in the merging process, and then a git command for acquiring file states can be adopted to acquire a conflict file list when the code conflicts occur, so that searching can be carried out in the conflict configuration files configured in advance. If the searching is successful, executing the git command for resolving the conflict according to the strategy file list of the conflict configuration file, and resolving the code conflict.
The code conflict feedback module is used for checking the conflict configuration file and the conflict file list after the execution of the code conflict resolution module is completed, and checking whether files which are not contained in the conflict configuration file exist or not, if so, the content recorded in the conflict file list cannot be completely resolved by depending on the conflict configuration file. At this point, the list of conflicting files may be sent to the developer to manually resolve the remaining code conflicts. And finally, executing a code pushing command git push [ parallel warehouse ] [ parallel branch ], pushing parallel branches which complete synchronous combination of codes in the git warehouse of the local parallel verification system to the git warehouse of the remote parallel verification system, and thus completing code pushing.
In the embodiment of the application, the automatic code synchronization between the two warehouses based on the git is realized, and the processing efficiency in the code synchronization merging process is improved. And through the code change detection module, after the appointed branch under the git warehouse of the production running system receives code submission, the code change is automatically detected. And then, automatically merging the designated branch under the git warehouse of the production running system to the designated branch under the git warehouse of the parallel verification system, namely the parallel branch by a code pulling merging module. And code conflict in the merging process can be automatically solved through a code conflict resolution module by a conflict configuration file, and the adaptation in a git warehouse of the parallel verification system is reserved. The unresolved conflict can be fed back to an issuer for manual resolution through a code conflict feedback module, so that the success of final code combination is ensured.
The foregoing provides some specific implementations of the code synchronization method for the embodiments of the present application, and based on this, the present application further provides a corresponding apparatus. The apparatus provided in the embodiments of the present application will be described from the viewpoint of functional modularization.
Referring to fig. 4, which is a schematic structural diagram of a code synchronization apparatus 400 provided in an embodiment of the present application, the apparatus 400 may include:
the detection module 401 is configured to detect a code of a preset branch under a code storage warehouse of a production running system in a preset time period, and pull the preset branch to a local code storage warehouse when the code changes;
a merging module 402, configured to perform code merging on the preset branch and a parallel branch in a code storage repository of a parallel verification system based on a code merging instruction;
a selection module 403, configured to select a corresponding target branch according to a conflict configuration file when a code conflict occurs in a code merging process, and obtain a parallel branch after the code merging; the conflict configuration file is obtained after code synchronization is carried out according to a code storage warehouse of the production running system and a code storage warehouse of the parallel verification system.
In this embodiment of the present application, through cooperation among the detection module 401, the merging module 402, and the selection module 403, when a change of a code of a preset branch under a code storage warehouse of a production running system is detected, the preset branch may be pulled to a local code storage warehouse first, and then, based on a code merging instruction, a code merging may be performed on a parallel branch in the preset branch and a code storage warehouse of a parallel verification system. By the method, code variation can be automatically detected, and code combination can be automatically completed according to the code combination instruction without manual operation. Meanwhile, when code conflict occurs in the merging process, the corresponding target branch can be selected according to the conflict configuration file, and the code conflict can be solved, so that the code merging is completed, and the code conflict is not required to be manually solved. Therefore, the code sum can be automatically completed through the code merging instruction, and the code conflict in the code merging process can be solved according to the conflict configuration file, so that the processing efficiency of the code synchronous merging process is improved.
As an embodiment, the detection module 401 further includes:
the adjusting unit is used for synchronizing codes in the code storage warehouse of the production running system to the code storage warehouse of the parallel verification system, adjusting the code storage warehouse of the parallel verification system and obtaining the adjusted code storage warehouse of the parallel verification system;
the creation unit is used for creating a merging ignore file and a conflict configuration file based on the adjusted code storage warehouse of the parallel verification system; the merge ignore file includes the configuration file of the adjusted parallel validation system.
As an embodiment, the code synchronization device 400 further includes:
and the operation unit is used for operating the merging neglected file in the code merging process.
As one embodiment, the detection module 401 includes:
the detection unit is used for detecting codes of the preset branches under a code storage warehouse of the production running system in a preset time period through a timing task, and pulling the preset branches to a local code storage warehouse when the codes change.
As an embodiment, the merging module 402 further includes:
and the switching unit is used for switching the preset branch to the parallel branch in the code storage warehouse of the parallel verification system.
As one embodiment, the selection module 403 includes:
the acquisition unit is used for acquiring a conflict file list when code conflict occurs in the code merging process;
the query unit is used for querying in the conflict configuration file according to the conflict file list to obtain a query result;
and the selection unit is used for selecting a corresponding target branch when the query result is that the query is successful, and obtaining parallel branches after the code combination.
As an embodiment, the code synchronization device 400 further includes:
and the sending unit is used for sending the conflict file list to a developer when the query result is that the query is unsuccessful.
The embodiment of the application also provides corresponding equipment and a computer storage medium, which are used for realizing the scheme provided by the embodiment of the application.
The device comprises a memory and a processor, wherein the memory is used for storing a computer program, and the processor is used for executing the computer program to enable the device to execute the code synchronization method according to any embodiment of the application.
The computer storage medium stores a computer program, and when the code is executed, a device executing the computer program implements the code synchronization method according to any embodiment of the present application.
The "first" and "second" in the names of "first", "second" (where present) and the like in the embodiments of the present application are used for name identification only, and do not represent the first and second in sequence.
From the above description of embodiments, it will be apparent to those skilled in the art that all or part of the steps of the above described example methods may be implemented in software plus general hardware platforms. Based on such understanding, the technical solutions of the present application may be embodied in the form of a software product, which may be stored in a storage medium, such as a read-only memory (ROM)/RAM, a magnetic disk, an optical disk, or the like, including several instructions for causing a computer device (which may be a personal computer, a server, or a network communication device such as a router) to perform the methods described in the embodiments or some parts of the embodiments of the present application.
It should be noted that, in the present specification, each embodiment is described in a progressive manner, and identical and similar parts of each embodiment are all referred to each other, and each embodiment is mainly described in a different point from other embodiments. In particular, for the device embodiments, since they are substantially similar to the method embodiments, the description is relatively simple, and reference is made to the description of the method embodiments for relevant points. The apparatus embodiments described above are merely illustrative, wherein elements illustrated as separate elements may or may not be physically separate, and elements illustrated as elements may or may not be physical elements, may be located in one place, or may be distributed over a plurality of network elements. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment. Those of ordinary skill in the art will understand and implement the present invention without undue burden.
The foregoing is merely one specific embodiment of the present application, but the protection scope of the present application is not limited thereto, and any changes or substitutions that can be easily conceived by those skilled in the art within the technical scope of the present application should be covered in the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.

Claims (10)

1. A method of code synchronization, the method comprising:
detecting codes of a preset branch under a code storage warehouse of a production running system in a preset time period, and pulling the preset branch to a local code storage warehouse when the codes change;
based on the code merging instruction, carrying out code merging on the preset branches and parallel branches in a code storage warehouse of a parallel verification system;
when code conflict occurs in the code merging process, selecting a corresponding target branch according to a conflict configuration file to obtain parallel branches after the code merging; the conflict configuration file is obtained after code synchronization is carried out according to a code storage warehouse of the production running system and a code storage warehouse of the parallel verification system.
2. The method according to claim 1, wherein detecting the code of the preset branch under the code storage warehouse of the production running system in the preset time period, and pulling the preset branch to the local code storage warehouse when the code changes, further comprises:
synchronizing codes in a code storage warehouse of a production running system to a code storage warehouse of a parallel verification system, and adjusting the code storage warehouse of the parallel verification system to obtain an adjusted code storage warehouse of the parallel verification system;
creating a merging ignore file and a conflict configuration file based on the adjusted code storage warehouse of the parallel verification system; the merge ignore file includes the configuration file of the adjusted parallel validation system.
3. The method according to claim 2, wherein the method further comprises:
and in the process of merging codes, running the merging neglected file.
4. The method according to claim 1, wherein detecting the code of the preset branch under the code storage repository of the production running system in the preset time period, and pulling the preset branch to the local code storage repository when the code changes, comprises:
and detecting codes of a preset branch in a code storage warehouse of the production running system in a preset time period through a timing task, and pulling the preset branch to a local code storage warehouse when the codes change.
5. The method of claim 1, wherein the code merging the preset branch and the parallel branch in the code storage repository of the parallel verification system based on the code merging instruction further comprises, before:
and switching the preset branch to a parallel branch in a code storage warehouse of the parallel verification system.
6. The method according to claim 1, wherein when a code conflict occurs in the code merging process, selecting a corresponding target branch according to a conflict configuration file to obtain parallel branches after code merging, includes:
when code conflict occurs in the code merging process, a conflict file list is obtained;
inquiring in the conflict configuration file according to the conflict file list to obtain an inquiry result;
and when the query result is that the query is successful, selecting a corresponding target branch to obtain parallel branches after the codes are combined.
7. The method of claim 6, wherein the method further comprises:
and when the query result is that the query is unsuccessful, sending the conflict file list to a developer.
8. A code synchronization device, the device comprising:
the detection module is used for detecting codes of a preset branch under a code storage warehouse of the production operation system in a preset time period, and pulling the preset branch to a local code storage warehouse when the codes change;
the merging module is used for merging codes of the preset branches and parallel branches in a code storage warehouse of the parallel verification system based on the code merging instruction;
the selection module is used for selecting a corresponding target branch according to the conflict configuration file when the code conflict occurs in the code merging process, and obtaining parallel branches after the code merging; the conflict configuration file is obtained after code synchronization is carried out according to a code storage warehouse of the production running system and a code storage warehouse of the parallel verification system.
9. A code synchronization device, the device comprising:
a memory for storing a computer program;
a processor for executing the computer program to cause the apparatus to perform the code synchronization method of any one of claims 1 to 7.
10. A computer storage medium, characterized in that the computer storage medium has stored therein a computer program which, when executed by a processor, implements the code synchronization method according to any one of claims 1 to 7.
CN202311628484.XA 2023-11-30 2023-11-30 Code synchronization method and device Pending CN117608641A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311628484.XA CN117608641A (en) 2023-11-30 2023-11-30 Code synchronization method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311628484.XA CN117608641A (en) 2023-11-30 2023-11-30 Code synchronization method and device

Publications (1)

Publication Number Publication Date
CN117608641A true CN117608641A (en) 2024-02-27

Family

ID=89955871

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311628484.XA Pending CN117608641A (en) 2023-11-30 2023-11-30 Code synchronization method and device

Country Status (1)

Country Link
CN (1) CN117608641A (en)

Similar Documents

Publication Publication Date Title
CN111176983A (en) Code conflict resolution system, method, device, equipment and medium
CN111857880B (en) Dialogue configuration item information management method, device, equipment and storage medium
CN109787858B (en) Method and terminal for issuing services in batches
CN111459800B (en) Method, device, equipment and medium for verifying availability of service system
CN112148614B (en) Regression testing method and device
CN115220779A (en) Code base management method and device and computer medium
CN111949311B (en) Gray level release method and system
WO2021262283A1 (en) Reduced processing loads via selective validation specifications
CN117608641A (en) Code synchronization method and device
CN113918162A (en) Front-end code automatic checking method based on centralized management mode
CN112256365B (en) Method and terminal for automatically managing multi-language versions
CN113157307A (en) Software version upgrading method and device
CN116739397B (en) Dynamic management method for new energy indexes
CN113886223A (en) Code test management method and device, computer equipment and readable storage medium
CN117785270A (en) Version delivery information checking method and device, processor and electronic equipment
CN117234580A (en) Version library merging method based on SVN
CN118300970A (en) Method, device, equipment and storage medium for executing operation on network element
CN114020315A (en) Project information synchronization method and device
CN118069197A (en) Software development management and control method and device, electronic equipment and readable storage medium
CN117931775A (en) Data migration external table management method, device, equipment, storage medium and product
CN113342779A (en) Project updating method and device and computer readable storage medium
CN117931643A (en) Code verification method, device, equipment and storage medium
CN118035072A (en) Automatic acceptance method and system based on multi-version upgrading
CN118051256A (en) Code branch management method, device, equipment, storage medium and product
CN116954637A (en) Gray scale issuing method, device, terminal equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination