3365: rbt patch fails when used against Perforce repository

shank******@gmai***** (Google Code) (Is this you? Claim this profile.)
May 22, 2014
What version are you running?
rbt patch fails when used agaist perforce

What's the URL of the page containing the problem?
Not URL specific

What steps will reproduce the problem?
1. creater a code review request against perforce using rbt post <perforce changelist no here> and publish it.
Now on some other machine try to download the changes using rbt patch.

What is the expected output? What do you see instead?
Code sent for review gets downloaded and applied to perforce workspace.
Actual :-
I see this in review board webUI:- 

Review Request #11 - Created May 7, 2014 and updated 1 week ago

So i assumed that review-request-id = 11
rbt patch -d 11

>>> RBTools 0.6
>>> Python 2.7.6 (default, Nov 10 2013, 19:24:18) [MSC v.1500 32 bit (Intel)]
>>> Running on Windows-7-6.1.7601-SP1
>>> Home = C:\Users\shankarkc\AppData\Roaming
>>> Current directory = d:\ariba\s2837\ariba
>>> Checking for a Subversion repository...
>>> Unable to execute "svn help": skipping SVN
>>> Checking for a Git repository...
>>> Unable to execute "git --help" or "git.cmd --help": skipping Git
>>> Checking for a Mercurial repository...
>>> Unable to execute "hg --help": skipping Mercurial
>>> Checking for a CVS repository...
>>> Unable to execute "cvs": skipping CVS
>>> Checking for a Perforce repository...
>>> Running: p4 info
>>> Running: diff --version
>>> repository info: Path: ['perforce3:1666', 'PERFORCE3:1666'], Base path: None
, Supports changesets: True
>>> Making HTTP GET request to
>>> Making HTTP GET request to

Patch is being applied from request 11 with diff revision  1.
Traceback (most recent call last):
  File "C:\Python27\Scripts\rbt-script.py", line 9, in <module>
    load_entry_point('RBTools==0.6.dev', 'console_scripts', 'rbt')()
  File "C:\Python27\lib\site-packages\rbtools-0.6.dev-py2.7.egg\rbtools\commands
\main.py", line 134, in main
    command.run_from_argv([RB_MAIN, command_name] + args)
  File "C:\Python27\lib\site-packages\rbtools-0.6.dev-py2.7.egg\rbtools\commands
\__init__.py", line 422, in run_from_argv
    exit_code = self.main(*args) or 0
  File "C:\Python27\lib\site-packages\rbtools-0.6.dev-py2.7.egg\rbtools\commands
\patch.py", line 141, in main

    tmp_patch_file, base_dir)
  File "C:\Python27\lib\site-packages\rbtools-0.6.dev-py2.7.egg\rbtools\commands
\patch.py", line 82, in apply_patch
    base_dir, self.options.px)
  File "C:\Python27\lib\site-packages\rbtools-0.6.dev-py2.7.egg\rbtools\clients\
__init__.py", line 163, in apply_patch
    p_num = p or self._get_p_number(patch_file, base_path, base_dir)
  File "C:\Python27\lib\site-packages\rbtools-0.6.dev-py2.7.egg\rbtools\clients\
__init__.py", line 136, in _get_p_number
    if (base_dir.startswith(base_path)):
TypeError: startswith first arg must be str, unicode, or tuple, not NoneType

What operating system are you using? What browser?
Windows 7 and chrome browser.

Please provide any additional information below.
These are the args that are passed to the method. I got them using print statement.
diff_file_path:- c:\users\shanka~1\appdata\local\temp\tmpzusqly, repository_info.base_path :- None, 
base_dir :- ,
self.options.px :- None.

It looked like its failing bcz base_dir empty and repository_info.base_path :- None

David Trowbridge asked me to open a bug as he suspected there is a issue with rbt patch.
#1 david
  • +PendingReview
#2 david
Fixed in release-0.6.x (09ee08e). Thanks!
  • -PendingReview