The Three-Way Merge. Part of the magic here relies on the VCS locating the original version of the file. This original version is better known as the 'nearest common ancestor.' The VCS then passes the common ancestor and the two contributors to the three-way merge tool that will use all three to calculate the result.
While writing program files or normal text files, programmers and writers sometimes want to know the difference between two files or two versions of the same file. When you compare two computer files on Linux, the difference between their contents is called a diff. This description was born out of a reference to the output of diff, the well known Unix command-line file comparison utility.
There are several file comparison tools that you can use on Linux, and in this review, we shall look at some of the best terminal based and GUI diff tools you can take advantage of while writing code or other text files.
1. diff Command
I like to start with the original Unix command-line tool that shows you the difference between two computer files. Diff is simple and easy to use, it comes pre-installed on most Linux distributions. It compares files line by line and outputs the difference between them.
You can check out the manual entry for diff to easily use it.
Linux diff Command to Compare Files
There are some wrappers for the diff tool that enhance its functionality and these include:
colordiff Command
Colordiff is a Perl script that produces same output as diff, but with color and syntax highlighting. It has customizable color schemes.
You can install Colordiff on your Linux systems, using default package manager tools called yum, dnf or apt-get as shown.
You can check out the manual entry for Colordiff as shown.
wdiff Command
The wdiff utility is a front end to diff command used to compare files on a word by word basis. This program is very useful when comparing two texts for changed words and for which paragraphs have been refilled.
To install wdiff on your Linux systems, run:
Use wdiff manual for how to use it on Linux.
wdiff Compare Two Files in Linux
2. Vimdiff Command
Vimdiff works in an advanced manner in comparison to diff utility. It enables a user to edit up to four versions of a file while showing their differences. When you run it, Vimdiff opens two or three or four files using vim text editor.
Visit Homepage: http://vimdoc.sourceforge.net/htmldoc/diff.html
Having looked the old school diff tools, lets quickly move to some GUI diff tools available on Linux.
3. Kompare
Kompare is a diff GUI wrapper that allows users to view differences between files and also merge them.
Some of its features include:
- Supports multiple diff formats
- Supports comparison of directories
- Supports reading diff files
- Customizable interface
- Creating and applying patches to source files
Kompare Tool – Compare Two Files in Linux
Visit Homepage: https://www.kde.org/applications/development/kompare/
4. DiffMerge
DiffMerge is a cross-platform GUI application for comparing and merging files. It has two functionality engines, the Diff engine which shows the difference between two files, which supports intra-line highlighting and editing and a Merge engine which outputs the changed lines between three files.
It has got the following features:
- Supports directory comparison
- File browser integration
- Highly configurable
Visit Homepage: https://sourcegear.com/diffmerge/
5. Meld – Diff Tool
Meld is a lightweight GUI diff and merge tool. It enables users to compare files, directories plus version controlled programs. Built specifically for developers, it comes with the following features:
- Two-way and three-way comparison of files and directories
- Update of file comparison as a users types more words
- Makes merges easier using auto-merge mode and actions on changed blocks
- Easy comparisons using visualizations
- Supports Git, Mercurial, Subversion, Bazaar plus many more
Meld – A Diff Tool to Compare File in Linux
Visit Homepage: http://meldmerge.org/
6. Diffuse – GUI Diff Tool
Diffuse is another popular, free, small and simple GUI diff and merge tool that you can use on Linux. Written in Python, It offers two major functionalities, that is: file comparison and version control, allowing file editing, merging of files and also output the difference between files.
You can view a comparison summary, select lines of text in files using a mouse pointer, match lines in adjacent files and edit different file. Other features include:
- Syntax highlighting
- Keyboard shortcuts for easy navigation
- Supports unlimited undo
- Unicode support
- Supports Git, CVS, Darcs, Mercurial, RCS, Subversion, SVK and Monotone
Visit Homepage: http://diffuse.sourceforge.net/
7. XXdiff – Diff and Merge Tool
XXdiff is a free, powerful file and directory comparator and merge tool that runs on Unix like operating systems such as Linux, Solaris, HP/UX, IRIX, DEC Tru64. One limitation of XXdiff is its lack of support for unicode files and inline editing of diff files.
It has the following list of features:
- Shallow and recursive comparison of two, three file or two directories
- Horizontal difference highlighting
- Interactive merging of files and saving of resulting output
- Supports merge reviews/policing
- Supports external diff tools such as GNU diff, SIG diff, Cleareddiff and many more
- Extensible using scripts
- Fully customizable using resource file plus many other minor features
xxdiff Tool
Visit Homepage: http://furius.ca/xxdiff/
8. KDiff3 – – Diff and Merge Tool
KDiff3 is yet another cool, cross-platform diff and merge tool made from KDevelop. It works on all Unix-like platforms including Linux and Mac OS X, Windows.
It can compare or merge two to three files or directories and has the following notable features:
- Indicates differences line by line and character by character
- Supports auto-merge
- In-built editor to deal with merge-conflicts
- Supports Unicode, UTF-8 and many other codecs
- Allows printing of differences
- Windows explorer integration support
- Also supports auto-detection via byte-order-mark “BOM”
- Supports manual alignment of lines
- Intuitive GUI and many more
Visit Homepage: http://kdiff3.sourceforge.net/
9. TkDiff
TkDiff is also a cross-platform, easy-to-use GUI wrapper for the Unix diff tool. It provides a side-by-side view of the differences between two input files. It can run on Linux, Windows and Mac OS X.
Additionally, it has some other exciting features including diff bookmarks, a graphical map of differences for easy and quick navigation plus many more.
Visit Homepage: https://sourceforge.net/projects/tkdiff/
Having read this review of some of the best file and directory comparator and merge tools, you probably want to try out some of them. These may not be the only diff tools available you can find on Linux, but they are known to offer some the best features, you may also want to let us know of any other diff tools out there that you have tested and think deserve to be mentioned among the best.
Merging/Importing Objects from Different Repositories using Oracle BI Administration Tool
Purpose
This tutorial covers how to merge/import objects from different repositories using the BI Administration tool. The three-way merge technique is discussed in various scenarios — such as three way with common parent (also called standard three-way merge), three-way merge with no common parent (sometimes called as two-way merge).
Note: This tutorial is intended for learners who are already familiar with Oracle BI Administration tool, and have completed the Oracle by Example tutorial 'Creating a Repository using Oracle Business Intelligence Administration Tool.' Also it is recommended that the learners also go through the OBE 'Setting Up Multi-User Development Environment (MUDE) Using Oracle BI Administration Tool' to understand how the merging is done in a multiuser environment.
Time to Complete
Approximately 30-40 minutes.
Topics
This tutorial covers the following topics:
Overview | |
Scenario | |
Prerequisites | |
Overview of Three Way Merge: Scenarios | |
Merging the Objects from Different Repositories with a Common Parent (The Standard 3-Way Merge) | |
Merging/Importing Objects from Different Repositories With No Common Parent | |
Summary | |
Related Information |
Viewing Screenshots
Place the cursor over this icon to load and view all the screenshots for this tutorial. (Caution: This action loads all screenshots simultaneously, so response time may be slow depending on your Internet connection.)
Note: Alternatively, you can place the cursor over each individual icon in the following steps to load and view only the screenshot associated with that step.
Overview
This tutorial covers how to merge/import objects from different repositories using the BI Administration tool. You will be guided to merge/import the objects in different scenarios — such as three way with common parent (also called standard three-way merge), three-way merge with no common parent (sometimes called as two-way merge). This tutorial also covers the concepts of Web Catalog migration for archiving and unarchiving repository objects with an example.
Scenario
You should be familiar with the functionality of the BI Administration tool. This tutorial uses Sales History repository (SH.rpd), and the rpd file along with the instructions to set up the same are provided in the Prerequisites section.
So, to continue with the steps listed in the topics, you should have installed the required software, and performed the setup for SH.rpd repository, and other steps as mentioned in the Prerequisites section.
Prerequisites
Before starting this tutorial, you should:
1. | Have access to or have installed Oracle Database 10g (preferably version 10.2) | |
2. | Have access to or have installed the sample schemas (specifically SH) | |
3. | Have installed Oracle BI Enterprise Edition 10.1.3.3. | |
4. | Have completed the tutorial'Creating a Repository using Oracle Business Intelligence Administration Tool.' It is also recommended that you complete the tutorial 'Setting Up Multi-User Development Environment using Oracle BI Administration Tool.' | |
5. | Have set up the Sales History (SH.rpd) repository following the instructions given here:
Note: Screen captures for this tutorial were taken in a Windows XP environment. Therefore, the Start menu options may vary slightly if you are using any other Windows environment. |
Overview of Three-Way Merge: Scenarios
You can set up and work in a multiuser development environment (MUDE) and finally merge the changes made by multiple developers/users into a repository using the BI Administration tool. The Oracle BI repository development process adheres to the classic Software Configuration Management (SCM) process, which utilizes a three-way merge to manage concurrent development. Changes are managed by merge and reconciliation. Most of the merging process is automatic, and changes do not conflict. In case of any conflicts, developers can resolve them. This is covered in the OBE 'Setting Up Multi-User Development Environment (MUDE) using Oracle BI Administration Tool.'
However, as an administrator you may want to manually merge the changes from multiple repositories or import objects from different repositories outside of MUDE. Oracle BI Enterprise Edition offers inherent support for the classic 3 Way merge in both the multiuser development (MUD) and outside the MUD environments. The two main scenarios (outside of MUDE) are discussed in this tutorial:
The Standard 3 Way Merge (3 Way Merge with Common Parent) : This merge is useful when you have a common parent repository and two derived repositories. For example, you may have a development and a production repository, both derived from a common parent repository. You may want to import/merge the changes from the development repository to the production repository. The three-way merge process in this case is indicated in the diagram on the left where there is a Parent RPD, and two derived RPDs — RPD A, and RPD B. After the merge, a 4th merged repository file ( Merged RPD in the diagram) is created. (Modified or new objects are listed with asterisk '*' beside them ). In RPD A, the object Obj1 is modified, and a new object NewObjX is created. Similarly, a new object NewObjB is created in RPD B. When these two repositories are merged, note that the merged repository contains the obj1 (inherited from parent, and modified in RPD A), and also contains the new objects (NewObjX , NewObjB ) from both the repositories.
3 Way Merge with No Common Parent: This is a special case of merge where you are merging objects from two different repositories with no common parent (sometimes referred to as 2 way merge). For example, as an administrator, you may want to import objects (such as subject areas, folders) from a different repository into your current or working repository. In this case the repositories to be merged do not have a common parent. This scenario is depicted in the diagram (on the right). In this case both the repositories are treated as different and conflicting object names are duplicated (with a suffix #N, N- number) while merging or importing. The diagram indicates this scenario of no common parent, where RPD A and RPD B are treated as separate repositories and are compared to a blank repository. The merging process in this case will not overwrite Obj1; instead both copies of Obj1 (Obj1, Obj1#1*) from RPD A and RPD B are retained in the merged repository. Also, note that new objects from both the repositories (NewObjB*, NewObjX*) are created in the merged repository .
In this tutorial you are guided through the steps to perform the 3 way merge with and also without a common parent repository. Web Catalog migration concepts are also covered. The base repository that you will be using in this tutorial is SH.rpd (which you have installed by performing the steps in the Prerequisites section).
Merging the Objects from Different Repositories With a Common Parent (The Standard 3- Way Merge)
In this topic a simple scenario of standard 3 way merge is discussed. For example, you may have a development or current repository that you are working on, and also a modified repository in which the changes are made (both repositories derived from the same parent). Now you can compare these two repositories with an original repository and merge changes to create a fourth merged repository file. This scenario is simulated in this topic.
Follow the steps listed below:
1. | Navigate to <Install Drive>:OracleBIserverRepository. (Close any instances of the BI Administration tool.) Make three copies of sh.rpd and rename them as sh_original.rpd, sh_current.rpd, and sh_modified.rpd. The folder now should look like the screen below: Note: All the three repository copies are identical as of now, but you will make modifications and merge the changes later. |
2. | Now open the sh_modified.rpd offline in the BI Administration tool. From the Windows All Programs menu, select Oracle Business Intelligence > Administration. Log in as Administrator (password Administrator). |
3. | Now you'll make modifications to the repository. Expand the SH node in the Presentation layer of the BI Administration tool. Expand the Products node. |
4. | Double-click Prod Category to change the properties. The Presentation Column- Prod Category dialog appears. Click Edit. Enter Product Category in the Name field to change the display name of the column. Click OK. Click OK again to close the dialog. Similarly, change the names of the columns Prod Subcategory and Prod Name to Product Subcategory, and Product Name respectively in the Products table of the Presentation Layer. |
5. | Also make some more changes to the repository as follows: Delete the Promotions table from the Presentation layer. Right-click Promotions and select Delete. Click Yes in the confirmation dialog to delete this object. |
6. | Now save this modified repository. Select File > Save to save the changes to the repository file. When prompted to check for global consistency, click No. Note that we are simulating a scenario of a modified repository. In the real-time scenario it may be advisable to check the global consistency, as this would validate the consistency of the metadata repository. Select File > Close to close the sh_modified repository. |
7. | Now open the sh_current.rpd in offline mode as Administrator in BI Administration tool. Note that none of the changes you made before to the other repository are reflected in this, as you haven't merged the changes from the modified repository. |
8. | Now, make the following changes in the current repository: Right-click Demographics in the Presentation layer and select Delete to delete this object. Click Yes to confirm the deletion. |
9. | Now you have a current /working repository (sh_current. rpd), and you have a modified repository (sh_modified.rpd) derived from the same parent repository (sh_original.rpd). The next step is to merge the changes. Select File > Merge in BI Administration window where you have the sh_current repository open. |
10. | The Select Original Repository dialog appears, select sh_original.rpd as the original repository for the merge. Click Open. |
11 | The Merge Repositories window appears. Note that the sh_orginal.rpd repository is reflected in the Original repository field. Also, note that the changes made to the current repository are listed. Select sh_modified.rpd file and click Open. When prompted to enter the password for Administrator, enter Administrator as the password. |
12. | Now click the Select button beside the Save merged repositoryas field, to give a different name than the default name for the merged repository which will be created as a result of this merge process. Enter sh_merged.rpd as the file name and click Save. |
13. | This takes you back to the Merge Repositories window. Select the Show Qualified Names check box, and click the record in the log that is displayed below this option. All the three repositories are displayed with the changes made reflected. Observe the highlighted portions of the screen below: Click Stats to see the statistics: Also click the button to see the details: |
14. | Now you have to make the decision to select the changes in the current repository or modified repository. Select the record that shows the deletion of the Demographics table in the current repository. Scroll to the right to see the Decision column, and select Modified (A) from the drop down list. Note: This option retains the changes in the modified repository over the current repository with reference to the Demographics table. You can also select Current option from the drop-down list, and that will retain the changes in the current repository over the modified repository with reference to Demographics. |
15. | After the decision options are selected, you can see that the Merge option is enabled. Click Merge. When prompted to check the global consistency , click No. |
16. | The sh_merged repository is opened in the BI Administration tool. Note that the changes made to the modified repository are reflected in the merged repository. That is, the Promotions table does not exist in the merged repository Presentation layer, and also the names of the columns are changed in the Products table. However, note that the Demographics table still appears in the merged repository because you have selected Modified (A) option over the Current option in the Decision drop-down list when merging the repositories. Also note that a simple example is discussed here, and there can be many scenarios for the Standard 3 Way Merge. |
Back to Topic List
Merging/Importing the Objects from Different Repositories With No Common Parent
There can be various scenarios for this technique. In this topic, a simple scenario of importing new objects from different repositories is discussed. That is, the objects in both the repositories don't conflict. This scenario is simulated here. First you create a blank repository, and then merge the objects from two different repositories — SH.rpd, and UsageTracking .rpd.
Note: You can find the UsageTracking.rpd file with the product samples in the path: <Install Drive>:OracleBIserverSampleusagetracking
Follow the steps listed below:
1. | First you need to create a blank rpd in the BI Administration tool. (This is a one-time process and can be used for future imports too if required). From the Windows All Programs menu, select Oracle Business Intelligence> Administration. Enter Blank. rpd as the name of this new repository and click Save. You can see that a blank repository is opened in the BI Administration tool. Select File > Close and close the |
2. | Now open the sh.rpd in offline mode as Administrator. (This will be the source repository.)
Log in as Administrator (password Administrator). |
3. | Select File > Merge. If prompted for the Administrator's password, do not enter any password, and click OK. |
4. | The Merge Repositories window opens with the Blank.rpd selected as the Original Repository. Select the Modified Repository dialog that appears. If prompted to enter the password for Administrator user, do not enter any password and click OK. |
5. | Now, click the Select button beside the Save the merged repository as field to give a different name than the default one. Enter a suitable name such as sh_merged_no_CP.rpd (to indicate that this is the destination/merged repository when there is no common parent). |
6. | Now you have to make the decision to select the changes in the current repository or modified repository. When prompted to check for global consistency, click No. Note that we are simulating a scenario of a merge with no common parent. In the real-time scenario it may be advisable to check the global consistency, as this would validate the consistency of the metadata repository. |
7. | The sh_merged_no_CP.rpd is opened in the BI Administration tool after the merge. Observe that the Usage Tracking subject area is imported into this merged repository which was not originally present in the sh. rpd. Observe the new objects that are imported into the Presentation, Business Model and Mapping, and also the Physical layer as a result of this merge. |
Note:However, there can potentially be another scenario of importing the objects with no common parent when a repository has modified or conflicting objects too. This approach is slightly different as you are merging the changes into the same repository that you are working on, and if an object being imported already exists in the repository, it is compared to the existing object and the one with the latest modifications is kept in the merged repository.
Summary
In this tutorial, you learned how to:
Merge objects from different repositories with common parent | |
Merge/Import objects from different repositories with no common parent |
Related Information
To learn more about Oracle Business Intelligence, you can refer to:
Additional OBEs on BI EE on the OTN Web site. | |
The OBE on Setting Up Multiuser Development Environment. |
Place the cursor over this icon to hide all screenshots.