Merge "Improve windows support for git-review --setup"

This commit is contained in:
Jenkins 2014-08-05 13:17:47 +00:00 committed by Gerrit Code Review
commit 499a2f3dbc
3 changed files with 13 additions and 3 deletions

View File

@ -274,7 +274,9 @@ def set_hooks_commit_msg(remote, target_file):
userhost = hostname
else:
userhost = "%s@%s" % (username, hostname)
cmd = ["scp", userhost + ":hooks/commit-msg", target_file]
# OS independent target file
scp_target_file = target_file.replace(os.sep, "/")
cmd = ["scp", userhost + ":hooks/commit-msg", scp_target_file]
if port is not None:
cmd.insert(1, "-P%s" % port)

View File

@ -122,8 +122,8 @@ class GerritHelpers(object):
def _run_git_review(self, *args, **kwargs):
"""Run git-review utility from source."""
git_review = utils.run_cmd('which', 'git-review')
return utils.run_cmd(git_review, *args,
chdir=self.test_dir, **kwargs)
kwargs.setdefault('chdir', self.test_dir)
return utils.run_cmd(git_review, *args, **kwargs)
class BaseGitReviewTestCase(testtools.TestCase, GerritHelpers):

View File

@ -19,6 +19,7 @@ import os
import shutil
from git_review import tests
from git_review.tests import utils
class GitReviewTestCase(tests.BaseGitReviewTestCase):
@ -59,6 +60,13 @@ class GitReviewTestCase(tests.BaseGitReviewTestCase):
self._simple_change('test file modified', 'test commit message 2')
self.assertIn('Change-Id:', self._run_git('log', '-1'))
def test_git_review_s_from_subdirectory(self):
"""Test git-review -s from subdirectory."""
self._run_git('remote', 'rm', 'gerrit')
utils.run_cmd('mkdir', 'subdirectory', chdir=self.test_dir)
self._run_git_review(
'-s', chdir=os.path.join(self.test_dir, 'subdirectory'))
def test_git_review_d(self):
"""Test git-review -d."""
self._run_git_review('-s')