3641: rbt post with Subversion fails when including file with absolute path

gmyers
What version are you running?
RBTools 0.6.2
svn 1.6.11

What's the URL of the page containing the problem?
n/a

What steps will reproduce the problem?
1. See below

What is the expected output? What do you see instead?
Expect: Correct posting of code to RB server.
Instead: The file was not found in the repository. (HTTP 400, API Error 207) 

What operating system are you using? What browser?
CentOS 6.5

Please provide any additional information below.

I think there is a bug in convert_to_absolute_paths() in svn.py.  There is logic here (approx line 532) that assumes a path in a diff is absolute if it begins with a '/'.  But, this does not seem to differentiate between the possibility that a path is absolute relative to an SVN repo versus absolute relative to the local filesystem.  When an absolute local filesystem path is passed in via the -I switch, the path in the resultant diff does not get updated correctly, such that the RB server does not know how to locate the file in the repo and an API Error 207 results.

The following example illustrates the issue (Note: rbt diff is used as seeing the diff is more informative here, but rbt post can be subbed in to get the API error).  Suppose some repository with a file bad.cpp which has local modifications.  Plain rbt post (with no -I), or rbt post with -I with a relative path performs as expected, such that the resultant diff has the path updated relative to the repository root.  However, rbt post -I with the absolute path to bad.cpp produces a diff with the absolute local filesystem path, which the RB server does not know how to process.

[gmyers@host foo2]$ pwd
/tmp/test/foo2

[gmyers@hostfoo2]$ svn info bad.cpp
Path: bad.cpp
Name: bad.cpp
Working Copy Root Path: /tmp/test/foo2
URL: file:///home/gmyers/svnadmin_test/foo2/bad.cpp
Repository Root: file:///home/gmyers/svnadmin_test/foo2
<snip>

[gmyers@host foo2]$ rbt diff
Index: /bad.cpp
===================================================================
--- /bad.cpp    (revision 9)
+++ /bad.cpp    (working copy)
@@ -1 +1,2 @@
+Add some text.
 This is some text.

[gmyers@host foo2]$ rbt diff -I ../foo2/bad.cpp
Index: /bad.cpp
===================================================================
--- /bad.cpp    (revision 9)
+++ /bad.cpp    (working copy)
@@ -1 +1,2 @@
+Add some text.
 This is some text.

[gmyers@host foo2]$ rbt diff -I /tmp/test/foo2/bad.cpp
Index: /tmp/test/foo2/bad.cpp
===================================================================
--- /tmp/test/foo2/bad.cpp      (revision 9)
+++ /tmp/test/foo2/bad.cpp      (working copy)
@@ -1 +1,2 @@
+Add some text.
 This is some text.
david
#1 david
  • +Component-RBTools
david
#2 david
  • -reviewboard
    +rbtools