mirror of
https://github.com/Dev-Wiki/git-repo.git
synced 2025-02-23 15:07:28 +08:00
Fix various whitespace issues reported by pyflakes
- E201 whitespace after '[' - E202 whitespace before '}' - E221 multiple spaces before operator - E222 multiple spaces after operator - E225 missing whitespace around operator - E226 missing whitespace around arithmetic operator - E231 missing whitespace after ',' - E261 at least two spaces before inline comment - E271 multiple spaces after keyword Fixed automatically with autopep8: git ls-files | grep py$ | xargs autopep8 --in-place \ --select E201,E202,E221,E222,E225,E226,E231,E261,E271 Change-Id: I367113eb8c847eb460532c7c2f8643f33040308c Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/254601 Reviewed-by: Mike Frysinger <vapier@google.com> Tested-by: David Pursehouse <dpursehouse@collab.net>
This commit is contained in:
parent
42339d7e52
commit
54a4e6007a
@ -138,7 +138,7 @@ class EventLog(object):
|
|||||||
Returns:
|
Returns:
|
||||||
A dictionary of the event added to the log.
|
A dictionary of the event added to the log.
|
||||||
"""
|
"""
|
||||||
event['status'] = self.GetStatusString(success)
|
event['status'] = self.GetStatusString(success)
|
||||||
event['finish_time'] = finish
|
event['finish_time'] = finish
|
||||||
return event
|
return event
|
||||||
|
|
||||||
|
@ -101,7 +101,7 @@ class _GitCall(object):
|
|||||||
return _git_version
|
return _git_version
|
||||||
|
|
||||||
def __getattr__(self, name):
|
def __getattr__(self, name):
|
||||||
name = name.replace('_','-')
|
name = name.replace('_', '-')
|
||||||
def fun(*cmdv):
|
def fun(*cmdv):
|
||||||
command = [name]
|
command = [name]
|
||||||
command.extend(cmdv)
|
command.extend(cmdv)
|
||||||
|
@ -75,7 +75,7 @@ def _key(name):
|
|||||||
parts = name.split('.')
|
parts = name.split('.')
|
||||||
if len(parts) < 2:
|
if len(parts) < 2:
|
||||||
return name.lower()
|
return name.lower()
|
||||||
parts[ 0] = parts[ 0].lower()
|
parts[0] = parts[0].lower()
|
||||||
parts[-1] = parts[-1].lower()
|
parts[-1] = parts[-1].lower()
|
||||||
return '.'.join(parts)
|
return '.'.join(parts)
|
||||||
|
|
||||||
@ -430,7 +430,7 @@ def _open_ssh(host, port=None):
|
|||||||
|
|
||||||
# We will make two calls to ssh; this is the common part of both calls.
|
# We will make two calls to ssh; this is the common part of both calls.
|
||||||
command_base = ['ssh',
|
command_base = ['ssh',
|
||||||
'-o','ControlPath %s' % ssh_sock(),
|
'-o', 'ControlPath %s' % ssh_sock(),
|
||||||
host]
|
host]
|
||||||
if port is not None:
|
if port is not None:
|
||||||
command_base[1:1] = ['-p', str(port)]
|
command_base[1:1] = ['-p', str(port)]
|
||||||
@ -439,13 +439,13 @@ def _open_ssh(host, port=None):
|
|||||||
# ...but before actually starting a master, we'll double-check. This can
|
# ...but before actually starting a master, we'll double-check. This can
|
||||||
# be important because we can't tell that that 'git@myhost.com' is the same
|
# be important because we can't tell that that 'git@myhost.com' is the same
|
||||||
# as 'myhost.com' where "User git" is setup in the user's ~/.ssh/config file.
|
# as 'myhost.com' where "User git" is setup in the user's ~/.ssh/config file.
|
||||||
check_command = command_base + ['-O','check']
|
check_command = command_base + ['-O', 'check']
|
||||||
try:
|
try:
|
||||||
Trace(': %s', ' '.join(check_command))
|
Trace(': %s', ' '.join(check_command))
|
||||||
check_process = subprocess.Popen(check_command,
|
check_process = subprocess.Popen(check_command,
|
||||||
stdout=subprocess.PIPE,
|
stdout=subprocess.PIPE,
|
||||||
stderr=subprocess.PIPE)
|
stderr=subprocess.PIPE)
|
||||||
check_process.communicate() # read output, but ignore it...
|
check_process.communicate() # read output, but ignore it...
|
||||||
isnt_running = check_process.wait()
|
isnt_running = check_process.wait()
|
||||||
|
|
||||||
if not isnt_running:
|
if not isnt_running:
|
||||||
@ -467,7 +467,7 @@ def _open_ssh(host, port=None):
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
_ssh_master = False
|
_ssh_master = False
|
||||||
print('\nwarn: cannot enable ssh control master for %s:%s\n%s'
|
print('\nwarn: cannot enable ssh control master for %s:%s\n%s'
|
||||||
% (host,port, str(e)), file=sys.stderr)
|
% (host, port, str(e)), file=sys.stderr)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
|
10
git_refs.py
10
git_refs.py
@ -18,12 +18,12 @@ import os
|
|||||||
from repo_trace import Trace
|
from repo_trace import Trace
|
||||||
import platform_utils
|
import platform_utils
|
||||||
|
|
||||||
HEAD = 'HEAD'
|
HEAD = 'HEAD'
|
||||||
R_CHANGES = 'refs/changes/'
|
R_CHANGES = 'refs/changes/'
|
||||||
R_HEADS = 'refs/heads/'
|
R_HEADS = 'refs/heads/'
|
||||||
R_TAGS = 'refs/tags/'
|
R_TAGS = 'refs/tags/'
|
||||||
R_PUB = 'refs/published/'
|
R_PUB = 'refs/published/'
|
||||||
R_M = 'refs/remotes/m/'
|
R_M = 'refs/remotes/m/'
|
||||||
|
|
||||||
|
|
||||||
class GitRefs(object):
|
class GitRefs(object):
|
||||||
|
@ -121,7 +121,7 @@ def generate_gitc_manifest(gitc_manifest, manifest, paths=None):
|
|||||||
index = 0
|
index = 0
|
||||||
while index < len(projects):
|
while index < len(projects):
|
||||||
_set_project_revisions(
|
_set_project_revisions(
|
||||||
projects[index:(index+NUM_BATCH_RETRIEVE_REVISIONID)])
|
projects[index:(index + NUM_BATCH_RETRIEVE_REVISIONID)])
|
||||||
index += NUM_BATCH_RETRIEVE_REVISIONID
|
index += NUM_BATCH_RETRIEVE_REVISIONID
|
||||||
|
|
||||||
if gitc_manifest is not None:
|
if gitc_manifest is not None:
|
||||||
|
2
main.py
2
main.py
@ -476,7 +476,7 @@ def init_http():
|
|||||||
n = netrc.netrc()
|
n = netrc.netrc()
|
||||||
for host in n.hosts:
|
for host in n.hosts:
|
||||||
p = n.hosts[host]
|
p = n.hosts[host]
|
||||||
mgr.add_password(p[1], 'http://%s/' % host, p[0], p[2])
|
mgr.add_password(p[1], 'http://%s/' % host, p[0], p[2])
|
||||||
mgr.add_password(p[1], 'https://%s/' % host, p[0], p[2])
|
mgr.add_password(p[1], 'https://%s/' % host, p[0], p[2])
|
||||||
except netrc.NetrcParseError:
|
except netrc.NetrcParseError:
|
||||||
pass
|
pass
|
||||||
|
@ -224,7 +224,7 @@ class XmlManifest(object):
|
|||||||
if self.notice:
|
if self.notice:
|
||||||
notice_element = root.appendChild(doc.createElement('notice'))
|
notice_element = root.appendChild(doc.createElement('notice'))
|
||||||
notice_lines = self.notice.splitlines()
|
notice_lines = self.notice.splitlines()
|
||||||
indented_notice = ('\n'.join(" "*4 + line for line in notice_lines))[4:]
|
indented_notice = ('\n'.join(" " * 4 + line for line in notice_lines))[4:]
|
||||||
notice_element.appendChild(doc.createTextNode(indented_notice))
|
notice_element.appendChild(doc.createTextNode(indented_notice))
|
||||||
|
|
||||||
d = self.default
|
d = self.default
|
||||||
@ -855,7 +855,7 @@ class XmlManifest(object):
|
|||||||
if clone_depth:
|
if clone_depth:
|
||||||
try:
|
try:
|
||||||
clone_depth = int(clone_depth)
|
clone_depth = int(clone_depth)
|
||||||
if clone_depth <= 0:
|
if clone_depth <= 0:
|
||||||
raise ValueError()
|
raise ValueError()
|
||||||
except ValueError:
|
except ValueError:
|
||||||
raise ManifestParseError('invalid clone-depth %s in %s' %
|
raise ManifestParseError('invalid clone-depth %s in %s' %
|
||||||
|
@ -79,10 +79,10 @@ It is equivalent to "git branch -D <branchname>".
|
|||||||
|
|
||||||
if err:
|
if err:
|
||||||
for br in err.keys():
|
for br in err.keys():
|
||||||
err_msg = "error: cannot abandon %s" %br
|
err_msg = "error: cannot abandon %s" % br
|
||||||
print(err_msg, file=sys.stderr)
|
print(err_msg, file=sys.stderr)
|
||||||
for proj in err[br]:
|
for proj in err[br]:
|
||||||
print(' '*len(err_msg) + " | %s" % proj.relpath, file=sys.stderr)
|
print(' ' * len(err_msg) + " | %s" % proj.relpath, file=sys.stderr)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
elif not success:
|
elif not success:
|
||||||
print('error: no project has local branch(es) : %s' % nb,
|
print('error: no project has local branch(es) : %s' % nb,
|
||||||
@ -95,5 +95,5 @@ It is equivalent to "git branch -D <branchname>".
|
|||||||
result = "all project"
|
result = "all project"
|
||||||
else:
|
else:
|
||||||
result = "%s" % (
|
result = "%s" % (
|
||||||
('\n'+' '*width + '| ').join(p.relpath for p in success[br]))
|
('\n' + ' ' * width + '| ').join(p.relpath for p in success[br]))
|
||||||
print("%s%s| %s\n" % (br,' '*(width-len(br)), result),file=sys.stderr)
|
print("%s%s| %s\n" % (br, ' ' * (width - len(br)), result), file=sys.stderr)
|
||||||
|
@ -23,7 +23,7 @@ class BranchColoring(Coloring):
|
|||||||
def __init__(self, config):
|
def __init__(self, config):
|
||||||
Coloring.__init__(self, config, 'branch')
|
Coloring.__init__(self, config, 'branch')
|
||||||
self.current = self.printer('current', fg='green')
|
self.current = self.printer('current', fg='green')
|
||||||
self.local = self.printer('local')
|
self.local = self.printer('local')
|
||||||
self.notinproject = self.printer('notinproject', fg='red')
|
self.notinproject = self.printer('notinproject', fg='red')
|
||||||
|
|
||||||
class BranchInfo(object):
|
class BranchInfo(object):
|
||||||
@ -170,11 +170,11 @@ is shown, then the branch appears in all projects.
|
|||||||
fmt = out.current if i.IsCurrent else out.write
|
fmt = out.current if i.IsCurrent else out.write
|
||||||
for p in paths:
|
for p in paths:
|
||||||
out.nl()
|
out.nl()
|
||||||
fmt(width*' ' + ' %s' % p)
|
fmt(width * ' ' + ' %s' % p)
|
||||||
fmt = out.write
|
fmt = out.write
|
||||||
for p in non_cur_paths:
|
for p in non_cur_paths:
|
||||||
out.nl()
|
out.nl()
|
||||||
fmt(width*' ' + ' %s' % p)
|
fmt(width * ' ' + ' %s' % p)
|
||||||
else:
|
else:
|
||||||
out.write(' in all projects')
|
out.write(' in all projects')
|
||||||
out.nl()
|
out.nl()
|
||||||
|
@ -97,7 +97,7 @@ change id will be added.
|
|||||||
|
|
||||||
def _StripHeader(self, commit_msg):
|
def _StripHeader(self, commit_msg):
|
||||||
lines = commit_msg.splitlines()
|
lines = commit_msg.splitlines()
|
||||||
return "\n".join(lines[lines.index("")+1:])
|
return "\n".join(lines[lines.index("") + 1:])
|
||||||
|
|
||||||
def _Reformat(self, old_msg, sha1):
|
def _Reformat(self, old_msg, sha1):
|
||||||
new_msg = []
|
new_msg = []
|
||||||
|
@ -195,7 +195,7 @@ without iterating through the remaining projects.
|
|||||||
cmd.append(cmd[0])
|
cmd.append(cmd[0])
|
||||||
cmd.extend(opt.command[1:])
|
cmd.extend(opt.command[1:])
|
||||||
|
|
||||||
if opt.project_header \
|
if opt.project_header \
|
||||||
and not shell \
|
and not shell \
|
||||||
and cmd[0] == 'git':
|
and cmd[0] == 'git':
|
||||||
# If this is a direct git command that can enable colorized
|
# If this is a direct git command that can enable colorized
|
||||||
|
@ -204,7 +204,7 @@ class Info(PagedCommand):
|
|||||||
|
|
||||||
for commit in commits:
|
for commit in commits:
|
||||||
split = commit.split()
|
split = commit.split()
|
||||||
self.text('{0:38}{1} '.format('','-'))
|
self.text('{0:38}{1} '.format('', '-'))
|
||||||
self.sha(split[0] + " ")
|
self.sha(split[0] + " ")
|
||||||
self.text(" ".join(split[1:]))
|
self.text(" ".join(split[1:]))
|
||||||
self.out.nl()
|
self.out.nl()
|
||||||
|
@ -349,7 +349,7 @@ to update the working directory files.
|
|||||||
|
|
||||||
while True:
|
while True:
|
||||||
print()
|
print()
|
||||||
name = self._Prompt('Your Name', mp.UserName)
|
name = self._Prompt('Your Name', mp.UserName)
|
||||||
email = self._Prompt('Your Email', mp.UserEmail)
|
email = self._Prompt('Your Email', mp.UserEmail)
|
||||||
|
|
||||||
print()
|
print()
|
||||||
|
@ -76,7 +76,7 @@ This is similar to running: repo forall -c 'echo "$REPO_PATH : $REPO_PROJECT"'.
|
|||||||
lines = []
|
lines = []
|
||||||
for project in projects:
|
for project in projects:
|
||||||
if opt.name_only and not opt.path_only:
|
if opt.name_only and not opt.path_only:
|
||||||
lines.append("%s" % ( project.name))
|
lines.append("%s" % (project.name))
|
||||||
elif opt.path_only and not opt.name_only:
|
elif opt.path_only and not opt.name_only:
|
||||||
lines.append("%s" % (_getpath(project)))
|
lines.append("%s" % (_getpath(project)))
|
||||||
else:
|
else:
|
||||||
|
@ -60,7 +60,7 @@ revision specified in the manifest.
|
|||||||
if not opt.all:
|
if not opt.all:
|
||||||
projects = args[1:]
|
projects = args[1:]
|
||||||
if len(projects) < 1:
|
if len(projects) < 1:
|
||||||
projects = ['.',] # start it in the local project by default
|
projects = ['.'] # start it in the local project by default
|
||||||
|
|
||||||
all_projects = self.GetProjects(projects,
|
all_projects = self.GetProjects(projects,
|
||||||
missing_ok=bool(self.gitc_manifest))
|
missing_ok=bool(self.gitc_manifest))
|
||||||
|
@ -217,7 +217,7 @@ later is required to fix a server side protocol bug.
|
|||||||
p.add_option('-l', '--local-only',
|
p.add_option('-l', '--local-only',
|
||||||
dest='local_only', action='store_true',
|
dest='local_only', action='store_true',
|
||||||
help="only update working tree, don't fetch")
|
help="only update working tree, don't fetch")
|
||||||
p.add_option('--no-manifest-update','--nmu',
|
p.add_option('--no-manifest-update', '--nmu',
|
||||||
dest='mp_update', action='store_false', default='true',
|
dest='mp_update', action='store_false', default='true',
|
||||||
help='use the existing manifest checkout as-is. '
|
help='use the existing manifest checkout as-is. '
|
||||||
'(do not update to the latest revision)')
|
'(do not update to the latest revision)')
|
||||||
@ -1136,7 +1136,7 @@ class _FetchTimes(object):
|
|||||||
old = self._times.get(name, t)
|
old = self._times.get(name, t)
|
||||||
self._seen.add(name)
|
self._seen.add(name)
|
||||||
a = self._ALPHA
|
a = self._ALPHA
|
||||||
self._times[name] = (a*t) + ((1-a) * old)
|
self._times[name] = (a * t) + ((1 - a) * old)
|
||||||
|
|
||||||
def _Load(self):
|
def _Load(self):
|
||||||
if self._times is None:
|
if self._times is None:
|
||||||
@ -1208,7 +1208,7 @@ class PersistentTransport(xmlrpc.client.Transport):
|
|||||||
if proxy:
|
if proxy:
|
||||||
proxyhandler = urllib.request.ProxyHandler({
|
proxyhandler = urllib.request.ProxyHandler({
|
||||||
"http": proxy,
|
"http": proxy,
|
||||||
"https": proxy })
|
"https": proxy})
|
||||||
|
|
||||||
opener = urllib.request.build_opener(
|
opener = urllib.request.build_opener(
|
||||||
urllib.request.HTTPCookieProcessor(cookiejar),
|
urllib.request.HTTPCookieProcessor(cookiejar),
|
||||||
|
Loading…
Reference in New Issue
Block a user