Navigation to a data definition in a diff context

Navigation to a data definition in a diff context. A diff comparison can be generated between at least two versions of a first file. The diff comparison can identify syntax of at least a first method identified in a portion of syntax that is different between the at least two versions of the first file, the first method defined by a data definition in a second file. The diff comparison can configure syntax of the first method to be a first navigable block of data in at least one of the versions of the first file. At least two versions of the first file can be presented to a user in a file difference window, and a user input can be received selecting the first navigable block of data. Responsive to the user input, the second file can be presented to the user in the file difference window.

BACKGROUND

The present arrangements generally relate to the use of a file difference viewer to present different versions of a file.

A file difference editor is a utility configured to present different versions of a file. Within the file difference editor, different versions of the file are presented. In some instances, a diff comparison is generated to indicate the differences between the different versions. For example, a file difference editor may include a diff comparison utility to generate the diff comparison. The results contained in the diff comparison can be presented in one or more versions of the file, or output to a diff file.

BRIEF SUMMARY

One or more embodiments disclosed within this specification relate to navigation to a data definition in a diff context.

An embodiment can include a method. The method can include, via a processor, generating a first diff comparison between at least two versions of a first file, the first diff comparison identifying syntax of at least a first method identified in a portion of syntax that is different between the at least two versions of the first file, the first method referencing a first data definition in a second file, and the first diff comparison configuring syntax of the first method to be a first navigable block of data in at least one of the versions of the first file. The method further can include presenting to a user the at least two versions of the first file in a file difference window, and receiving a user input selecting the first navigable block of data. Responsive to the user input, the second file can be presented to the user in the file difference window.

Another embodiment can include a data processing system comprising a processor configured to initiate executable operations. The executable operations can include generating a first diff comparison between at least two versions of a first file, the first diff comparison identifying syntax of at least a first method identified in a portion of syntax that is different between the at least two versions of the first file, the first method referencing a first data definition in a second file, and the first diff comparison configuring syntax of the first method to be a first navigable block of data in at least one of the versions of the first file. The executable operations further can include presenting to a user the at least two versions of the first file in a file difference window, and receiving a user input selecting the first navigable block of data. Responsive to the user input, the second file can be presented to the user in the file difference window.

Another embodiment can include a computer program product for navigating to a data definition in a diff context. The computer program product can include a computer-readable storage medium having stored thereon program code that, when executed, configures a processor to perform operations. The executable operations can include generating a first diff comparison between at least two versions of a first file, the first diff comparison identifying syntax of at least a first method identified in a portion of syntax that is different between the at least two versions of the first file, the first method referencing a first data definition in a second file, and the first diff comparison configuring syntax of the first method to be a first navigable block of data in at least one of the versions of the first file. The executable operations further can include presenting to a user the at least two versions of the first file in a file difference window, and receiving a user input selecting the first navigable block of data. Responsive to the user input, the second file can be presented to the user in the file difference window.

DETAILED DESCRIPTION

In accordance with the arrangements described herein, a diff comparison can be generated between two or more versions of a file. The diff comparison can identify syntax of methods contained in the file that are affected by changes between the various versions, and configure the syntax to be navigable blocks of data in the various versions, and identify the navigable blocks of data in a suitable manner, for example using a particular font color, font text, or the like. As such, the diff comparison can indicate differences between the various versions.

The navigable blocks of data can be user selectable. A user can select the navigable blocks of data to open other files that define other data definitions, such as defined classes, referenced by the methods. In illustration, if the user selects a navigable block of data associated with a particular method, a second file that defines a data definition referenced by that method can be opened. Moreover, the file can be presented in the same file difference window in which the various versions of the first file are presented. Further, a diff comparison can be generated for various versions of the second file, and such versions can be presented in the file difference window with additional navigable blocks of data. The user can select these navigable blocks of data to open additional files, and so on.

In addition, syntax for functions identified in the various versions of the files can be configured to be navigable blocks of data. The user can select such navigable blocks of data to open files containing corresponding function declarations, corresponding call hierarchies, and the like.

Accordingly, the user can navigate to various versions of the files to view changes, evaluate how changes to various files affect other files, and so on, all within the same window. Such functionality can greatly increase programmer efficiency in the computer programming and de-bugging process.

Several definitions that apply throughout this document will now be presented.

As used herein, the term “class” means a construct that is used in a computer program to create instances of itself. Such instances may be referred to as class instances, class objects, instance objects or simply objects.

As used herein, the term “method” means a subroutine, procedure or function associated with a class, and defines the behavior to be exhibited by instances of the associated class at program run time.

As used herein, the term “diff context” means a particular session in a particular file difference viewer in which two or more versions of a file are compared. In this regard, the term “diff context” refers to a single session in a single file difference viewer. As used herein, a “file difference viewer” is an application or utility in which differences between two or more versions of a file are viewed (e.g., presented on a display). A file difference viewer may be embodied in, or as, a file difference editor, but this need not be the case.

