Oct. 12, 2012, 1:12 p.m.
IT

IntelliJ Idea and SVN, Comparing Branches

I sometimes have a need to compare a specific file between the trunk of my SVN tree, and another branch of the same code using IntelliJ's built in difference viewer. But I always struggle to set it up correctly. Here is the rundown:

My tree is structured like:

Base -> Client -> Project -> trunk -> src
                          -> branches -> branch1 -> src
                                      -> branch2 -> src
                                      -> branch3 -> src

to compare a file, say src -> com -> package -> File.java between trunk and branch2, you would do this:

  1. In IntelliJ, open up the project in trunk
  2. Locate file File.java
  3. Right click on the file name tab, and select Subversion -> Compare with branch...
  4. Click Configure branches
  5. Under trunk location, specify the path as:

    Base -> Client -> Project -> trunk
    
  6. Click Add... and locate the branch branch2, once selected it will appear in the branch locations list as:

    Base -> Client -> Project -> branches    
    
  7. Click Ok.

  8. Again right click on the file name tab, and select Subversion -> Compare with branch...
  9. Select branches... then in the second popup select branch2.
  10. The files will open side by side.