Fix pep8 errors with 1.3.1

Also, pin to 1.3.1 so that we don't break as soon as the next
pep8 version comes out.

Change-Id: Ic9d7f7c75e9140e607801728c55858c26cf56621
This commit is contained in:
Mark McLoughlin
2012-06-25 21:57:39 +01:00
parent 3ad95bd821
commit ea5ed21d73
3 changed files with 19 additions and 21 deletions

View File

@@ -255,7 +255,7 @@ def parse_git_show(remote, verb):
(hostname, port) = hostname.split(":") (hostname, port) = hostname.split(":")
# Is origin an ssh location? Let's pull more info # Is origin an ssh location? Let's pull more info
if parsed_url.scheme == "ssh" and port == None: if parsed_url.scheme == "ssh" and port is None:
port = 22 port = 22
return (hostname, username, str(port), project_name) return (hostname, username, str(port), project_name)
@@ -326,11 +326,10 @@ def check_remote(branch, remote, hostname, port, project):
color_never = "" color_never = ""
if remote in run_command("git remote").split("\n"): if remote in run_command("git remote").split("\n"):
remote_branch = "remotes/%s/%s" % (remote, branch)
remotes = run_command("git branch -a %s" % color_never).split("\n") branches = run_command("git branch -a %s" % color_never).split("\n")
for current_remote in remotes: if (not UPDATE and remote_branch in [b.strip() for b in branches]):
if current_remote.strip() == "remotes/%s/%s" % (remote, branch) \
and not UPDATE:
return return
# We have the remote, but aren't set up to fetch. Fix it # We have the remote, but aren't set up to fetch. Fix it
if VERBOSE: if VERBOSE:
@@ -338,7 +337,7 @@ def check_remote(branch, remote, hostname, port, project):
update_remote(remote) update_remote(remote)
return return
if hostname == False or port == False or project == False: if not (hostname and port and project):
# This means there was no .gitreview file # This means there was no .gitreview file
print("No '.gitreview' file found in this repository.") print("No '.gitreview' file found in this repository.")
print("We don't know where your gerrit is. Please manually create ") print("We don't know where your gerrit is. Please manually create ")
@@ -405,8 +404,8 @@ def assert_one_change(remote, branch, yes, have_hook):
use_color = "--color=%s" % color use_color = "--color=%s" % color
else: else:
use_color = "" use_color = ""
cmd = "git log %s --decorate --oneline %s --not remotes/%s/%s" % \ cmd = "git log --decorate --oneline " + use_color
(use_color, branch_name, remote, branch) cmd += " %s --not remotes/%s/%s" % (branch_name, remote, branch)
(status, output) = run_command_status(cmd) (status, output) = run_command_status(cmd)
if status != 0: if status != 0:
print("Had trouble running %s" % cmd) print("Had trouble running %s" % cmd)
@@ -423,8 +422,7 @@ def assert_one_change(remote, branch, yes, have_hook):
sys.exit(1) sys.exit(1)
elif output_lines > 1: elif output_lines > 1:
if not yes: if not yes:
print("You have more than one commit" print("You are about to submit more than one commit.")
" that you are about to submit.")
print("The outstanding commits are:\n\n%s\n" % output) print("The outstanding commits are:\n\n%s\n" % output)
print("Is this really what you meant to do?") print("Is this really what you meant to do?")
yes_no = raw_input("Type 'yes' to confirm: ") yes_no = raw_input("Type 'yes' to confirm: ")
@@ -653,8 +651,8 @@ def download_review(review, masterbranch, remote):
refspec = r.patchset.ref refspec = r.patchset.ref
print("Downloading %s from gerrit into %s" % (refspec, branch_name)) print("Downloading %s from gerrit into %s" % (refspec, branch_name))
(status, output) = run_command_status("git fetch %s %s" (status, output) = run_command_status("git fetch %s %s" %
% (remote, refspec)) (remote, refspec))
if status != 0: if status != 0:
print(output) print(output)
return status return status
@@ -746,7 +744,7 @@ def do_submit(options, config):
cmd = "git push %s HEAD:refs/%s/%s/%s" % (remote, ref, branch, cmd = "git push %s HEAD:refs/%s/%s/%s" % (remote, ref, branch,
topic) topic)
if options.dry: if options.dry:
print("Please use the following command " \ print("Please use the following command "
"to send your commits to review:\n") "to send your commits to review:\n")
print("\t%s\n" % cmd) print("\t%s\n" % cmd)
else: else:
@@ -806,7 +804,7 @@ def main():
parser.add_argument("--license", dest="license", action="store_true", parser.add_argument("--license", dest="license", action="store_true",
help="Print the license and exit") help="Print the license and exit")
parser.add_argument("--version", action="version", parser.add_argument("--version", action="version",
version='%s version %s' % \ version='%s version %s' %
(os.path.split(sys.argv[0])[-1], version)) (os.path.split(sys.argv[0])[-1], version))
subparsers = parser.add_subparsers() subparsers = parser.add_subparsers()

View File

@@ -3,7 +3,7 @@ envlist = py26,py27
[testenv] [testenv]
setenv = VIRTUAL_ENV={envdir} setenv = VIRTUAL_ENV={envdir}
deps = pep8 deps = pep8==1.3.1
argparse argparse
commands = pep8 --show-source setup.py git-review commands = pep8 --show-source setup.py git-review