As used herein, the term “diff comparison” means a programmatic action executed by at least one processor to compare different versions of a file.

As used herein, the term “window” means an enclosed area presented by a graphical user interface on a display in which only a single view generated by a single instance of an executing application or utility is presented. In this regard, a window is distinct from a desktop presented by an operating system, and the window is presented over the desktop. As used herein, the term “file difference window” means a window in which differences between two or more versions of one or more files are depicted. A file difference window can, for example, be presented by a file difference viewer.

As used herein, the term “navigable block of data” means a group of one or more characters or symbols that is user selectable to initiate a programmatic action executed by at least one processor.

As used herein, the term “user” means a person (i.e., human being). A user can be, for example, a computer programmer.

FIG. 1depicts a view of a file difference window (hereinafter “window”)100presented in a diff context in accordance with one embodiment disclosed within this specification. The window100can be presented on a display coupled to, or integrated with, a suitable processing system, for example a general purpose computer comprising at least one processor and memory. The window100can be presented by a file difference viewer executing on the processing system, which can include a user interface for receiving user inputs and presenting the window100.

Via the user interface, a user can select a particular version110of a file to be presented in the window100. In addition, the user can select a previous version120of the file in order to cause the previous version120to be presented in the window100and execute a diff comparison between the version110and the version120. The version120can be a version that immediately precedes the version110, or another prior version of the file. Responsive to the user selections, the versions110,120can be presented in the window100.

When the diff comparison between the versions110,120is executed, the diff comparison can identify differences between the versions110,120. For example, the diff comparison can apply one or more effects to the syntax112,122that distinguishes the syntax112,122from other syntax in the versions110,120, and thus identify the differences. The effects can be visual effects, such as a particular color of font for the syntax112,122, underlining the syntax112,122, italicizing the syntax112,122, presenting the syntax112,122in bold font or a different type of font, applying highlighting to the syntax112,122, or any other suitable effects.

Further, the diff comparison can identify one or more portions of the syntax112,122, such as syntax130, corresponding to one or more methods identified the first version110or the second version120of the file that reference one or more data definitions, such as classes, defined in one or more other files. For example, the diff comparison can identify syntax130for the method “Foo obj=new Foo( ).” The diff comparison can apply one or more effects to the syntax130to distinguish the method130from the rest of the syntax112,122and any other syntax presented in the versions110,120. Further, the first diff comparison can configure syntax130, or a portion of the syntax130, to be a navigable block of data in at least one of the versions110,120of the first file.

The file difference viewer can receive a user input selecting one or more of the navigable blocks of data in either of the versions110,120. In response to receiving a user input selecting the syntax130, the file difference viewer can present to the user, in the window100, the other file in which a data definition referenced by the method in the syntax130is defined. In illustration, if the syntax130references a class “Foo,” the file in which the class “Foo” is defined, as well as methods defined in the class “Foo,” can be presented in the window100, as depicted inFIG. 2. Moreover, a plurality of versions of such file(s) that correspond to the versions110,120can be presented.

Reference now is made toFIG. 2. InFIG. 2, a version210of the file that defines the class “Foo,” and that corresponds to version110, and a version220of the file that defines the class “Foo,” can be presented in the window100in response to the user selecting the syntax130. The file version210can correspond to the file version110if the file version210is used with the file version210in a system (e.g., application or set of applications), and the file version220can correspond to the file version120if the file version220is used with the file version220in the system. In this regard, the versions110,210each can be assigned the same version identifier, and the versions120,220each can be assigned the same version identifier, though this need not be the case so long as some other method is implemented that indicates which versions210,220of the second file (e.g., “Class Foo”) correspond to which versions110,120of the first file (e.g., “Class Sample”).

Further, the diff comparison can be executed to identify differences between the versions210,220. Again, the diff comparison can apply one or more effects to the syntax212,222that distinguishes the syntax212,222from other syntax in the versions210,220, and thus identify the differences. If one or more portions of the syntax212,222references one or more data definitions, such as defined classes, in one or more other files, one or more effects again can be applied to such portions of the syntax212,222, and the syntax for such portions, or portions of such syntax212,222, can be configured to be a navigable block of data, or navigable blocks of data, in the versions210,220, as previously described. Again, if the user selects such a navigable block of data, the file difference viewer can present to the user, in the window100, the other file in which the data definition referenced in such syntax is defined, as well as one or more methods defined in the referenced data definition. These processes can be applied recursively to any number of files that are presented in the window100when the user selects corresponding navigable blocks of data.

