Method and device for realizing PR function based on IDEA plug-in
By integrating PR functions in IntelliJ IDEA, using Kotlin and Git plug-ins, it provides three-way merge algorithms and inter-line comment functions, which solves the problem of developers frequently switching interfaces, and realizes one-stop PR operations in IDE. Improve development efficiency and code review quality.
Patent Information
- Application Number
- CN202411864183.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-18
- Publication Date
- 2025-01-14
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
In the prior art, developers need to frequently switch IDE and web interfaces when processing Pull Request (PR), resulting in a decrease in development efficiency. The existing plug-ins lack support for the complete PR process, making it difficult to complete PR in one-stop development environment. Operations affect development experience and work efficiency.
Integrate PR functions in IntelliJ IDEA, write the main plug-in program through Kotlin language, integrate Git plug-in functions, create user login interface, request Gitee PR list interface, display PR list and details page, use three-way merge algorithm to calculate code differences, and provide The inter-line comment function supports PR review and merge operations.
It realizes the creation, display, review and merge of PRs directly in the IDE, avoiding the efficiency loss caused by the Web interface mode, improving the coherence and development efficiency of workflows, improving the quality of code review and team collaboration efficiency .
Smart Images

Figure CN119311252A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of implementing PR functions based on IDEA plug-ins, and in particular to a method, apparatus, computer equipment and computer program product for implementing PR functions based on IDEA plug-ins. Background Art
[0002] As the scale of software development continues to expand, the Version Control System (VCS) has become an indispensable tool in software development. As an important part of the version control system, the Pull Request (PR) function based on Git has been widely used in collaborative development. The PR function allows developers to initiate a request after submitting code modifications so that team members can review and discuss the modifications. The review mechanism before code merging can effectively improve code quality and reduce potential errors and risks. Therefore, the PR function has become an important means to ensure code quality and team collaboration efficiency in the modern software development process.
[0003] At present, mainstream PR functions usually rely on interfaces provided by web platforms, such as GitHub, GitLab, and Gitee. Although this web server mode can meet basic needs, it requires developers to frequently switch between the integrated development environment (IDE) and the web interface, which reduces development efficiency. Especially in large-scale collaborative development, frequent interface switching not only affects the developer's workflow, but also increases the time cost of code review and merging, which in turn affects the overall development progress.
[0004] In order to improve development efficiency and team collaboration efficiency, some plug-in developers have tried to integrate PR functions into IDEs, such as the IntelliJ IDEA plug-in. However, existing plug-ins usually only have basic Git operation functions and lack support for the complete PR process. This requires developers to return to the web interface to complete detailed code review, difference analysis, and comment operations when processing PRs. It is difficult to complete the PR process operations in a one-stop manner within the development environment, affecting the development experience and work efficiency. In addition, in the current PR review process, the display of code differences (diff) usually relies on the traditional two-way merge algorithm, which is difficult to handle complex code merge scenarios. When displaying code differences, existing plug-ins also lack support for the three-way merge algorithm, which makes it difficult for reviewers to accurately identify the differences between the ancestor node of the code change and the merge branch node when there are many merge conflicts, thereby affecting the quality and efficiency of code review. Summary of the invention
[0005] The present application provides a method, apparatus, computer device and storage medium for implementing PR function based on IDEA plug-in, aiming to solve the problem that developers in the prior art still need to return to the Web interface to complete detailed code review, difference analysis and comment operations when processing PR, and it is difficult to complete the PR process operation in one stop in the development environment, which affects the development experience and work efficiency.
[0006] In a first aspect, a method for implementing a PR function based on an IDEA plug-in, the method comprising:
[0007] Create an IDEA plug-in project template, write the plug-in main program in Kotlin, and integrate the Git plug-in function;
[0008] Get local Git repository information and manage local branches and repository information;
[0009] Create a user login interface, integrate it through the Swing framework, and enter the user name, password and server address for user authentication;
[0010] Request the Gitee PR list interface, display the PR list interface, and dynamically monitor data changes based on the Kotlin Flow mechanism to achieve real-time interface updates;
[0011] When you click a PR project in the PR list interface, the PR details page is displayed. The details page includes PR metadata information, difference information, and submission information;
[0012] Use a three-way merge algorithm to calculate code differences, display the differences between the merged commit and the target branch, and support displaying file lists and file changes in the diff interface;
[0013] Provides code line commenting function, responds to users adding comments in the diff file content difference interface, and saves comment metadata to the backend;
[0014] Implement the PR review function, support the reviewer account interface to display review opinions, and allow users to merge, reject or close PRs based on the review opinions.
[0015] In the above scheme, optional filtering is supported based on PR status, branch name, and author conditions.
[0016] In the above solution, optionally, the PR details page includes the following modules:
[0017] Metadata display module, used to display PR creator, target branch, submission time and number of comments;
[0018] The difference display module calculates and displays the code differences between the target branch and the submitted branch based on the three-way merge algorithm;
[0019] The comment module supports users to comment on the code lines of the difference files.
[0020] In the above solution, optionally, the user login interface is designed based on the Swing framework, supports HTTP / HTTPS authentication interaction with the Gitee server, and saves the user login status after successful login.
[0021] In the above solution, optionally, the Kotlin Flow mechanism is used to monitor changes in PR list data and update the interface display through a two-way binding mechanism to improve user experience and interface response speed.
[0022] In the above scheme, optionally, the three-way merge algorithm is used to calculate the code difference between the target branch node, the submission branch node and their common ancestor node, so as to improve the accuracy of difference analysis in complex code merge scenarios.
[0023] In a second aspect, a device for implementing a PR function based on an IDEA plug-in is provided, the device comprising:
[0024] User login module, used for user identity authentication and login status maintenance;
[0025] PR list module, used to display PR list information and support filtering and query;
[0026] PR details module, used to display PR metadata, submission information and code differences;
[0027] The difference calculation module calculates the code difference between the target branch and the submitted branch based on the three-way merge algorithm;
[0028] Comment module, used to support code line comment function in the difference interface;
[0029] Review module, used to display review comments and support merge, reject or close PR operations.
[0030] In the above solution, optionally, the device is written based on Kotlin and Java languages, and integrates Git plug-in and Gitee API through IDEA plug-in to provide complete PR operation support.
[0031] In a third aspect, a computer device includes a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the following steps are implemented:
[0032] Create an IDEA plug-in project template, write the plug-in main program in Kotlin, and integrate the Git plug-in function;
[0033] Get local Git repository information and manage local branches and repository information;
[0034] Create a user login interface, integrate it through the Swing framework, and enter the user name, password and server address for user authentication;
[0035] Request the Gitee PR list interface, display the PR list interface, and dynamically monitor data changes based on the Kotlin Flow mechanism to achieve real-time interface updates;
[0036] When you click a PR project in the PR list interface, the PR details page is displayed. The details page includes PR metadata information, difference information, and submission information;
[0037] Use a three-way merge algorithm to calculate code differences, display the differences between the merged commit and the target branch, and support displaying file lists and file changes in the diff interface;
[0038] Provides code line commenting function, responds to users adding comments in the diff file content difference interface, and saves comment metadata to the backend;
[0039] Implement the PR review function, support the reviewer account interface to display review opinions, and allow users to merge, reject or close PRs based on the review opinions.
[0040] In a fourth aspect, a computer program product comprises a computer program / instruction, wherein when the computer program / instruction is executed by a processor, the following steps are implemented:
[0041] Create an IDEA plug-in project template, write the plug-in main program in Kotlin, and integrate the Git plug-in function;
[0042] Get local Git repository information and manage local branches and repository information;
[0043] Create a user login interface, integrate it through the Swing framework, and enter the user name, password and server address for user authentication;
[0044] Request the Gitee PR list interface, display the PR list interface, and dynamically monitor data changes based on the Kotlin Flow mechanism to achieve real-time interface updates;
[0045] When you click a PR project in the PR list interface, the PR details page is displayed. The details page includes PR metadata information, difference information, and submission information;
[0046] Use a three-way merge algorithm to calculate code differences, display the differences between the merged commit and the target branch, and support displaying file lists and file changes in the diff interface;
[0047] Provides code line commenting function, responds to users adding comments in the diff file content difference interface, and saves comment metadata to the backend;
[0048] Implement the PR review function, support the reviewer account interface to display review opinions, and allow users to merge, reject or close PRs based on the review opinions.
[0049] Compared with the prior art, this application has at least the following beneficial effects:
[0050] Based on further analysis and research of the existing technical problems, this application recognizes that the existing technical developers still need to return to the Web interface to complete detailed code review, difference analysis and comment operations when processing PR. It is difficult to complete the PR process operation in a one-stop manner in the development environment, which affects the development experience and work efficiency. By integrating the PR operation function in IntelliJIDEA, developers do not need to frequently switch to the Web interface, and can directly complete the creation, display, review and merging of PR in the IDE, avoiding the efficiency loss caused by the traditional Web interface mode, thereby greatly improving the consistency and development efficiency of the workflow. The present invention adopts a three-way merge algorithm to calculate the code difference between the target branch node, the submission branch node and its common ancestor node. Compared with the traditional two-way merge algorithm, the three-way merge algorithm can more accurately identify code changes in complex merge scenarios, reduce errors and conflicts, improve the accuracy of code difference analysis, and thus improve the quality and efficiency of code review. The Kotlin Flow mechanism is adopted to dynamically monitor the data changes of the PR list and detail page, and realize the two-way binding of the interface and data. Through this mechanism, the user interface can quickly respond to data changes and obtain the latest PR status and review results without manual refresh, which significantly improves the user experience. By providing the code line comment function in the difference interface, users can comment on specific lines of code directly in the IDE and save the comment metadata to the backend synchronously. This function not only improves the communication efficiency between developers, but also provides a convenient knowledge sharing and discussion platform for team members, further promoting team collaboration. Combining the repository management capabilities of the Git plug-in with the PR operation interface of the Gitee API, it is integrated into the IDEA development environment in the form of a plug-in, providing complete PR operation support. Users can complete the entire process from PR creation, difference analysis to review and merging in a unified interface, which simplifies the PR operation process and improves development efficiency and team collaboration efficiency.
[0051] The technical solution of this application overcomes the defects of the prior art such as cumbersome Web interface operation, low development efficiency, and insufficient accuracy of difference analysis. By innovatively integrating PR management functions, it achieves the technical effects of improving development efficiency, improving code review quality, enhancing user experience, and promoting team collaboration. BRIEF DESCRIPTION OF THE DRAWINGS
[0052] Figure 1 A flowchart of a method for implementing a PR function based on an IDEA plug-in provided in one embodiment of the present application;
[0053] Figure 2 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0054] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0055] In one embodiment, Figure 1 As shown, a method for implementing the PR function based on the IDEA plug-in is provided, including the following steps:
[0056] Create an IDEA plug-in project template, write the plug-in main program in Kotlin, and integrate the Git plug-in function;
[0057] Get local Git repository information and manage local branches and repository information;
[0058] Create a user login interface, integrate it through the Swing framework, and enter the user name, password and server address for user authentication;
[0059] Request the Gitee PR list interface, display the PR list interface, and dynamically monitor data changes based on the Kotlin Flow mechanism to achieve real-time interface updates;
[0060] When you click a PR project in the PR list interface, the PR details page is displayed. The details page includes PR metadata information, difference information, and submission information;
[0061] Use a three-way merge algorithm to calculate code differences, display the differences between the merged commit and the target branch, and support displaying file lists and file changes in the diff interface;
[0062] Provides code line commenting function, responds to users adding comments in the diff file content difference interface, and saves comment metadata to the backend;
[0063] Implement the PR review function, support the reviewer account interface to display review opinions, and allow users to merge, reject or close PRs based on the review opinions.
[0064] This embodiment integrates the PR operation function in IntelliJ IDEA, so that developers can directly complete the creation, display, review and merge of PR in the IDE without frequently switching to the Web interface, avoiding the efficiency loss caused by the traditional Web interface mode, thereby greatly improving the consistency and development efficiency of the workflow. The present invention adopts a three-way merge algorithm to calculate the code differences between the target branch node, the submission branch node and its common ancestor node. Compared with the traditional two-way merge algorithm, the three-way merge algorithm can more accurately identify code changes in complex merge scenarios, reduce errors and conflicts, improve the accuracy of code difference analysis, and thus improve the quality and efficiency of code review. The KotlinFlow mechanism is adopted to dynamically monitor the data changes of the PR list and the details page, and realize the two-way binding of the interface and the data. Through this mechanism, the user interface can quickly respond to data changes, and the latest PR status and review results can be obtained without manual refresh, thereby significantly improving the user experience. By providing the code line comment function in the difference interface, users can directly comment on specific lines of code in the IDE and save the comment metadata synchronously to the backend. This feature not only improves the communication efficiency between developers, but also provides a convenient knowledge sharing and discussion platform for team members, further promoting team collaboration. Combining the repository management capabilities of the Git plug-in with the PR operation interface of the Gitee API, it is integrated into the IDEA development environment in the form of a plug-in, providing complete PR operation support. Users can complete the entire process from PR creation, difference analysis to review and merging in a unified interface, simplifying the PR operation process and improving development efficiency and team collaboration efficiency.
[0065] The technical solution of this embodiment overcomes the defects of the prior art such as cumbersome Web interface operation, low development efficiency, and insufficient accuracy of difference analysis. By innovatively integrating PR management functions, it achieves the technical effects of improving development efficiency, improving code review quality, enhancing user experience, and promoting team collaboration.
[0066] In this embodiment, the PR list interface provides a filtering query function, supporting filtering based on PR status, branch name, and author conditions.
[0067] In the actual development process, large projects often involve multiple branches and PRs submitted by different developers. When there are a large number of PRs, it is difficult for developers to quickly locate the PRs they need to view, and relying on the traditional PR list display method, users need to spend a lot of time manually searching and filtering. The filtering query function in this embodiment, by adding filtering conditions on the PR list interface, enables users to filter according to PR status (such as Open, Merged, Closed), branch name (such as feature branch, bugfix branch) and PR creator (ie author), etc., which greatly shortens the user's retrieval time and improves work efficiency.
[0068] This embodiment provides multi-dimensional filtering conditions such as status, branch, and author, so that developers can easily find PRs related to their work. Especially in the scenario of multi-person collaborative development, different developers are responsible for the development of different functional modules or branches. They can filter the branches or PRs they are responsible for in a targeted manner, which helps to improve the targetedness of the review. In this way, developers can quickly focus on processing relevant PRs, avoid wasting time due to viewing irrelevant PRs, and improve development and review efficiency.
[0069] In team collaboration, there are usually dedicated reviewers or project leaders responsible for code review of specific branches or modules. The filtering function supports filtering by branch name, so that team members can quickly locate the PR of a specific branch, so as to concentrate on completing the code review work and avoid confusion and misjudgment caused by the large number of PRs. At the same time, the function of author-based filtering also helps project leaders improve management efficiency and code quality supervision when checking the code submitted by specific developers. The traditional PR list interface usually only displays the basic information of the PR, lacks flexible filtering functions, and has a poor user experience. By integrating the filtering query function on the interface, users can freely select the filtering conditions and view the list of PRs that meet the conditions in real time. This design greatly enhances the user-friendliness of the interface. Users do not need to manually browse the long list during operation, but can quickly obtain the required information through a simple filtering interface, thereby improving the user experience.
[0070] The filtering query function in this embodiment not only improves the retrieval efficiency and review efficiency, but also optimizes the team collaboration process, significantly enhances the user experience and interface friendliness, and provides developers with a more efficient and convenient PR management tool.
[0071] In this embodiment, the PR details page includes the following modules:
[0072] Metadata display module, used to display PR creator, target branch, submission time and number of comments;
[0073] The difference display module calculates and displays the code differences between the target branch and the submitted branch based on the three-way merge algorithm;
[0074] The comment module supports users to comment on the code lines of the difference files.
[0075] This embodiment effectively improves the efficiency of PR review, the accuracy of code difference analysis, and the convenience of team communication by designing three core modules of the PR details page, and provides developers with a more comprehensive and efficient PR review tool.
[0076] In this embodiment, the user login interface is designed based on the Swing framework, supports HTTP / HTTPS authentication interaction with the Gitee server, and saves the user login status after a successful login.
[0077] This embodiment interacts with the Gitee server through HTTP / HTTPS authentication, ensuring the security of data transmission when the user logs in. The HTTPS protocol uses the SSL / TLS encryption mechanism, which can effectively prevent data from being intercepted or tampered with during transmission, ensuring the security of user login information (such as username and password). Compared with the traditional HTTP protocol, HTTPS authentication greatly improves the security of data transmission, helps to protect the privacy and account security of users, especially in public network environments, where security authentication is particularly important. By integrating the user login interface in the IDEA plug-in, users do not need to switch to the browser to log in to the Gitee account, but can complete the login operation directly in the plug-in. This integrated design reduces the user's switching between different interfaces, simplifies the operation process, and improves the convenience of login. After the user logs in, the plug-in will automatically save the login status, and the user does not need to log in again for each operation, further improving the user experience.
[0078] This embodiment uses the Swing framework to design the user login interface, so that the plug-in can be well compatible on different operating systems (such as Windows, macOS and Linux). As part of the Java standard library, Swing has strong cross-platform capabilities and good interface style consistency, which can provide a consistent user experience for users on different platforms. In addition, the Swing framework also supports a variety of UI components, and developers can flexibly design the interface layout as needed, which improves the friendliness and operability of the plug-in interface.
[0079] This embodiment provides users with a safe and reliable login experience by designing a safe, convenient, and highly compatible user login interface, while simplifying the operation process and improving the usability and user satisfaction of the plug-in.
[0080] In this embodiment, the Kotlin Flow mechanism is used to monitor changes in PR list data and update the interface display through a two-way binding mechanism to improve user experience and interface response speed.
[0081] The Kotlin Flow mechanism in this embodiment significantly improves the interface response speed and data synchronization capability by providing efficient asynchronous data processing and two-way binding functions, reduces system resource consumption, enhances data consistency and user experience, simplifies the development process, and improves code maintainability and team collaboration efficiency.
[0082] In this embodiment, the three-way merge algorithm is used to calculate the code differences between the target branch node, the commit branch node and their common ancestor nodes, so as to improve the accuracy of difference analysis in complex code merge scenarios.
[0083] This embodiment adopts a three-way merge algorithm to improve the accuracy and visualization of difference analysis, reduce code merge conflicts, enhance the versatility and applicability of the plug-in, and significantly improve user experience and code review efficiency, providing developers with a more intelligent and efficient code difference analysis tool.
[0084] In one embodiment, a method for implementing a PR function based on an IDEA plug-in is provided. The method for implementing a PR function based on an IDEA plug-in provided in this embodiment includes the following steps:
[0085] Create an idea plug-in project template to create a project;
[0086] Create an idea plug-in project through the template project officially provided by idea;
[0087] Create the main plug-in program, integrate the git plug-in function, and create the user authentication function;
[0088] Use Kotlin language to write the main program code;
[0089] Through the git plug-in, obtain local git repository information and manage local branches and repository information.
[0090] Based on idea components and swing framework, create a user login box and enter the user name, password, and server address.
[0091] Create PR list function;
[0092] Combining the advantages of Kotlin and Java languages, Kotlin is used to write UI display, Java is used to process interface data requests, and based on the Gitee code http / https interface, the PR list interface and interface request code are developed.
[0093] Based on the Kotlin flow mechanism, data changes are dynamically monitored and the interface display is changed at the same time to form a two-way binding mechanism, optimize the user experience, and quickly respond to data changes.
[0094] Create a plugin to create pr function;
[0095] Based on the git plug-in, manage local warehouse information, based on the warehouse information, use the Java language to process http / https interface requests, and request to create a pr interface.
[0096] Use the pr details page to display the created pr information.
[0097] Create pr details function;
[0098] Using the swing framework using the kotlin language, based on the Gitee pr interface, it displays the pr information interface, pr diff submission information interface, and commit list interface.
[0099] The diff interface shows the difference between the merged commit and the target branch, including a list of files and the content of file changes. Based on the three-way merge algorithm, the difference information is calculated by obtaining the ancestor node and the latest node branch of the merged branch.
[0100] The commit list interface displays the merged commit information and file differences, and obtains the commit information on the merge path based on the three-way merge algorithm.
[0101] The diff file content difference interface combines the difference information to create a code line comment function and save the comment metadata information to the web backend.
[0102] PR review function;
[0103] In the pr list interface, click on pr to jump to the pr details page, pr metadata information interface, and the reviewer account interface to display the review comments and close the pr. Non-reviewers will see the close pr operation. The review comments can review and comment on the pr, set the merge strategy, or reject the pr and other operations.
[0104] The purpose of this embodiment is to provide a method and device for implementing PR functions based on IDEA plug-ins, aiming to solve the deficiencies of existing conventional plug-ins in PR functions. By supporting the PR process operation of the IDEA platform, the method and device are intended to optimize the code review, discussion and merging process, thereby improving software development efficiency and team collaboration efficiency. This embodiment aims to fill the gaps in the existing technology, provide more efficient tools and process support for development teams, and make the PR process smoother and more efficient.
[0105] The key to this embodiment is to create a new IDEA plug-in that specifically supports the PR function. Using Kotlin and Java language technology, based on the Swing framework, combined with the PR function interface of the Gitee server, the PR function is integrated on the IDEA platform through a plug-in. The plug-in provides a PR list interface (including a filter query condition button). Clicking the PR list can display the PR details, where the PR details page displays PR metadata information, difference information, and submission information, and the differences and submission information are calculated using a three-way merge algorithm. In the difference code interface, a code line comment function is provided. The PR metadata interface provides review and closure PR functions. Engineers can directly manage and operate the PR process on the IDEA platform, thereby significantly accelerating the software development process and greatly improving development efficiency.
[0106] Through these designs, the PR function is successfully integrated on the IDEA platform to accelerate the PR process. The present invention integrates Gitee's PR function on the IDEA platform in the form of a plug-in. Using Kotlin and Java languages, based on the Swing framework, functions such as user login, PR list, PR details page (including difference display and code line comments), and PR review function are implemented. This innovation accelerates the PR process and improves development efficiency.
[0107] This embodiment integrates a PR function plug-in on the development side of the idea platform in the form of a plug-in through the idea platform, thereby improving code quality, promoting knowledge sharing, accelerating the code review process, improving team collaboration efficiency, helping the team learn and grow, improving PR approval efficiency, speeding up the PR process, speeding up the software development process, and improving development efficiency.
[0108] In one embodiment, a device for implementing a PR function based on an IDEA plug-in is provided, comprising:
[0109] User login module, used for user identity authentication and login status maintenance;
[0110] PR list module, used to display PR list information and support filtering and query;
[0111] PR details module, used to display PR metadata, submission information and code differences;
[0112] The difference calculation module calculates the code difference between the target branch and the submitted branch based on the three-way merge algorithm;
[0113] Comment module, used to support code line comment function in the difference interface;
[0114] The review module is used to display review comments and support merging, rejecting, or closing PR operations.
[0115] The device is written in Kotlin and Java languages, and integrates the Git plug-in and Gitee API through the IDEA plug-in to provide complete PR operation support.
[0116] The specific implementation content of each module can be found in the above-mentioned definition of the method for implementing the PR function based on the IDEA plug-in, which will not be repeated here.
[0117] In one embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as follows: Figure 2 As shown. The computer device includes a processor, a memory and a network interface connected through a system bus. The processor of the computer device is used to provide computing and control capabilities, and the network interface is used to communicate with an external terminal through a network connection. The computer device loads and runs a computer program to implement the above-mentioned method of realizing a PR function based on an IDEA plug-in.
[0118] Those skilled in the art will understand that Figure 2 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0119] In one embodiment, a computer program product is also provided, including a computer program / instruction, which, when executed by a processor, involves all or part of the process in the above-mentioned embodiment method.
[0120] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
Claims
1. A method for implementing PR function based on IDEA plug-in, characterized in that: The method comprises: Create an IDEA plug-in project template, write the plug-in main program in Kotlin, and integrate the Git plug-in function; Get local Git repository information and manage local branches and repository information; Create a user login interface, integrate it through the Swing framework, and enter the user name, password and server address for user authentication; Request the Gitee PR list interface, display the PR list interface, and dynamically monitor data changes based on the Kotlin Flow mechanism to achieve real-time interface updates; When you click a PR project in the PR list interface, the PR details page is displayed. The details page includes PR metadata information, difference information, and submission information; Use a three-way merge algorithm to calculate code differences, display the differences between the merged commit and the target branch, and support displaying file lists and file changes in the diff interface; Provides code line commenting function, responds to users adding comments in the diff file content difference interface, and saves comment metadata to the backend; Implement the PR review function, support the reviewer account interface to display review opinions, and allow users to merge, reject or close PRs based on the review opinions.
2. The method according to claim 1, characterized in that The PR list interface provides a filtering query function, which supports filtering based on PR status, branch name and author conditions.
3. The method according to claim 1, characterized in that The PR details page contains the following modules: Metadata display module, used to display PR creator, target branch, submission time and number of comments; The difference display module calculates and displays the code differences between the target branch and the submitted branch based on the three-way merge algorithm; The comment module supports users to comment on the code lines of the difference files.
4. The method according to claim 1, characterized in that: The user login interface is designed based on the Swing framework, supports HTTP / HTTPS authentication interaction with the Gitee server, and saves the user login status after a successful login.
5. The method according to claim 1, characterized in that The Kotlin Flow mechanism is used to monitor changes in PR list data and update the interface display through a two-way binding mechanism to improve user experience and interface response speed.
6. The method according to claim 1, characterized in that The three-way merge algorithm is used to calculate the code differences between the target branch node, the commit branch node and their common ancestor nodes, and is used to improve the accuracy of difference analysis in complex code merge scenarios.
7. A device for implementing PR function based on IDEA plug-in, characterized in that: include: User login module, used for user identity authentication and login status maintenance; PR list module, used to display PR list information and support filtering and query; PR details module, used to display PR metadata, submission information and code differences; The difference calculation module calculates the code difference between the target branch and the submitted branch based on the three-way merge algorithm; Comment module, used to support code line comment function in the difference interface; Review module, used to display review comments and support merge, reject or close PR operations.
8. The device according to claim 7, characterized in that The device is written in Kotlin and Java languages, and integrates the Git plug-in and Gitee API through the IDEA plug-in to provide complete PR operation support.
9. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 7 are implemented.
10. A computer program product comprising a computer program / instructions, characterized in that When the computer program / instructions are executed by a processor, the steps of the method according to claims 1-6 are implemented.
Citation Information
Patent Citations
Code conflict merging method and system, electronic equipment and readable storage medium
CN114840250A
Code inspection method and device and computer readable storage medium
CN115509938A
Code review method, platform, equipment, system, storage medium and program product
CN115756580A
Code review method and device, electronic equipment and storage medium
CN115794607A
Code review system and method
CN116775487A