4789: rbt post doesn't respect --use-client-spec setting to git p4

innot

What version are you running?

rbt --version
RBTools 0.7.6

What steps will reproduce the problem?

Create a git repository based on perforce repo using P4CLIENT=repo git p4 clone --use-client-spec --destination git-repo //depot/group.
The perforce view mapping (modified):
//depot/group/kit0/Dev/... //repo/kit0/...
//depot/group/kit1/Dev/main/... //repo/kit1/...
-//depot/group/kit1/Dev/main/src/dir0/... //repo/kit1/src/dir0/...
+//depot/group/kit1/Dev/Modules/module0/... //repo/kit1/...

This gives the following file structure:
kit0/
f0 // from kit0/Dev/
f1 // ..
kit1/
src/
dir0/
f2 // from kit1/Dev/Modules/module0
f3 // ...
f4 // from kit1/Dev/main
f5 // ...

Create a commit:
echo a >> kit0/f0
echo b >> kit1/src/dir0/f2
git commit -am 'test'

Post review:
rbt post HEAD

What is the expected output? What do you see instead?

I expect that the reviewboard will show diffs to depot files
//depot/group/kit0/Dev/f0
//depot/group/kit1/Dev/Modules/module0/src/dir0/f2

Instead, the diffs are applied to files:
//depot/group/kit0/f0
//depot/group/kit1/src/dir0/f2

Basically, the path relevant to the git root is appended to the base of p4 repo (as passed to git p4 clone).

What operating system are you using?

RHEL 6.5

Attach the debug out from the command.

$ rbt <command> --debug <args>
<debug output>

rbt post --debug --target-people=maximb HEAD

RBTools 0.7.6
Python 2.7.2 (default, Mar 26 2013, 18:57:24)
[GCC 4.4.4 20100726 (Red Hat 4.4.4-13)]
Running on Linux-2.6.32-431.11.2.el6.x86_64-x86_64-with-redhat-6.5-Santiago
Home = ...
Current directory = ...
Checking for a Subversion repository...
Running: svn --non-interactive info
Command exited with rc 1: ['svn', '--non-interactive', u'info']
svn: '.' is not a working copy


Checking for a Git repository...
Running: git rev-parse --git-dir
Running: git config core.bare
Running: git rev-parse --show-toplevel
Running: git symbolic-ref -q HEAD
Running: git config --get git-p4.port
Command exited with rc 1: ['git', 'config', '--get', 'git-p4.port']


repository info: Path: ..., Base path: , Supports changesets: False
Running: git config --get reviewboard.url
Making HTTP GET request to http://reviewboard/reviews/api/
Running: git rev-parse HEAD
Running: git rev-parse 19e8d1477cc1071aea0a3055253f0651db28e132^
Running: git merge-base fc7e642fedaee9a4a3f304e68c43851e3202bcb3 remotes/p4/master
Running: git rev-parse --git-dir
Running: git version
Running: git -c core.quotepath=false diff --no-color --no-prefix -r -u --no-ext-diff fc7e642fedaee9a4a3f304e68c43851e3202bcb3.. 19e8d1477cc1071aea0a3055253f0651db28e132
Running: git log fc7e642fedaee9a4a3f304e68c43851e3202bcb3
Running: p4 files //depot/group/kit0/f0@1691273
Running: p4 files //depot/group/kit1/src/dir0/f2@1691273
Making HTTP GET request to http://reviewboard/reviews/api/validation/diffs/
Cached response for HTTP GET http://reviewboard/reviews/api/validation/diffs/ expired and was modified
Making HTTP POST request to http://reviewboard/reviews/api/validation/diffs/
Making HTTP GET request to http://reviewboard/reviews/api/review-requests/?only-links=create&only-fields=
Cached response for HTTP GET http://reviewboard/reviews/api/review-requests/?only-links=create&only-fields= expired and was modified
Making HTTP POST request to http://reviewboard/reviews/api/review-requests/
Making HTTP GET request to http://reviewboard/reviews/api/review-requests/232479/diffs/?only-fields=
Added cache entry for HTTP GET request to http://reviewboard/reviews/api/review-requests/232479/diffs/?only-fields=
Making HTTP POST request to http://reviewboard/reviews/api/review-requests/232479/diffs/
Making HTTP GET request to http://reviewboard/reviews/api/review-requests/232479/draft/?only-fields=commit_id
Added cache entry for HTTP GET request to http://reviewboard/reviews/api/review-requests/232479/draft/?only-fields=commit_id
Running: git log --reverse --pretty=format:%s%n%n%b ^fc7e642fedaee9a4a3f304e68c43851e3202bcb3 19e8d1477cc1071aea0a3055253f0651db28e132
Making HTTP PUT request to http://reviewboard/reviews/api/review-requests/232479/draft/
Review request #232479 posted.

http://reviewboard/reviews/r/232479/
http://reviewboard/reviews/r/232479/diff/

Please provide any additional information below.

Looking at the source of def make_perforce_diff(self, merge_base, diff_lines) in clients/git.py, I think it just appends the base p4 path to the git path: ['p4', 'files', base_path + filename + '@' + p4rev].

In the presence of client spec, it probably needs to query the real path from git somehow (similarly to how git-p4 does it).

I also experimented with passing several paths to git p4 clone, and in that case the paths passed to reviewboard consist of all those paths concatenated (like /depot/path1 depot/path2 depot/path3/file0.

Maybe it can be considired a feature request.

Thank you.