By configuring the syntax130, and other identified syntax, to be navigable blocks of data which the user may select to cause other related files containing data definitions to be presented in the window100, the present arrangements facilitate programming and debugging of computer program code. Moreover, because the diff comparison is automatically executed each time a related file is selected using a navigable block of data, the user need not manually initiate the diff comparison for each new file in order to view changes between various versions. Thus, the present arrangements can save the user a significant amount of time when computer programming/debugging one or more applications. Presenting the respective versions110,120,210,220of each of the files within a single window100in the diff context further increases user efficiency.

Referring again toFIG. 1, when the user selects the navigable block corresponding to the syntax130, and the class “Foo”320calls one or more other data definitions, a call hierarchy310can presented in the window100, for example as depicted inFIG. 3. The call hierarchy310can be presented in addition to, or in lieu of, a file (or versions of the file) in which the class “Foo”320is defined. The hierarchy310can identify one or more other data definitions, such as a class330, which define one or more methods called by a method defined in the class320. The hierarchy310also can identify one or more other data definitions, such as a class340, which define one or more methods called by the method defined in the class330, and so on.

FIG. 4is a block diagram illustrating a data processing system400(hereinafter “system400”) for navigating to a data definition in a diff context in accordance with one embodiment disclosed within this specification. The system400can include at least one processor405coupled to memory elements410through a system bus415or other suitable circuitry. As such, the system400can store program code within the memory elements410. The processor405can execute the program code accessed from the memory elements410via the system bus415. In one aspect, for example, system400can be implemented as a computer that is suitable for storing and/or executing program code. It should be appreciated, however, that the system400can be implemented in the form of any system including a processor and memory that is capable of performing the functions and/or operations described within this specification.

The memory elements410can include one or more physical memory devices such as, for example, local memory420and one or more bulk storage devices425. Local memory420refers to RAM or other non-persistent memory device(s) generally used during actual execution of the program code. The bulk storage device(s)425can be implemented as a hard disk drive (HDD), solid state drive (SSD), or other persistent data storage device. The system400also can include one or more cache memories (not shown) that provide temporary storage of at least some program code in order to reduce the number of times program code must be retrieved from the bulk storage device425during execution.

Input/output (I/O) devices such as a keyboard430, a display435, and a pointing device440optionally can be coupled to the system400. The I/O devices can be coupled to the system400either directly or through intervening I/O controllers. One or more network adapters445also can be coupled to the system400to enable the system400to become coupled to other systems, computer systems, remote printers, and/or remote storage devices through intervening private or public networks. Modems, cable modems, and Ethernet cards are examples of different types of network adapters445that can be used with the system400.

As pictured inFIG. 4, the memory elements410can store the difference viewer450, a diff comparison module455and files460. The difference viewer450and a diff comparison module455, being implemented in the form of executable program code, can be executed by the system400and, as such, can be considered part of system400. The difference viewer450can be executed by the processor405to perform the functions and processes described with referenceFIGS. 1,2and3to present various versions of the files460and the call hierarchy in the window as described. The diff comparison module455can be executed by the processor405to perform diff comparisons between different versions of respective files460, identify syntax, apply effects to syntax, configure syntax to be navigable blocks of data, identify files in response to user selection of the navigable blocks of data, generate a call hierarchy, etc., for example as described with reference toFIGS. 1,2and3.

FIG. 5is a flow chart illustrating a method500of navigating to a data definition in a diff context in accordance with another embodiment disclosed within this specification. At step502, one or more user inputs can be received selecting two or more versions of a first file. At step504a first diff comparison can be generated between two or more versions of the first file. The first diff comparison can identify syntax of at least a first method identified in a portion of syntax that is different between the at least two versions of the first file, the first method referencing a first data definition, such as a defined class, in a second file. The first diff comparison can configure syntax of the first method to be a first navigable block of data in at least one of the versions of the first file.

At step506, the selected versions of the first file can be presented in a file difference window. At least one effect can be applied that distinguishes the portion of syntax in a first of the two versions from the portion of syntax in a second of the two versions. Further, at least one effect can be applied that distinguishes the syntax of the method in a first of the two versions from syntax of the method in a second of the two versions.

At step508, a user input can be received selecting the first navigable block of data. At step510, optionally, responsive to the user input selecting the first navigable block of data, a call hierarchy can be presented to the user in the file difference window. The call hierarchy can identify at least a second data definition which defines a second method called by the first method. The call hierarchy further can identify at least a third data definition which defines a third method called by the second method.

At step512, a second diff comparison between the two or more versions of the second file. The second diff comparison can identify syntax of at least a second method identified in the portion of syntax that is different between the two or more versions of the second file. The second method can reference a second data definition in a third file, and the second diff comparison can configure syntax of the second method to be a navigable block of data in at least one of the versions of the second file.

At step514, responsive to the user input, the second file can be presented in the file difference window. For example, at least two versions of the second file can be presented.