# US 10,372,424 B2 · Lossless bi-directional formatting of program source code

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

- Number: US 10,372,424 B2
- Document ID: US10372424B2
- Status: Granted
- Kind: B2
- Application number: 15/592,560
- Filed: 2017-05-11
- Published: 2018-11-15
- Granted: 2019-08-06
- Earliest claimed: 2017-05-11
- Assignees: International Business Machines Corporation
- Applicants: International Business Machines Corporation
- Inventors: Dominic Evans; Ledina Hido-Evans; Adrian J. Preston
- Web page: https://patentgrep.com/patent/US10372424B2

## CPC

- G06F 8/33: Intelligent editors
- G06F 8/71: Version control (security arrangements therefor G06F21/57); Configuration management
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

A method, computer program product, and system includes a processor(s) of a host obtaining, from a client, via a communication connection over a network, a request to commit a modified version of program source code to a repository administered by the host. The processor(s) identify formatting in the modified version implemented by an editor executing on the client and remove the formatting. The processor(s) transform the modified version into a first storage structure that includes content of the modified version without the identified formatting. The processor(s) identify one or more differences between the first storage structure representing the modified version and a second storage structure (an unmodified version of the program source code stored in the repository). The processor(s) store the one or more differences in the repository.

## Claims

### Claim 1

A computer-implemented method, comprising:
obtaining, by one or more processors of a host, from a client, via a communication connection over a network, a request to commit a modified version of program source code to a repository administered by the host;
identifying, by the one or more processors, formatting in the modified version implemented by an editor executing on the client;
removing, by the one or more processors, the identified formatting from the modified version;
transforming, by the one or more processors, the modified version into a first storage structure comprising content of the modified version without the identified formatting, wherein the first storage structure comprises a canonical internal representation, wherein the transforming comprises:
identifying, by the one or more processors, a programming language comprising the modified version; and
based on identifying the language, applying, by the one or more processors, a language-specific tool to build the canonical internal representations;
identifying, by the one or more processors, one or more differences between the first storage structure representing the modified version and a second storage structure, wherein the second storage structure comprises an unmodified version of the program source code stored in the repository; and
storing, by the one or more processors, the one or more differences in the repository.

### Claim 2 (depends on 1)

The computer-implemented method of claim 1, wherein the unmodified version of the program source code comprises a last version of the program source code committed to the repository.

### Claim 3 (depends on 1)

The computer-implemented method of claim 1, wherein identifying the formatting comprises:
determining, by the one or more processors, if the formatting in the modified version implemented by an editor executing on the client comprises one of: custom formatting implemented by user entry in a graphical user interface of the editor or default formatting implemented automatically in the editor.

### Claim 4 (depends on 1)

The computer-implemented method of claim 1, further comprising:
obtaining, by the one or more processors, from the client, via the communication connection over the network, a request to obtain a most recent version of the program source code from the repository;
extracting, by the one or more processors, a set structure representing the most recent version from the repository, wherein the extracting comprises synthesizing the one or more differences in the repository and the second storage structure into the set structure representing the most recent version;
identifying, by the one or more processors, selected formatting for program source code displayed in the editor; and
converting, by the one or more processors, the most recent version of the program source code into a format editable in the editor and applying the identified formatting to the most recent version in the format generating a formatted most recent version.

### Claim 5 (depends on 4)

The computer-implemented method of claim 4, further comprising:
displaying, by the one or more programs, the formatted most recent version, wherein the formatted most recent version is available in the editor for editing by a user of the client.

### Claim 6 (depends on 4)

The computer-implemented method of claim 4, wherein the selected formatting for program source code displayed in the editor is selected from the group consisting of: custom formatting implemented by user entry in the graphical user interface of the editor and default formatting implemented automatically in the editor.

### Claim 7 (depends on 1)

The computer-implemented method of claim 1, wherein the transforming comprises:
identifying, by the one or more processors, one or more references in the modified version;
determining, by the one or more processors, whether the one or more references should be preserved; and
based on determining that a portion of the one or more references should be preserved, accessing, by the one or more processors, mapping tables generated as part of creating a build of the modified version and designating locations of the portion in first storage structure of the one or more references in the mapping tables.

### Claim 8 (depends on 7)

The computer-implemented method of claim 7, further comprising:
obtaining, by the one or more processors, from the client, via the communication connection over the network, a request to obtain a most recent version of the program source code from the repository;
extracting, by the one or more processors, a set structure representing the most recent version from the repository, wherein the extracting comprises synthesizing the one or more differences in the repository and the second storage structure into the set structure representing the most recent version;
identifying, by the one or more processors, selected formatting for program source code displayed in the editor; and
converting, by the one or more processors, the most recent version of the program source code into a format editable in the editor and applying the identified formatting to the most recent version in the format generating a formatted most recent version, wherein the converting comprises accesses the mapping tables to insert the portion into the formatted most recent version.

