IP Library Granted Patent US 10,768,929
Granted Patent B1
US 10,768,929 · App. 16/683,144 · Granted Sep 8, 2020

Automatically updating source code in version control systems via a pull request

Inventors: Bryan Paul Turner (Irvine, CA); John Brent Plump (Sydney, AU)
Assignees: ATLASSIAN PTY LTD.; ATLASSIAN INC.
G06F8/71G06F8/38G06F8/65
View Patent ↗
Loading inventors, assignments & file history…
Monitor This Case
Get email alerts when status or documents change.
Order Certified Copies
Most orders are placed with the USPTO same day — all within 24 business hours.
Order via The Patent Place →
Pre-filled with this patent's details
Quick Facts
Patent No.
US 10,768,929
App. No.
16/683,144
Filed
Nov 13, 2019
Granted
Sep 8, 2020
Kind
B1
Art Unit
2192
USPC
717/122
Abstract

A method for automatically updating source code in a first source code branch using a pull request is disclosed. The method includes: displaying a pull request user interface associated with the first source code branch, the pull request user interface comprising a code change suggestion including an original line of source code to be changed and a new line of source code to replace the original line of source code; receiving user input to accept the code change suggestion; propagating the source code change to the first source code branch such that an original line of source code in the first source code branch is replaced with the new line of source code; and upon successfully propagating the source code change to the first source code branch, updating the pull request user interface to indicate that the code change suggestion is applied and the pull request is modified.

Claims (69)

1. A computer-implemented method for automatically updating source code in a first source code branch using a pull request user interface, the method comprising:

displaying, on a display of a user computing device, the pull request user interface associated with the first source code branch and associated with a pull request to merge the first source code branch into a second source code branch, the pull request user interface comprising:

a panel displaying source code associated with an intermediate merge between a tip of the first source code branch and a tip of the second source code branch and a code change suggestion; and

a selectable affordance associated with the code change suggestion to accept the code change suggestion; wherein the code change suggestion includes an original line of source code from the intermediate merge to be changed and a new line of source code suggested by a user via the pull request user interface to replace the original line of source code;

receiving user input on the selectable affordance associated with the code change suggestion;

propagating a source code change from the intermediate merge to the first source code branch such that an original line of source code in the first source code branch that corresponds to the original line of source code from the intermediate merge is replaced with the new line of source code as suggested by the user; and

upon successfully propagating the source code change to the first source code branch, updating the pull request user interface associated with the first source code branch to indicate that the code change suggestion is applied and the pull request is modified.

2. The computer-implemented method of claim 1 , wherein propagating the source code change from the intermediate merge to the first source code branch comprises:

determining whether the original line of source code from the intermediate merge is a source code line that is added by the first source code branch;

upon determining that the original line of source code from the intermediate merge is the source code line that is added by the first source code branch, calculating a difference from the intermediate merge to the first source code branch;

upon determining that the original line of source code from the intermediate merge is a source code line that is unchanged by the first source code branch, calculating a difference from the tip of the second source code branch to the first source code branch; and

saving the calculated difference.

3. The method of claim 2 , further comprising determining whether any changes are identified in the difference.

4. The method of claim 3 , further comprising:

identifying a line number associated with the original line of source code in the intermediate merge;

determining that the line number of the original line of source code from the intermediate merge directly corresponds with a line number of a corresponding line of source code in the first source code branch if no changes are identified in the difference; and

applying the code change suggestion by replacing the source code on the line number in the first source code branch with the new line of source code.

5. The method of claim 3 , further comprising:

identifying a line number associated with the original line of source code in the intermediate merge and assigning this line as an anchor line;

determining that the line number of the original line of source code from the intermediate merge does not directly corresponds with the line number of a corresponding line of source code in the first source code branch if changes are identified in the difference; and

determining a difference between the line number of the original line of source code in the intermediate merge and the line number of the corresponding line of source code in the first source code branch; and

drifting the source code in the first source code branch by a number of lines corresponding to the difference between the line number of the anchor line and the corresponding line of source code in the first source code branch and replacing the source code on that line number with the new line of source code.

6. The method of claim 5 , wherein determining the difference between the line number of the original line of source code in the intermediate merge and the line number of the corresponding line of source code in the first source code branch includes:

retrieving the changes identified in the difference, wherein the changes include a plurality of hunks;

for each hunk:

automatically computing a drift value representing a number of lines of the source code by which the anchor line has changed with respect to the first source code branch; and

updating the anchor line number based upon the drift value; and

repeating the computing and updating steps for all other hunks.

7. The method of claim 6 , further comprising automatically computing the drift value by:

determining whether a hunk of the plurality of hunks starts and finishes before the anchor line;

determining the drift value as a size of the hunk in the first source code branch.

8. The method of claim 6 , further comprising automatically computing the drift value by:

determining that a hunk of the plurality of hunks starts after the anchor line;

