# US 10,768,929 B1 · Automatically updating source code in version control systems via a pull request

> Agents: this data is available as JSON from the patentgrep API and MCP server — see https://patentgrep.com/llms.txt

- Number: US 10,768,929 B1
- Document ID: US10768929B1
- Status: Granted
- Kind: B1
- Application number: 16/683,144
- Filed: 2019-11-13
- Granted: 2020-09-08
- Earliest claimed: 2019-11-13
- Assignees: Atlassian Pty Ltd.; Atlassian Inc.
- Applicants: Atlassian Pty Ltd.; Atlassian Inc.
- Inventors: Bryan Paul Turner; John Brent Plump
- Web page: https://patentgrep.com/patent/US10768929B1

## CPC

- G06F 8/71: Version control (security arrangements therefor G06F21/57); Configuration management
- G06F 8/38: for implementing user interfaces
- G06F 8/65: Updates (security arrangements therefor G06F21/57)
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## 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

### Claim 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.

### Claim 2 (depends on 1)

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.

### Claim 3 (depends on 2)

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

### Claim 4 (depends on 3)

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.

### Claim 5 (depends on 3)

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.

### Claim 6 (depends on 5)

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.

### Claim 7 (depends on 6)

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.

### Claim 8 (depends on 6)

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.

### Claim 9 (depends on 6)

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.

### Claim 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.

### Claim 11 (depends on 10)

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.

### Claim 12 (depends on 11)

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.

### Claim 13 (depends on 12)

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.

### Claim 14 (depends on 12)

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.

### Claim 15 (depends on 14)

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.

### Claim 16 (depends on 15)

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.

### Claim 17 (depends on 15)

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.

### Claim 18 (depends on 15)

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.
