Git warehouse management method and device, equipment and storage medium
By using the window graphical interface in git warehouse management to output triggerable buttons, each button is associated with a script file encapsulated with git instructions, which solves the problem of error-prone users' manual input of instructions and improves the efficiency and accuracy of git warehouse management .
Patent Information
- Application Number
- CN202410869940.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-01
- Publication Date
- 2024-11-01
AI Technical Summary
In the prior art, relying on users to manually input git instructions is prone to errors and affecting efficiency.
The triggerable buttons are output through the window graphical interface. Each button is associated with a script file. The script file contains git instructions. The target script file is executed in response to the button triggering operation. The user only needs to trigger the button to execute the corresponding git instructions.
It reduces the complexity of git warehouse management operations, improves efficiency, reduces erroneous operations caused by human factors, and improves the accuracy and reliability of operations.
Smart Images

Figure CN118885205A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computers, and in particular to a git repository management method, device, equipment and storage medium. Background Art
[0002] In modern software development, the git system is widely used in code management and collaborative development of software versions. The git system saves historical versions of the code, allowing developers to easily trace back code changes and compare them. At the same time, the git system also provides a variety of git commands, such as add, delete, commit, branch, merge, etc., to meet different development needs.
[0003] However, for beginners who are not familiar with the git system, these git commands may seem too complicated and easy to make mistakes when entering. Summary of the invention
[0004] The present application provides a git repository management method, device, equipment and storage medium to solve the technical problem in the prior art that the git command is simply relied on by the user to be manually input, which is prone to errors and affects efficiency.
[0005] In a first aspect, the present application provides a git repository management method, characterized in that the method comprises:
[0006] Outputting at least one triggerable button through a window graphical interface, each of the buttons being associated with a script file, wherein the script file encapsulates a git command;
[0007] In response to the triggering operation of the button, the target script file is executed to execute the git instructions encapsulated in the target script file on the target git repository, and the target script file is the script file associated with the triggered button.
[0008] In a possible implementation, in response to the triggering operation on the button, executing the target script file to execute the git instructions encapsulated in the target script file on the target git repository includes:
[0009] In response to the triggering operation of the button, locating the git instruction from the target script file;
[0010] When it is determined that the located git command needs to input parameters, at least one input control is output through the window graphical interface;
[0011] Obtaining input content in the at least one input control;
[0012] The input content is filled into the git instruction located from the target script file as an input parameter, and the target script file filled with the input content is executed on the target git repository.
[0013] In a possible implementation, in response to the triggering operation on the button, executing the target script file to execute the git instructions encapsulated in the target script file on the target git repository includes:
[0014] In response to the triggering operation of the plurality of buttons and the execution order set by the user for the triggered plurality of buttons, the plurality of target script files are executed sequentially according to the execution order, so as to sequentially execute the git instructions encapsulated in each of the target script files on the target git repository.
[0015] In a possible implementation, in response to the triggering operation on the button, executing the target script file to execute the git instructions encapsulated in the target script file on the target git repository includes:
[0016] In response to the triggering operation of the button and the execution times set by the user for the triggered button, the target script file is repeatedly executed according to the execution times, so as to execute the git instructions encapsulated in the target script file for multiple times on the target git repository.
[0017] In a possible implementation, the method further includes:
[0018] Outputting a custom script function area via the window graphical interface;
[0019] Obtain the git command entered in the custom script function area;
[0020] Fill the git command input in the custom script function area into the preset script template to obtain a custom script file encapsulating the git command;
[0021] A button is generated in the window graphical interface, and the generated button is associated with the custom script file.
[0022] In a possible implementation manner, before filling the git command input in the custom script function area into the preset script template to obtain the custom script file encapsulating the git command, the method further includes:
[0023] Verify the legitimacy of the git command entered in the custom script function area;
[0024] When it is determined that the git command input in the custom script function area is legal, the step of filling the git command input in the custom script function area into a preset script template is performed to obtain a custom script file encapsulating the git command;
[0025] When it is determined that the git command input in the custom script function area is illegal, a corresponding prompt message is output.
[0026] In a possible implementation, the method further includes:
[0027] Execute a preset conflict check script file according to a set period, wherein the conflict check script file encapsulates a git instruction for performing branch code merge conflict check on the target git repository;
[0028] When it is found that there is a branch code merge conflict in the target git repository, a corresponding prompt message is output.
[0029] In a second aspect, the present application provides a git repository management device, the device comprising:
[0030] An interface output module, used to output at least one triggerable button through a window graphical interface, each of the buttons is associated with a script file, and the script file encapsulates a git command;
[0031] The script execution module is used to respond to the triggering operation of the button and execute the target script file to execute the git instructions encapsulated in the target script file on the target git repository. The target script file is the script file associated with the triggered button.
[0032] In a possible implementation, the script execution module includes:
[0033] A positioning unit, configured to respond to a triggering operation on the button and locate a git instruction from a target script file;
[0034] A control output unit, configured to output at least one input control through the window graphical interface when it is determined that the located git command needs to input parameters;
[0035] An input unit, used to obtain input content in the at least one input control;
[0036] A filling unit is used to fill the input content as an input parameter into the git instruction located from the target script file, and execute the target script file filled with the input content on the target git repository.
[0037] In a possible implementation, the script execution module is specifically used to:
[0038] In response to the triggering operation of the plurality of buttons and the execution order set by the user for the triggered plurality of buttons, the plurality of target script files are executed sequentially according to the execution order, so as to sequentially execute the git instructions encapsulated in each of the target script files on the target git repository.
[0039] In a possible implementation, the script execution module is specifically used to:
[0040] In response to the triggering operation of the button and the execution times set by the user for the triggered button, the target script file is repeatedly executed according to the execution times, so as to execute the git instructions encapsulated in the target script file for multiple times on the target git repository.
[0041] In a possible implementation, the device further includes:
[0042] A custom area output module, used to output a custom script function area through the window graphical interface;
[0043] A custom input module, used to obtain the git instructions input in the custom script function area;
[0044] A script encapsulation module is used to fill the git instructions input in the custom script function area into a preset script template to obtain a custom script file encapsulating the git instructions;
[0045] The button generation module is used to generate a button in the window graphical interface and associate the generated button with the custom script file.
[0046] In a possible implementation, the device further includes:
[0047] A legality verification module, used for verifying the legality of the git instructions input in the custom script function area before filling the git instructions input in the custom script function area into a preset script template to obtain a custom script file encapsulating the git instructions;
[0048] The script encapsulation module is used to, when determining that the git command input in the custom script function area is legal, execute the step of filling the git command input in the custom script function area into a preset script template to obtain a custom script file encapsulating the git command;
[0049] The first prompt module is used to output corresponding prompt information when it is determined that the git command input in the custom script function area is illegal.
[0050] In a possible implementation, the device further includes:
[0051] A conflict checking module is used to execute a preset conflict checking script file according to a set period, wherein the conflict checking script file encapsulates a git instruction for performing branch code merge conflict checking on the target git repository;
[0052] The second prompt module is used to output corresponding prompt information when it is detected that there is a branch code merge conflict in the target git repository.
[0053] In a third aspect, the present application provides a device, comprising: at least one communication interface; at least one bus connected to the at least one communication interface; at least one processor connected to the at least one bus; at least one memory connected to the at least one bus, wherein the processor is configured to:
[0054] Outputting at least one triggerable button through a window graphical interface, each of the buttons being associated with a script file, wherein the script file encapsulates a git command;
[0055] In response to the triggering operation of the button, the target script file is executed to execute the git instructions encapsulated in the target script file on the target git repository, and the target script file is the script file associated with the triggered button.
[0056] In a fourth aspect, the present application also provides a computer storage medium storing computer executable instructions, wherein the computer executable instructions are used to execute the GIT repository management method described in any one of the above items of the present application.
[0057] The above technical solution provided by the embodiment of the present application has the following advantages over the prior art: the method provided by the embodiment of the present application outputs at least one triggerable button through a window graphical interface, each button is associated with a script file, git instructions are encapsulated in the script file, and in response to the triggering operation of the button, the target script file associated with the triggered button is executed to execute the git instructions encapsulated in the target script file on the target git repository. This realizes that when the user needs to perform management operations on the target git repository, he only needs to trigger the corresponding button in the window graphical interface to execute the corresponding git instructions on the target git repository, so that the user does not need to repeatedly memorize numerous git instructions and input git instructions, thereby greatly reducing the user's operational complexity of git repository management and improving the efficiency of git repository management. At the same time, since the encapsulation of git instructions reduces the manual operation links, it reduces the misoperation caused by human factors and improves the accuracy and reliability of the operation. BRIEF DESCRIPTION OF THE DRAWINGS
[0058] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0059] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0060] One or more embodiments are exemplarily described by pictures in the corresponding drawings, and these exemplified descriptions do not constitute limitations on the embodiments. Elements with the same reference numerals in the drawings represent similar elements, and unless otherwise stated, the figures in the drawings do not constitute proportional limitations.
[0061] Figure 1 A flowchart of an embodiment of a git repository management method provided in an embodiment of the present application;
[0062] Figure 2 It is an example of a window graphical interface;
[0063] Figure 3 A flowchart of an embodiment of a custom script file provided in an embodiment of the present application;
[0064] Figure 4 A block diagram of an embodiment of a git repository management device provided in an embodiment of the present application;
[0065] Figure 5 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0066] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of this application.
[0067] The disclosure below provides many different embodiments or examples to realize the different structures of the present application. In order to simplify the disclosure of the present application, the parts and settings of specific examples are described below. Of course, they are only examples, and the purpose is not to limit the present application. In addition, the present application can repeat reference numbers and / or letters in different examples. This repetition is for the purpose of simplification and clarity, and does not itself indicate the relationship between the various embodiments and / or settings discussed.
[0068] In order to solve the technical problem that the prior art simply relies on users to manually input git commands, which is prone to errors and affects efficiency, the present application provides a git repository management method, which can enable users to execute corresponding git commands on the target git repository by simply triggering the corresponding button in the window graphical interface, so that users do not need to repeatedly remember numerous git commands and input git commands, thereby greatly reducing the user's operational complexity of git repository management, improving the efficiency of git repository management, reducing misoperations caused by human factors, and improving the accuracy and reliability of operations.
[0069] Figure 1 This is a flowchart of an embodiment of a git repository management method provided in the present application. Figure 1 As shown, the process includes the following steps:
[0070] Step 101: output at least one triggerable button through a window graphical interface, each button is associated with a script file, and the script file encapsulates git instructions.
[0071] Step 102: In response to the triggering operation on the button, execute the target script file to execute the git instructions encapsulated in the target script file on the target git repository, where the target script file is the script file associated with the triggered button.
[0072] For ease of understanding, step 101 and step 102 are described in a unified manner as follows:
[0073] First of all, it is explained that the execution subject of the embodiment of the present application can be software, which can be installed in various electronic devices that support a display screen, including but not limited to smart phones, tablet computers, laptops, desktop computers, servers and other devices. The software refers to a program that provides git warehouse management services to users, which can be an application running in an independent process, a sub-application (applet) independent of the main page embedded in the client, a function running on a web browser (also known as WebApp), a small program embedded in an email, a file package, etc. It can be understood by those skilled in the art that, except for applications running in independent processes, other forms of programs do not need to install the client locally, which can avoid the inconvenience caused by installing the client.
[0074] In one embodiment, the triggerable button is a clickable button, wherein click includes single click or double click. Accordingly, the triggering operation on the button is a click operation on the button.
[0075] In another embodiment, the triggerable button is a draggable button. Accordingly, the triggering operation on the button is a dragging operation on the button. For example, the user can place the mouse cursor on the area where the button is located, then press the left mouse button and move the mouse to drag the button. Here, the button is moved to the instruction editing area on the window graphical interface by dragging the button.
[0076] See also Figure 2 , which is an example of a window graphical interface. Figure 2 The window graphical interface of the example includes two display areas, namely the button area and the command editing area. The button area includes multiple triggerable buttons, each button is associated with a script file, and the script file encapsulates git commands.
[0077] Among them, one or more git instructions may be encapsulated in a script file, and the embodiments of the present application do not impose specific restrictions on this.
[0078] Optionally, the button's display name is the git command encapsulated in its associated script file, for example Figure 2 In the example, assuming that the git command encapsulated in the script file of one of the buttons is the init command, the display name of the button can be "git init".
[0079] Optionally, when multiple git commands are encapsulated in a script file, the display name of the associated button can be the description information of the functions that the multiple git commands encapsulated in the script file are ultimately to implement. The embodiment of the present application does not specifically limit the display name of the button in the window graphical interface.
[0080] It can be seen that by applying the technical solution of the embodiment of the present application, the user only needs to name the script file or its associated button separately, without having to repeatedly remember numerous git commands. When the user needs to perform management operations on the target git repository, he only needs to trigger the corresponding button in the window graphical interface to execute the corresponding git command on the target git repository, which reduces the operational complexity of git repository management, so that people who are not very proficient in git can easily perform management operations on the target git repository.
[0081] In one embodiment, the git command is encapsulated using the win command standard programming language, and then a separate executable script file, ie, a .bat file, is generated in the win environment.
[0082] Specifically, in actual applications, git instructions are divided into two categories based on whether data needs to be passed in: one is read instructions that do not require incoming parameters, such as git init, git branch, git fetch and other git instructions; the other is write instructions that require incoming parameters, such as git checkout, git pull, git push and other git instructions. It can be understood by those skilled in the art that for write instructions that require incoming parameters, the incoming parameters are indispensable, and the incoming parameters are usually set by the user according to actual needs. Therefore, the technical solution of the embodiment of the present application adopts different implementation methods for two different types of git instructions:
[0083] First, for read commands that do not require input parameters, the functions of the git commands that need to be encapsulated can be implemented through the win command. Taking the git init command as an example, the following is an example of the corresponding script file:
[0084] @echo on
[0085] start"""D:\Git\git-bash.exe"-c"cd D: / workspace&&git init"
[0086] exit
[0087] Among them, @echo on enables command echo tracking execution results, the start"" command executes git-bash.exe in the computer directory, the cd command enters the project directory D: / workspace, and the git command to be executed this time is after &&. The exit command closes the command window.
[0088] Finally, change the suffix of the script document to .bat to obtain a script file that encapsulates the git init command.
[0089] Secondly, for write commands that require parameters to be passed in, you can use the Python write function to implement it. Taking the gitcheckout command as an example, the following is an example of the corresponding script file:
[0090] @echo on
[0091] start"""D:\Git\git-bash.exe"-c"cd D: / workspace&&git checkout**"
[0092] exit
[0093] Among them, ** indicates the parameter to be passed in. And ** will be completed in Python. Specifically, you can use the modify_file function in the following example to modify the value "**" in the script file:
[0094] modified_content=file_content.replace(**,replace_text);
[0095] Among them, replace_text is the input parameter entered by the user in the window graphical interface, which is captured and returned by the input() function. Finally, the original script file content is restored through the restore_file function.
[0096] As for the interpretation of other parts of the script file, please refer to the above description and will not be repeated here.
[0097] In one embodiment, each script file is encapsulated into a window graphical interface by Python syntax. Specifically, the basic functions of the python window program are realized by importing the Tkinter library, and then defining an execute_script function, which uses the subprocess module to execute the .bat script file passed to it. Then define a create_button function, which creates a button and associates it with a function that executes a specific script file. Finally, a window is created in the main function to add multiple buttons, each of which is associated with a .bat script file. When the user triggers a button in the window graphical interface, the corresponding script file will be executed.
[0098] The technical solution provided by the embodiment of the present application outputs at least one triggerable button through a window graphical interface, each button is associated with a script file, and git instructions are encapsulated in the script file. In response to the triggering operation of the button, the target script file associated with the triggered button is executed to execute the git instructions encapsulated in the target script file on the target git repository. This implements the function that when the user needs to perform management operations on the target git repository, the user only needs to trigger the corresponding button in the window graphical interface to execute the corresponding git instructions on the target git repository, so that the user does not need to repeatedly remember numerous git instructions and input git instructions, thereby greatly reducing the operational complexity of the user's git repository management and improving the efficiency of git repository management. At the same time, since the encapsulation of git instructions reduces the manual operation links, it reduces the misoperation caused by human factors and improves the accuracy and reliability of the operation.
[0099] Through the above Figure 1It can be seen from the relevant description of the process shown that there is a type of git instruction that requires input parameters, and the input parameters are indispensable and are usually set by the user according to actual needs. In this regard, in one embodiment, in response to the trigger operation of the button, the target script file is executed to execute the git instructions encapsulated in the target script file on the target git repository. The specific implementation includes: in response to the trigger operation of the button, the git instruction is located from the target script file, and when it is determined that the located git instruction needs to be input, at least one input control is output through the window graphical interface, and the input content in the at least one input control is obtained. The input content is filled into the git instruction located from the target script file as the input parameter, and the target script file filled with the input content is executed on the target git repository.
[0100] After locating the git command from the target script file, a preset command set (or command library) can be searched according to the located git command, which includes multiple standard git commands, as well as the command meaning and command type (indicating whether parameters need to be passed in) of each git command. In this way, it can be determined through the above search process whether the git command located from the target script file needs to be passed in parameters.
[0101] When it is determined that the located git command needs to pass in parameters, at least one input control is output through the window graphical interface. Here, the number of input controls can be determined by the number of parameters that need to be passed in. For example, if one parameter needs to be passed in, one input control is output through the window graphical interface. For another example, if two parameters need to be passed in, two input controls are output through the window graphical interface. Each input control is associated with an incoming parameter, so that the user can enter the corresponding parameter in the input control.
[0102] After the user inputs the corresponding parameters through the above input control, the user's input content is filled into the git command located from the target script file as the incoming parameter, and the target script file filled with the input content is executed on the target git repository.
[0103] For example, use the modify_file function in the following example to modify the value "**" in the script file:
[0104] modified_content=file_content.replace(**,replace_text);
[0105] Among them, replace_text is the input parameter entered by the user in the above input control, which is captured and returned by the input() function.
[0106] It should be noted that after the target script file filled with input content is executed in the target git repository, the original script file content is restored. For example, the original script file content is restored through the restore_file function. This process avoids actual operations from causing changes to the script file, thereby affecting subsequent use.
[0107] In an exemplary application scenario, the user wants to execute multiple git commands in a custom order or repeatedly execute one or several git commands. In this case, the technical solution of the embodiment of the present application does not need to re-edit the script file, and only requires the user to set the script file to be executed and the order of execution in the window graphical interface, or set the number of repeated executions.
[0108] Based on this, in one embodiment, responding to the triggering operation of a button, executing the target script file, and executing the git instructions encapsulated in the target script file on the target git repository. The specific implementation includes: responding to the triggering operation of multiple buttons, and the execution order set by the user for the triggered multiple buttons, and executing multiple target script files in sequence according to the execution order, so as to execute the git instructions encapsulated in each target script file in sequence on the target git repository.
[0109] Among them, as an optional implementation method, such as Figure 2 The button area also includes "connection lines" so that users can use connection lines to set the execution order of multiple script files. Figure 2 In the command editing area shown, the user can drag the button corresponding to the git command to be executed into the command editing area, and then connect different buttons by connecting lines to set the execution order of multiple script files to obtain an orderly script file execution process.
[0110] In practical applications, Python can be used to fill in the associated fixed codes between different script files, and multiple script files can be executed in sequence. This function can be implemented by methods such as index() and insert() in the Text component in Python, and this embodiment of the application will not be elaborated in detail.
[0111] In another embodiment, in response to the triggering operation of a button, executing the target script file, and the specific implementation of executing the git instructions encapsulated in the target script file on the target git repository includes: responding to the triggering operation of the button, and the number of executions set by the user for the triggered button, repeatedly executing the target script file according to the number of executions, so as to execute the git instructions encapsulated in the target script file on the target git repository multiple times.
[0112] Among them, as an optional implementation method, the user can first select the corresponding button in the button area, and then set the execution count of the target script file associated with the selected button through a pop-up window or input control. Here, the target script files can also be associated according to the execution count through the associated fixed code between the two script files provided by python, and then executed in sequence. Similarly, this function can be implemented by methods such as index() and insert() in the Text component in python, and this embodiment of the application will not be elaborated on in detail.
[0113] In addition, it is necessary to add that in actual application, the above two embodiments can occur at the same time, that is, the user can continuously execute multiple git commands in a custom order and repeatedly execute one or several git commands. As for the specific interface operation method, the embodiment of the present application does not limit it.
[0114] Through the above embodiments, the technical solution of the embodiments of the present application has strong adaptability and can meet some complex operating scenarios.
[0115] In addition to encapsulating basic git commands as script files, the technical solution of the embodiment of the present application also provides a customizable script editor to support users to add new git commands according to their own needs. Moreover, in the technical solution of the embodiment of the present application, there is no need for users to edit the script file themselves, but the fixed code required for generating the script has been written into the functional partition generated by the script in advance. The user only needs to fill in the git command he wants to add to automatically fill the git command added by the user into the vacant position corresponding to the fixed code, and write and generate a new script file through the python command bat_file.write(command+'\n').
[0116] Figure 3 This is a flowchart of an embodiment of a custom script file provided in the present application. Figure 3 As shown, the following steps are included:
[0117] Step 301: Output the custom script function area through the window graphical interface.
[0118] The above custom script ribbon includes an input control so that the user can enter the git instructions they want to add.
[0119] The fixed part of the implementation code of the above custom script function area is similar to the fixed part of the custom git command code, which leaves the workspace directory and git command to the user to customize. This part is defined as the generate_bat_script method in Python, the workspace directory is defined as directory, and the git command is defined as command.
[0120] Step 302: Get the git command entered in the custom script function area.
[0121] Step 303: Fill the git command input in the custom script function area into the preset script template to obtain a custom script file encapsulating the git command.
[0122] The preset script template includes the fixed codes required for generating the script described above.
[0123] In one embodiment, the custom script file is automatically named after the git instructions encapsulated therein.
[0124] Step 304: Generate a button in the window graphical interface, and associate the generated button with the custom script file.
[0125] The above steps 302 to 304 can be implemented by a preset Python program, and the embodiment of the present application will not give any examples of specific Python programs.
[0126] In addition, in one embodiment, in order to ensure the accuracy of the user-defined git instructions, before executing the above step 303 to fill the git instructions entered in the custom script function area into the preset script template to obtain the custom script file encapsulated with the git instructions, it also includes: verifying the legality of the git instructions entered in the custom script function area; if it is determined that the git instructions entered in the custom script function area are legal, then executing the step of filling the git instructions entered in the custom script function area into the preset script template to obtain the custom script file encapsulated with the git instructions. At the same time, a prompt message can also be given, such as "File has been created". If it is determined that the git instructions entered in the custom script function area are illegal, a corresponding prompt message is output, such as "Error, the git instructions you entered do not exist in the git instruction library, and the script file cannot be generated."
[0127] Among them, verifying the legality of the git instructions entered in the custom script function area refers to: comparing the git instructions entered in the custom script function area with the standard git instruction set (or git instructions); if the comparison shows that the git instructions entered in the custom script function area exist in the standard git instruction set, then it is determined that the git instructions entered in the custom script function area are legal; if the comparison shows that the git instructions entered in the custom script function area do not exist in the standard git instruction set, then it is determined that the git instructions entered in the custom script function area are illegal.
[0128] As shown in Table 1 below, this is a schematic diagram of the standard git instruction set:
[0129] Table 1
[0130]
[0131]
[0132] Figure 3 The process shown provides a customizable script editor to support users to add new git instructions according to their needs, so that users can write corresponding script files according to actual needs to meet various complex operation scenarios.
[0133] In one embodiment, when the user operates on the window graphical interface, including executing git commands and adding new git commands, all changes made by the user can be saved in a python dictionary object, so that the last settings can be retained when the application is opened next time. This can improve the user experience.
[0134] In one embodiment, the technical solution of the embodiment of the present application also introduces an automated management mechanism, specifically, through an instruction script that obtains the git branch status, the git current branch information is automatically obtained periodically before submitting the branch code. If the git current branch information conflicts with the current local warehouse branch information, the user is prompted whether to automatically execute the git instruction to resynchronize the current branch code, which avoids the situation where the user conflicts with other people's code submissions when merging the code. At the same time, the technical solution of the embodiment of the present application also supports providing detailed log records. Through the log printing function of python, it records when and which script file is executed, and what information the git warehouse replies, which are all recorded in the system cache by python. On this basis, users can directly view or export log texts, which is convenient for users to view and analyze operation history.
[0135] Specifically, the preset conflict check script file is executed according to the set cycle. The conflict check script file encapsulates git instructions for checking branch code merge conflicts in the target git repository, such as the git log instruction. The function switch and cycle duration can be configured by the user and obtained through the input() function, and periodic execution is achieved through the subprocess module. When it is found that there is a branch code merge conflict in the target git repository, the corresponding prompt information is output. At the same time, the log of all operation instructions can be implemented in the monitoring window, which is implemented by the python text box (Text).
[0136] Exemplarily, in the implementation code of the above function, the Tkinter library is used to create a simple graphical user interface, which allows the user to input a period value (seconds) and then click the "Start Recording" button to periodically execute the above conflict check script file.
[0137] It can be seen from the above embodiments that the technical solution of the present application controls the git repository management project code through the command script, simplifies the common operations of git, reduces the possibility of misoperation in the project, and improves the efficiency and accuracy of software development. In the field of software development, the present application can provide an effective code management tool to help developers better control code versions and improve code quality. At the same time, in the field of version control systems, the present application can provide a powerful git repository management tool, providing a simpler operating interface, which allows more developers to get started easily. Furthermore, the present application can also provide a customized tool that can encapsulate various complex git instructions according to user needs to meet different and various complex scene requirements. In general, the technical solution of the present application can automatically perform a series of complex operations through script programming, improve work efficiency, reduce the error rate of manual operations, and allow developers to customize various operation commands according to their own needs, and enhance the flexibility and scalability of programming.
[0138] Finally, in one embodiment, the settings made by the user are saved, for example, the configuration file config.ini is used to save the settings made by the user. When the program is started, it is first determined whether the configuration file exists. If the configuration file exists, the program will try to load the settings in the configuration file when it is started. In this way, the settings made by the user can be restored, so that the last settings can be retained when the program is opened next time, which is convenient for users to go back or continue the application, thereby improving the user experience.
[0139] In the exemplary implementation code, two functions are defined: create_bat_file and save_settings, as well as a configuration file name config_file and a ConfigParser object config. Then the configparser module is imported to use the ConfigParser class to parse and write the configuration file. Next, the create_bat_file function accepts a file name and content as parameters, and writes the content to the specified file (such as a python dictionary object). This saves the settings made by the user.
[0140] Figure 4 This is a block diagram of an embodiment of a git repository management device provided in an embodiment of the present application. Figure 4 As shown, the device comprises:
[0141] The interface output module 41 is used to output at least one triggerable button through a window graphical interface, each of which is associated with a script file, and the script file encapsulates a git command;
[0142] The script execution module 42 is used to respond to the triggering operation of the button and execute the target script file to execute the git instructions encapsulated in the target script file on the target git repository. The target script file is the script file associated with the triggered button.
[0143] In a possible implementation, the script execution module 42 includes:
[0144] A positioning unit, configured to respond to a triggering operation on the button and locate a git instruction from a target script file;
[0145] A control output unit, configured to output at least one input control through the window graphical interface when it is determined that the located git command needs to input parameters;
[0146] An input unit, used to obtain input content in the at least one input control;
[0147] A filling unit is used to fill the input content as an input parameter into the git instruction located from the target script file, and execute the target script file filled with the input content on the target git repository.
[0148] In a possible implementation, the script execution module 42 is specifically used to:
[0149] In response to the triggering operation of the plurality of buttons and the execution order set by the user for the triggered plurality of buttons, the plurality of target script files are executed sequentially according to the execution order, so as to sequentially execute the git instructions encapsulated in each of the target script files on the target git repository.
[0150] In a possible implementation, the script execution module 42 is specifically used to:
[0151] In response to the triggering operation of the button and the execution times set by the user for the triggered button, the target script file is repeatedly executed according to the execution times, so as to execute the git instructions encapsulated in the target script file for multiple times on the target git repository.
[0152] In a possible implementation, the device further includes:
[0153] A custom area output module, used to output a custom script function area through the window graphical interface;
[0154] A custom input module, used to obtain the git instructions input in the custom script function area;
[0155] A script encapsulation module is used to fill the git instructions input in the custom script function area into a preset script template to obtain a custom script file encapsulating the git instructions;
[0156] The button generation module is used to generate a button in the window graphical interface and associate the generated button with the custom script file.
[0157] In a possible implementation, the device further includes:
[0158] A legality verification module, used for verifying the legality of the git instructions input in the custom script function area before filling the git instructions input in the custom script function area into a preset script template to obtain a custom script file encapsulating the git instructions;
[0159] The script encapsulation module is used to, when determining that the git command input in the custom script function area is legal, execute the step of filling the git command input in the custom script function area into a preset script template to obtain a custom script file encapsulating the git command;
[0160] The first prompt module is used to output corresponding prompt information when it is determined that the git command input in the custom script function area is illegal.
[0161] In a possible implementation, the device further includes:
[0162] A conflict checking module is used to execute a preset conflict checking script file according to a set period, wherein the conflict checking script file encapsulates a git instruction for performing branch code merge conflict checking on the target git repository;
[0163] The second prompt module is used to output corresponding prompt information when it is detected that there is a branch code merge conflict in the target git repository.
[0164] like Figure 5 As shown, an embodiment of the present application provides a device, including a processor 111, a communication interface 112, a memory 113 and a communication bus 114, wherein the processor 111, the communication interface 112, and the memory 113 communicate with each other through the communication bus 114.
[0165] Memory 113, used for storing computer programs;
[0166] In one embodiment of the present application, the processor 111 is used to execute the program stored in the memory 113 to implement the git repository management method provided by any of the above method embodiments, including:
[0167] Outputting at least one triggerable button through a window graphical interface, each of the buttons being associated with a script file, wherein the script file encapsulates a git command;
[0168] In response to the triggering operation of the button, the target script file is executed to execute the git instructions encapsulated in the target script file on the target git repository, and the target script file is the script file associated with the triggered button.
[0169] An embodiment of the present application also provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the steps of the git repository management method provided in any of the aforementioned method embodiments are implemented.
[0170] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0171] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a general hardware platform, and of course, by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the relevant technology can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.
[0172] It should be understood that the terms used in the text are only for the purpose of describing specific example embodiments, and are not intended to be limiting. Unless the context clearly indicates otherwise, the singular forms "one", "an" and "said" as used in the text may also be meant to include plural forms. The terms "include", "comprise", "contain", and "have" are inclusive, and therefore specify the existence of stated features, steps, operations, elements and / or parts, but do not exclude the existence or addition of one or more other features, steps, operations, elements, parts, and / or combinations thereof. The method steps, processes, and operations described herein are not interpreted as necessarily requiring them to be performed in the specific order described or illustrated, unless the execution order is clearly indicated. It should also be understood that additional or alternative steps may be used.
[0173] The above description is only a specific implementation of the present application, so that those skilled in the art can understand or implement the present application. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein can be implemented in other embodiments without departing from the spirit or scope of the present application. Therefore, the present application will not be limited to the embodiments shown herein, but will conform to the widest range consistent with the principles and novel features applied for herein.
Claims
1. A git repository management method, characterized in that: The method comprises: Outputting at least one triggerable button through a window graphical interface, each of the buttons being associated with a script file, wherein the script file encapsulates a git command; In response to the triggering operation of the button, the target script file is executed to execute the git instructions encapsulated in the target script file on the target git repository, and the target script file is the script file associated with the triggered button.
2. The method according to claim 1, characterized in that The response to the triggering operation of the button, executing the target script file to execute the git instructions encapsulated in the target script file on the target git repository, includes: In response to the triggering operation of the button, locating the git instruction from the target script file; When it is determined that the located git command needs to input parameters, at least one input control is output through the window graphical interface; Obtaining input content in the at least one input control; The input content is filled into the git instruction located from the target script file as an input parameter, and the target script file filled with the input content is executed on the target git repository.
3. The method according to claim 1, characterized in that The response to the triggering operation of the button, executing the target script file to execute the git instructions encapsulated in the target script file on the target git repository, includes: In response to the triggering operation of the plurality of buttons and the execution order set for the triggered plurality of buttons, the plurality of target script files are executed sequentially according to the execution order, so as to sequentially execute the git instructions encapsulated in each of the target script files on the target git repository.
4. The method according to claim 1 or 3, characterized in that: The response to the triggering operation of the button, executing the target script file to execute the git instructions encapsulated in the target script file on the target git repository, includes: In response to the triggering operation of the button and the execution times set for the triggered button, the target script file is repeatedly executed according to the execution times, so as to execute the git instructions encapsulated in the target script file for multiple times on the target git repository.
5. The method according to claim 1, characterized in that The method further comprises: Outputting a custom script function area via the window graphical interface; Obtain the git command entered in the custom script function area; Fill the git command input in the custom script function area into the preset script template to obtain a custom script file encapsulating the git command; A button is generated in the window graphical interface, and the generated button is associated with the custom script file.
6. The method according to claim 5, characterized in that Before filling the git command input in the custom script function area into the preset script template to obtain the custom script file encapsulating the git command, the method further includes: Verify the legitimacy of the git command entered in the custom script function area; When it is determined that the git command input in the custom script function area is legal, the step of filling the git command input in the custom script function area into a preset script template is performed to obtain a custom script file encapsulating the git command; When it is determined that the git command input in the custom script function area is illegal, a corresponding prompt message is output.
7. The method according to claim 1, characterized in that The method further comprises: Execute a preset conflict check script file according to a set period, wherein the conflict check script file encapsulates a git instruction for performing branch code merge conflict check on the target git repository; When it is detected that there is a branch code merge conflict in the target git repository, a corresponding prompt message is output.
8. A git repository management device, characterized in that: The device comprises: An interface output module, used to output at least one triggerable button through a window graphical interface, each of the buttons is associated with a script file, and the script file encapsulates a git command; The script execution module is used to respond to the triggering operation of the button and execute the target script file to execute the git instructions encapsulated in the target script file on the target git repository. The target script file is the script file associated with the triggered button.
9. A device, characterized in that: include: at least one communication interface; at least one bus connected to the at least one communication interface; at least one processor connected to the at least one bus; at least one memory connected to the at least one bus, wherein the processor is configured to: Outputting at least one triggerable button through a window graphical interface, each of the buttons being associated with a script file, wherein the script file encapsulates a git command; In response to the triggering operation of the button, the target script file is executed to execute the git instructions encapsulated in the target script file on the target git repository, and the target script file is the script file associated with the triggered button.
10. A computer storage medium, characterized in that: Computer executable instructions are stored, and the computer executable instructions are used to execute any of the git repository management methods described above.
