Hello,
I used RBTools on Windows, and found out that it doesn't work from Cygwin
shell for perforce.
It turns out that the /cygdrive/<drive letter>, notation for PWD (current
working directory) is passed to p4.
I patched up perforce.py and process.py and seems to work for "rbt post"
and "rbt diff".
Here is the diff of perforce.py
RBTools/Python27/Lib/site-packages/RBTools-0.7.6-py2.7.egg/rbtools/clients/perforce.py
vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
*** perforce.py.original Tue Apr 26 01:09:48 2016
--- perforce.py Fri Nov 11 15:27:52 2016
***************
*** 20,26 ****
TooManyRevisionsError)
from rbtools.utils.checks import check_gnu_diff, check_install
from rbtools.utils.filesystem import make_empty_files, make_tempfile
! from rbtools.utils.process import die, execute
class P4Wrapper(object):
--- 20,26 ----
TooManyRevisionsError)
from rbtools.utils.checks import check_gnu_diff, check_install
from rbtools.utils.filesystem import make_empty_files, make_tempfile
! from rbtools.utils.process import die, execute, get_child_environ
class P4Wrapper(object):
***************
*** 83,89 ****
lines = self.run_p4(['info'],
ignore_errors=True,
split_lines=True)
-
return self._parse_keyval_lines(lines)
def opened(self, changenum):
--- 83,88 ----
***************
*** 131,137 ****
cmd += ['-P', password]
if marshalled:
! p = subprocess.Popen(cmd, stdout=subprocess.PIPE)
result = []
has_error = False
--- 130,136 ----
cmd += ['-P', password]
if marshalled:
! p = subprocess.Popen(cmd, stdout=subprocess.PIPE, env =
get_child_environ())
result = []
has_error = False
***************
*** 157,163 ****
return result
elif input_string is not None:
! p = subprocess.Popen(cmd, stdin=subprocess.PIPE)
p.communicate(input_string) # Send input, wait, set
returncode
if not ignore_errors and p.returncode:
--- 156,162 ----
return result
elif input_string is not None:
! p = subprocess.Popen(cmd, stdin=subprocess.PIPE, env =
get_child_environ())
p.communicate(input_string) # Send input, wait, set
returncode
if not ignore_errors and p.returncode:
***************
*** 226,236 ****
--- 225,237 ----
p4_info.get('Server address'))
if repository_path is None:
+ logging.debug('repository_path is None - no Broker address or
Server address found in p4 info')
return None
client_root = p4_info.get('Client root')
if client_root is None:
+ logging.debug('No Client root in p4 info')
return None
norm_cwd = os.path.normcase(os.path.realpath(os.getcwd()) +
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
RBTools/Python27/Lib/site-packages/RBTools-0.7.6-py2.7.egg/rbtools/utils/process.py
vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
*** process.py.original Tue Apr 26 01:09:48 2016
--- process.py Fri Nov 11 15:28:11 2016
***************
*** 4,12 ****
import os
import subprocess
import sys
!
import six
def die(msg=None):
"""Cleanly exits the program with an error message.
--- 4,26 ----
import os
import subprocess
import sys
! import re
import six
+ UNCYGPATH_RE = re.compile(r'/cygdrive/(\w+)/')
+
+ def uncygwinpath(value):
+ return re.sub(UNCYGPATH_RE, r'\1:/', value)
+
+
+ def get_child_environ(override_env = None):
+ new_env = os.environ.copy()
+ if override_env:
+ new_env.update(override_env)
+ if sys.platform.startswith('win'):
+ new_env = dict((six.binary_type(key),
six.binary_type(uncygwinpath(value))) for key, value in
six.iteritems(new_env))
+ return new_env
+
def die(msg=None):
"""Cleanly exits the program with an error message.
***************
*** 116,131 ****
else:
logging.debug(b'Running: ' + command)
! new_env = os.environ.copy()
!
! if env:
! new_env.update(env)
# TODO: This can break on systems that don't have the en_US locale
# installed (which isn't very many). Ideally in this case, we could
# put something in the config file, but that's not plumbed through to
here.
! new_env['LC_ALL'] = 'en_US.UTF-8'
! new_env['LANGUAGE'] = 'en_US.UTF-8'
if with_errors:
errors_output = subprocess.STDOUT
--- 130,142 ----
else:
logging.debug(b'Running: ' + command)
! new_env = get_child_environ(override_env = env)
# TODO: This can break on systems that don't have the en_US locale
# installed (which isn't very many). Ideally in this case, we could
# put something in the config file, but that's not plumbed through to
here.
! new_env[b'LC_ALL'] = b'en_US.UTF-8'
! new_env[b'LANGUAGE'] = b'en_US.UTF-8'
if with_errors:
errors_output = subprocess.STDOUT
***************
*** 133,145 ****
errors_output = subprocess.PIPE
if sys.platform.startswith('win'):
- # Convert all environment variables to byte strings, so that
subprocess
- # doesn't blow up on Windows.
- new_env = dict(
- (six.binary_type(key), six.binary_type(value))
- for key, value in six.iteritems(new_env)
- )
-
p = subprocess.Popen(command,
stdin=subprocess.PIPE,
stdout=subprocess.PIPE,
--- 144,149 ----
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
--
Supercharge your Review Board with Power Pack:
https://www.reviewboard.org/powerpack/
Want us to host Review Board for you? Check out RBCommons:
https://rbcommons.com/
Happy user? Let us know! https://www.reviewboard.org/users/
---
You received this message because you are subscribed to the Google Groups
"reviewboard" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.