Fix problem with displaying java diffs of maven projects in clearcase (main in path) - issue 3857

Review Request #7261 — Created April 29, 2015 and discarded

Information

Review Board
master

Reviewers

What version are you running?
2.0.15

What's the URL of the page containing the problem?
/reviewboard/r/530/diff/

What steps will reproduce the problem?
1. Post diffs of a java maven project inside a clearcase repo
2. Go to server.com/reviewboard/r/530/diff/

What is the expected output? What do you see instead?
Filenames of diff are correct.
"MavenProject/src/main/java/package/Filename.java"
instead the diff file name ends behind src
"MavenProject/src"

For files in the test folder it works "MavenProject/src/test/java/package/FilenameTest.java"

What operating system are you using? What browser?
Win 2008 Server R2

Please provide any additional information below.
Error in ReviewBoard-2.0.15-py2.7.egg\reviewboard\scmtools\clearcase.py
line 53

# This regular expression can extract from extended_path
# pure system path. It is construct from two main parts.
# First match everything from beginning of line to first
# occurence of /. Second match parts between /main and
# numbers (file version).
# This patch assume each branch present in extended_path
# was derived from /main and there is no file or directory
# called "main" in path.
UNEXTENDED = re.compile(r'^(.+?)/|/?(.+?)/main/?.*?/([0-9]+|CHECKEDOUT)')

As mentioned in the comment, this path is not expected to contain a "/main".

For Maven projects a src/main/java folder is required!

Fix
As mentioned in line 74-80:
ClearCase paths contain additional informations about branch
and file version preceded by @@/main/. This function remove this
parts from ClearCase path to make it more readable
For example this function convert extended path::

   /vobs/comm@@/main/122/network@@/main/55/sntp
   @@/main/4/src@@/main/1/sntp.c@@/main/8

to the the to regular path::

Clearcase not only add the /main it adds @@/main

Therefore checking the regex for @@/main fixes the problem.
Then, in the line 96 we can get rid of the replace.('@@','').

Best regards, Stefan

Tested with the commit which failed before. (See screenshots)


reviewbot
  1. Tool: PEP8 Style Checker
    Processed Files:
        reviewboard/scmtools/clearcase.py
    
    
    
    Tool: Pyflakes
    Processed Files:
        reviewboard/scmtools/clearcase.py
    
    
  2. 
      
ST
ST
Review request changed
Status:
Discarded