### Claim 9 (depends on 7)

The computer-implemented method of claim 7, determining, by the one or more processors, whether the one or more references should be preserved comprises identifying a programming language of the modified version.

### Claim 10

A computer program product comprising:
a computer readable storage medium readable by one or more processors and storing instructions for execution by the one or more processors for performing a method comprising:
obtaining, by the one or more processors of a host, from a client, via a communication connection over a network, a request to commit a modified version of program source code to a repository administered by the host;
identifying, by the one or more processors, formatting in the modified version implemented by an editor executing on the client;
removing, by the one or more processors, the identified formatting from the modified version;
transforming, by the one or more processors, the modified version into a first storage structure comprising content of the modified version without the identified formatting, wherein the first storage structure comprises a canonical internal representation, wherein the transforming comprises:
identifying, by the one or more processors, a programming language comprising the modified version; and
based on identifying the language, applying, by the one or more processors, a language-specific tool to build the canonical internal representations;
identifying, by the one or more processors, one or more differences between the first storage structure representing the modified version and a second storage structure, wherein the second storage structure comprises an unmodified version of the program source code stored in the repository; and
storing, by the one or more processors, the one or more differences in the repository.

### Claim 11 (depends on 10)

The computer program product of claim 10, wherein the unmodified version of the program source code comprises a last version of the program source code committed to the repository.

### Claim 12 (depends on 10)

The computer program product of claim 10, wherein identifying the formatting comprises:
determining, by the one or more processors, if the formatting in the modified version implemented by an editor executing on the client comprises one of: custom formatting implemented by user entry in a graphical user interface of the editor or default formatting implemented automatically in the editor.

### Claim 13 (depends on 10)

The computer program product of claim 10, the method further comprising:
obtaining, by the one or more processors, from the client, via the communication connection over the network, a request to obtain a most recent version of the program source code from the repository;
extracting, by the one or more processors, a set structure representing the most recent version from the repository, wherein the extracting comprises synthesizing the one or more differences in the repository and the second storage structure into the set structure representing the most recent version;
identifying, by the one or more processors, selected formatting for program source code displayed in the editor; and
converting, by the one or more processors, the most recent version of the program source code into a format editable in the editor and applying the identified formatting to the most recent version in the format generating a formatted most recent version.

### Claim 14 (depends on 13)

The computer program product of claim 13, the method further comprising:
displaying, by the one or more programs, the formatted most recent version, wherein the formatted most recent version is available in the editor for editing by a user of the client.

### Claim 15 (depends on 13)

The computer program product of claim 13, wherein the selected formatting for program source code displayed in the editor is selected from the group consisting of: custom formatting implemented by user entry in the graphical user interface of the editor and default formatting implemented automatically in the editor.

### Claim 16 (depends on 10)

The computer program product of claim 10, wherein the transforming comprises:
identifying, by the one or more processors, one or more references in the modified version;
determining, by the one or more processors, whether the one or more references should be preserved; and
based on determining that a portion of the one or more references should be preserved, accessing, by the one or more processors, mapping tables generated as part of creating a build of the modified version and designating locations of the portion in first storage structure of the one or more references in the mapping tables.

### Claim 17 (depends on 16)

The computer program product of claim 16, the method further comprising:
obtaining, by the one or more processors, from the client, via the communication connection over the network, a request to obtain a most recent version of the program source code from the repository;
extracting, by the one or more processors, a set structure representing the most recent version from the repository, wherein the extracting comprises synthesizing the one or more differences in the repository and the second storage structure into the set structure representing the most recent version;
identifying, by the one or more processors, selected formatting for program source code displayed in the editor; and
converting, by the one or more processors, the most recent version of the program source code into a format editable in the editor and applying the identified formatting to the most recent version in the format generating a formatted most recent version, wherein the converting comprises accesses the mapping tables to insert the portion into the formatted most recent version.

### Claim 18

A system comprising:
a memory;
one or more processors in communication with the memory; and
program instructions executable by the one or more processors via the memory to perform a method, the method comprising:
obtaining, by the one or more processors of a host, from a client, via a communication connection over a network, a request to commit a modified version of program source code to a repository administered by the host;
identifying, by the one or more processors, formatting in the modified version implemented by an editor executing on the client;
removing, by the one or more processors, the identified formatting from the modified version;
transforming, by the one or more processors, the modified version into a first storage structure comprising content of the modified version without the identified formatting, wherein the first storage structure comprises a canonical internal representation, wherein the transforming comprises:
identifying, by the one or more processors, a programming language comprising the modified version; and
based on identifying the language, applying, by the one or more processors, a language-specific tool to build the canonical internal representations;
identifying, by the one or more processors, one or more differences between the first storage structure representing the modified version and a second storage structure, wherein the second storage structure comprises an unmodified version of the program source code stored in the repository; and
storing, by the one or more processors, the one or more differences in the repository.