in response thereto, determining that the drift value is zero.

9. The method of claim 6 , further comprising determining that the code change suggestion cannot be applied if a hunk of the plurality of hunks overlaps the anchor line.

10. A non-transitory machine readable medium comprising instructions for automatically updating source code in a first source code branch using a pull request user interface, the instructions when executed by a processor, cause a computing device to:

display, on a display of the computing device, the pull request user interface associated with the first source code branch and associated with a pull request to merge the first source code branch into a second source code branch, the pull request user interface comprising:

a panel displaying source code associated with an intermediate merge between a tip of the first source code branch and a tip of the second source code branch and a code change suggestion; and

a selectable affordance associated with the code change suggestion to accept the code change suggestion, wherein the code change suggestion includes an original line of source code from the intermediate merge to be changed and a new line of source code suggested by a user via the pull request user interface to replace the original line of source code;

receive user input on the selectable affordance associated with the code change suggestion;

propagate a source code change from the intermediate merge to the first source code branch such that an original line of source code in the first source code branch that corresponds to the original line of source code from the intermediate merge is replaced with the new line of source code suggested by the user; and

upon successfully propagating the source code change to the first source code branch, update the pull request user interface associated with the first source code branch to indicate that the code change suggestion is applied and the pull request is modified.

11. The non-transitory machine readable medium of claim 10 , wherein to propagate the source code change from the intermediate merge to the first source code branch, further comprising instructions which when executed by the processor cause the computing device to:

determine whether the original line of source code from the intermediate merge is a source code line that is added by the first source code branch;

upon determining that the original line of source code from the intermediate merge is the source code line that is added by the first source code branch, calculate a difference from the intermediate merge to the first source code branch;

upon determining that the original line of source code from the intermediate merge is a source code line that is unchanged by the first source code branch, calculate a difference from the tip of the second source code branch to the first source code branch; and

save the calculated difference.

12. The non-transitory machine readable medium of claim 11 , further comprising instructions which when executed by the processor cause the computing device to determine whether any changes are identified in the difference.

13. The non-transitory machine readable medium of claim 12 , further comprising instructions which when executed by the processor cause the computing device to:

identify a line number associated with the original line of source code in the intermediate merge;

determine that the line number of the original line of source code from the intermediate merge directly corresponds with a line number of a corresponding line of source code in the first source code branch if no changes are identified in the difference; and

apply the code change suggestion by replacing the source code on the line number in the first source code branch with the new line of source code.

14. The non-transitory machine readable medium of claim 12 , further comprising instructions which when executed by the processor cause the computing device to:

identify a line number associated with the original line of source code in the intermediate merge and assigning this line as an anchor line;

determine that the line number of the original line of source code from the intermediate merge does not directly corresponds with the line number of a corresponding line of source code in the first source code branch if changes are identified in the difference; and

determine a difference between the line number of the original line of source code in the intermediate merge and the line number of the corresponding line of source code in the first source code branch; and

drift the source code in the first source code branch by a number of lines corresponding to the difference between the line number of the anchor line and the corresponding line of source code in the first source code branch and replace the source code on that line number with the new line of source code.

15. The non-transitory machine readable medium of claim 14 , wherein to determine the difference between the line number of the original line of source code in the intermediate merge and the line number of the corresponding line of source code in the first source code branch, further comprising instructions which when executed by the processor cause the computing device to:

retrieve the changes identified in the difference, wherein the changes include a plurality of hunks;

for each hunk, automatically compute a drift value representing a number of lines of the source code by which the anchor line has changed with respect to the first source code branch;

update the anchor line number based upon the drift value; and

repeat the computing and updating steps for all other hunks.

16. The non-transitory machine readable medium of claim 15 , to automatically compute the drift value, further comprising instructions which when executed by the processor cause the computing device to:

determine whether a hunk of the plurality of hunks starts and finishes before the anchor line;

determine the drift value as a size of the hunk in the first source code branch.

17. The non-transitory machine readable medium of claim 15 , to automatically compute the drift value, further comprising instructions which when executed by the processor cause the computing device to:

determine whether a hunk of the plurality of hunks starts after the anchor line; and

in response thereto, determine that the drift value is zero.

18. The non-transitory machine readable medium of claim 15 , further comprising instructions which when executed by the processor cause the computing device to determine that the code change suggestion cannot be applied if a hunk of the plurality of hunks overlaps the anchor line.

Assignments (2)
CHANGE OF NAME Recorded Aug 5, 2022
From: ATLASSIAN, INC.
To: ATLASSIAN US, INC.
Reel/Frame 061085/0690 →
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Nov 13, 2019
From: TURNER, BRYAN PAUL; PLUMP, JOHN BRENT
To: ATLASSIAN PTY LTD.; ATLASSIAN INC.
Reel/Frame 051002/0011 →
Cited By (4)
US 12,271,497 US 12,346,457 US 12,423,373 US 12,578,961