Align git helper funcs
This commit is contained in:
+3
-3
@@ -8,7 +8,7 @@ from milc import cli
|
||||
DEFAULT_UPSTREAM = 'https://github.com/qmk/qmk_firmware'
|
||||
|
||||
|
||||
def git_clone(url, destination, branch):
|
||||
def git_clone(destination, url, branch):
|
||||
"""Add the qmk/qmk_firmware upstream to a qmk_firmware clone."""
|
||||
git_clone = [
|
||||
'git',
|
||||
@@ -44,7 +44,7 @@ def git_set_upstream(destination):
|
||||
git_remote = [
|
||||
'git',
|
||||
'-C',
|
||||
destination,
|
||||
str(destination),
|
||||
'remote',
|
||||
'add',
|
||||
'upstream',
|
||||
@@ -78,7 +78,7 @@ def git_clone_fork(destination, baseurl, fork, branch, force=False):
|
||||
if force:
|
||||
rmtree(destination)
|
||||
|
||||
if not git_clone(url, destination, branch):
|
||||
if not git_clone(destination, url, branch):
|
||||
return False
|
||||
|
||||
return git_set_upstream(destination)
|
||||
|
||||
@@ -25,4 +25,4 @@ def clone(cli):
|
||||
cli.log.error('Destination already exists: %s', cli.args.destination)
|
||||
return False
|
||||
|
||||
return git_clone(git_url, cli.args.destination, cli.args.branch)
|
||||
return git_clone(cli.args.destination, git_url, cli.args.branch)
|
||||
|
||||
+4
-4
@@ -8,7 +8,7 @@ import qmk_cli.git
|
||||
@patch("qmk_cli.git.subprocess.Popen", side_effect=Exception("foobar"))
|
||||
@patch("qmk_cli.git.cli.log.error")
|
||||
def test_git_clone_except(mock_log_error, mock_popen):
|
||||
ret = qmk_cli.git.git_clone('https://github.com/qmk/qmk_firmware', '/tmp', 'master')
|
||||
ret = qmk_cli.git.git_clone('/tmp', 'https://github.com/qmk/qmk_firmware', 'master')
|
||||
|
||||
assert "Could not run" in str(mock_log_error.call_args_list)
|
||||
assert "Exception:foobar" in str(mock_log_error.call_args_list)
|
||||
@@ -20,7 +20,7 @@ def test_git_clone_logs_output(mock_popen, capsys):
|
||||
type(mock_popen().__enter__()).returncode = PropertyMock(return_value=0)
|
||||
type(mock_popen().__enter__()).stdout = PropertyMock(return_value=['asdf'])
|
||||
|
||||
ret = qmk_cli.git.git_clone('https://github.com/qmk/qmk_firmware', '/tmp', 'master')
|
||||
ret = qmk_cli.git.git_clone('/tmp', 'https://github.com/qmk/qmk_firmware', 'master')
|
||||
|
||||
captured = capsys.readouterr().out
|
||||
assert 'asdf' in captured
|
||||
@@ -31,7 +31,7 @@ def test_git_clone_logs_output(mock_popen, capsys):
|
||||
def test_git_clone_captures_exit_code(mock_popen):
|
||||
type(mock_popen().__enter__()).returncode = PropertyMock(return_value=1)
|
||||
|
||||
ret = qmk_cli.git.git_clone('https://github.com/qmk/qmk_firmware', '/tmp', 'master')
|
||||
ret = qmk_cli.git.git_clone('/tmp', 'https://github.com/qmk/qmk_firmware', 'master')
|
||||
|
||||
assert ret is False
|
||||
|
||||
@@ -95,7 +95,7 @@ def test_git_clone_fork_force(git_set_upstream, git_clone, temp_directory):
|
||||
@pytest.mark.integration
|
||||
def test_git_clone(temp_directory):
|
||||
qmk_firmware = temp_directory / 'qmk_firmware'
|
||||
ret = qmk_cli.git.git_clone('https://github.com/qmk/qmk_firmware', qmk_firmware.as_posix(), 'master')
|
||||
ret = qmk_cli.git.git_clone(qmk_firmware.as_posix(), 'https://github.com/qmk/qmk_firmware', 'master')
|
||||
|
||||
from qmk_cli.helpers import is_qmk_firmware
|
||||
|
||||
|
||||
Reference in New Issue
Block a user