mirror of
https://gerrit.googlesource.com/git-repo
synced 2024-12-21 07:16:21 +00:00
Fix flake8 E251 unexpected spaces around keyword / parameter equals
Fixed automatically with autopep8: git ls-files | grep py$ | xargs autopep8 --in-place --select E251 Change-Id: I58009e1c8c91c39745d559ac919be331d4cd9e77 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/254598 Tested-by: David Pursehouse <dpursehouse@collab.net> Reviewed-by: Mike Frysinger <vapier@google.com>
This commit is contained in:
parent
119085e6b1
commit
e5913ae410
@ -208,14 +208,14 @@ class GitCommand(object):
|
|||||||
def __init__(self,
|
def __init__(self,
|
||||||
project,
|
project,
|
||||||
cmdv,
|
cmdv,
|
||||||
bare = False,
|
bare=False,
|
||||||
provide_stdin = False,
|
provide_stdin=False,
|
||||||
capture_stdout = False,
|
capture_stdout=False,
|
||||||
capture_stderr = False,
|
capture_stderr=False,
|
||||||
disable_editor = False,
|
disable_editor=False,
|
||||||
ssh_proxy = False,
|
ssh_proxy=False,
|
||||||
cwd = None,
|
cwd=None,
|
||||||
gitdir = None):
|
gitdir=None):
|
||||||
env = self._GetBasicEnv()
|
env = self._GetBasicEnv()
|
||||||
|
|
||||||
# If we are not capturing std* then need to print it.
|
# If we are not capturing std* then need to print it.
|
||||||
@ -295,11 +295,11 @@ class GitCommand(object):
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
p = subprocess.Popen(command,
|
p = subprocess.Popen(command,
|
||||||
cwd = cwd,
|
cwd=cwd,
|
||||||
env = env,
|
env=env,
|
||||||
stdin = stdin,
|
stdin=stdin,
|
||||||
stdout = stdout,
|
stdout=stdout,
|
||||||
stderr = stderr)
|
stderr=stderr)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
raise GitError('%s: %s' % (command[1], e))
|
raise GitError('%s: %s' % (command[1], e))
|
||||||
|
|
||||||
|
@ -85,13 +85,13 @@ class GitConfig(object):
|
|||||||
@classmethod
|
@classmethod
|
||||||
def ForUser(cls):
|
def ForUser(cls):
|
||||||
if cls._ForUser is None:
|
if cls._ForUser is None:
|
||||||
cls._ForUser = cls(configfile = os.path.expanduser('~/.gitconfig'))
|
cls._ForUser = cls(configfile=os.path.expanduser('~/.gitconfig'))
|
||||||
return cls._ForUser
|
return cls._ForUser
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def ForRepository(cls, gitdir, defaults=None):
|
def ForRepository(cls, gitdir, defaults=None):
|
||||||
return cls(configfile = os.path.join(gitdir, 'config'),
|
return cls(configfile=os.path.join(gitdir, 'config'),
|
||||||
defaults = defaults)
|
defaults=defaults)
|
||||||
|
|
||||||
def __init__(self, configfile, defaults=None, jsonFile=None):
|
def __init__(self, configfile, defaults=None, jsonFile=None):
|
||||||
self.file = configfile
|
self.file = configfile
|
||||||
@ -107,13 +107,13 @@ class GitConfig(object):
|
|||||||
os.path.dirname(self.file),
|
os.path.dirname(self.file),
|
||||||
'.repo_' + os.path.basename(self.file) + '.json')
|
'.repo_' + os.path.basename(self.file) + '.json')
|
||||||
|
|
||||||
def Has(self, name, include_defaults = True):
|
def Has(self, name, include_defaults=True):
|
||||||
"""Return true if this configuration file has the key.
|
"""Return true if this configuration file has the key.
|
||||||
"""
|
"""
|
||||||
if _key(name) in self._cache:
|
if _key(name) in self._cache:
|
||||||
return True
|
return True
|
||||||
if include_defaults and self.defaults:
|
if include_defaults and self.defaults:
|
||||||
return self.defaults.Has(name, include_defaults = True)
|
return self.defaults.Has(name, include_defaults=True)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def GetBoolean(self, name):
|
def GetBoolean(self, name):
|
||||||
@ -142,7 +142,7 @@ class GitConfig(object):
|
|||||||
v = self._cache[_key(name)]
|
v = self._cache[_key(name)]
|
||||||
except KeyError:
|
except KeyError:
|
||||||
if self.defaults:
|
if self.defaults:
|
||||||
return self.defaults.GetString(name, all_keys = all_keys)
|
return self.defaults.GetString(name, all_keys=all_keys)
|
||||||
v = []
|
v = []
|
||||||
|
|
||||||
if not all_keys:
|
if not all_keys:
|
||||||
@ -153,7 +153,7 @@ class GitConfig(object):
|
|||||||
r = []
|
r = []
|
||||||
r.extend(v)
|
r.extend(v)
|
||||||
if self.defaults:
|
if self.defaults:
|
||||||
r.extend(self.defaults.GetString(name, all_keys = True))
|
r.extend(self.defaults.GetString(name, all_keys=True))
|
||||||
return r
|
return r
|
||||||
|
|
||||||
def SetString(self, name, value):
|
def SetString(self, name, value):
|
||||||
@ -217,7 +217,7 @@ class GitConfig(object):
|
|||||||
"""
|
"""
|
||||||
return self._sections.get(section, set())
|
return self._sections.get(section, set())
|
||||||
|
|
||||||
def HasSection(self, section, subsection = ''):
|
def HasSection(self, section, subsection=''):
|
||||||
"""Does at least one key in section.subsection exist?
|
"""Does at least one key in section.subsection exist?
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
@ -323,8 +323,8 @@ class GitConfig(object):
|
|||||||
|
|
||||||
p = GitCommand(None,
|
p = GitCommand(None,
|
||||||
command,
|
command,
|
||||||
capture_stdout = True,
|
capture_stdout=True,
|
||||||
capture_stderr = True)
|
capture_stderr=True)
|
||||||
if p.Wait() == 0:
|
if p.Wait() == 0:
|
||||||
return p.stdout
|
return p.stdout
|
||||||
else:
|
else:
|
||||||
@ -731,7 +731,7 @@ class Remote(object):
|
|||||||
|
|
||||||
def _Get(self, key, all_keys=False):
|
def _Get(self, key, all_keys=False):
|
||||||
key = 'remote.%s.%s' % (self.name, key)
|
key = 'remote.%s.%s' % (self.name, key)
|
||||||
return self._config.GetString(key, all_keys = all_keys)
|
return self._config.GetString(key, all_keys=all_keys)
|
||||||
|
|
||||||
|
|
||||||
class Branch(object):
|
class Branch(object):
|
||||||
@ -780,4 +780,4 @@ class Branch(object):
|
|||||||
|
|
||||||
def _Get(self, key, all_keys=False):
|
def _Get(self, key, all_keys=False):
|
||||||
key = 'branch.%s.%s' % (self.name, key)
|
key = 'branch.%s.%s' % (self.name, key)
|
||||||
return self._config.GetString(key, all_keys = all_keys)
|
return self._config.GetString(key, all_keys=all_keys)
|
||||||
|
@ -140,12 +140,12 @@ class XmlManifest(object):
|
|||||||
self._load_local_manifests = True
|
self._load_local_manifests = True
|
||||||
|
|
||||||
self.repoProject = MetaProject(self, 'repo',
|
self.repoProject = MetaProject(self, 'repo',
|
||||||
gitdir = os.path.join(repodir, 'repo/.git'),
|
gitdir=os.path.join(repodir, 'repo/.git'),
|
||||||
worktree = os.path.join(repodir, 'repo'))
|
worktree=os.path.join(repodir, 'repo'))
|
||||||
|
|
||||||
self.manifestProject = MetaProject(self, 'manifests',
|
self.manifestProject = MetaProject(self, 'manifests',
|
||||||
gitdir = os.path.join(repodir, 'manifests.git'),
|
gitdir=os.path.join(repodir, 'manifests.git'),
|
||||||
worktree = os.path.join(repodir, 'manifests'))
|
worktree=os.path.join(repodir, 'manifests'))
|
||||||
|
|
||||||
self._Unload()
|
self._Unload()
|
||||||
|
|
||||||
@ -682,15 +682,15 @@ class XmlManifest(object):
|
|||||||
if name not in self._projects:
|
if name not in self._projects:
|
||||||
m.PreSync()
|
m.PreSync()
|
||||||
gitdir = os.path.join(self.topdir, '%s.git' % name)
|
gitdir = os.path.join(self.topdir, '%s.git' % name)
|
||||||
project = Project(manifest = self,
|
project = Project(manifest=self,
|
||||||
name = name,
|
name=name,
|
||||||
remote = remote.ToRemoteSpec(name),
|
remote=remote.ToRemoteSpec(name),
|
||||||
gitdir = gitdir,
|
gitdir=gitdir,
|
||||||
objdir = gitdir,
|
objdir=gitdir,
|
||||||
worktree = None,
|
worktree=None,
|
||||||
relpath = name or None,
|
relpath=name or None,
|
||||||
revisionExpr = m.revisionExpr,
|
revisionExpr=m.revisionExpr,
|
||||||
revisionId = None)
|
revisionId=None)
|
||||||
self._projects[project.name] = [project]
|
self._projects[project.name] = [project]
|
||||||
self._paths[project.relpath] = project
|
self._paths[project.relpath] = project
|
||||||
|
|
||||||
@ -798,7 +798,7 @@ class XmlManifest(object):
|
|||||||
def _UnjoinName(self, parent_name, name):
|
def _UnjoinName(self, parent_name, name):
|
||||||
return os.path.relpath(name, parent_name)
|
return os.path.relpath(name, parent_name)
|
||||||
|
|
||||||
def _ParseProject(self, node, parent = None, **extra_proj_attrs):
|
def _ParseProject(self, node, parent=None, **extra_proj_attrs):
|
||||||
"""
|
"""
|
||||||
reads a <project> element from the manifest file
|
reads a <project> element from the manifest file
|
||||||
"""
|
"""
|
||||||
@ -883,24 +883,24 @@ class XmlManifest(object):
|
|||||||
if node.getAttribute('force-path').lower() in ("yes", "true", "1"):
|
if node.getAttribute('force-path').lower() in ("yes", "true", "1"):
|
||||||
gitdir = os.path.join(self.topdir, '%s.git' % path)
|
gitdir = os.path.join(self.topdir, '%s.git' % path)
|
||||||
|
|
||||||
project = Project(manifest = self,
|
project = Project(manifest=self,
|
||||||
name = name,
|
name=name,
|
||||||
remote = remote.ToRemoteSpec(name),
|
remote=remote.ToRemoteSpec(name),
|
||||||
gitdir = gitdir,
|
gitdir=gitdir,
|
||||||
objdir = objdir,
|
objdir=objdir,
|
||||||
worktree = worktree,
|
worktree=worktree,
|
||||||
relpath = relpath,
|
relpath=relpath,
|
||||||
revisionExpr = revisionExpr,
|
revisionExpr=revisionExpr,
|
||||||
revisionId = None,
|
revisionId=None,
|
||||||
rebase = rebase,
|
rebase=rebase,
|
||||||
groups = groups,
|
groups=groups,
|
||||||
sync_c = sync_c,
|
sync_c=sync_c,
|
||||||
sync_s = sync_s,
|
sync_s=sync_s,
|
||||||
sync_tags = sync_tags,
|
sync_tags=sync_tags,
|
||||||
clone_depth = clone_depth,
|
clone_depth=clone_depth,
|
||||||
upstream = upstream,
|
upstream=upstream,
|
||||||
parent = parent,
|
parent=parent,
|
||||||
dest_branch = dest_branch,
|
dest_branch=dest_branch,
|
||||||
**extra_proj_attrs)
|
**extra_proj_attrs)
|
||||||
|
|
||||||
for n in node.childNodes:
|
for n in node.childNodes:
|
||||||
@ -911,7 +911,7 @@ class XmlManifest(object):
|
|||||||
if n.nodeName == 'annotation':
|
if n.nodeName == 'annotation':
|
||||||
self._ParseAnnotation(project, n)
|
self._ParseAnnotation(project, n)
|
||||||
if n.nodeName == 'project':
|
if n.nodeName == 'project':
|
||||||
project.subprojects.append(self._ParseProject(n, parent = project))
|
project.subprojects.append(self._ParseProject(n, parent=project))
|
||||||
|
|
||||||
return project
|
return project
|
||||||
|
|
||||||
@ -1125,7 +1125,7 @@ class GitcManifest(XmlManifest):
|
|||||||
gitc_client_name)
|
gitc_client_name)
|
||||||
self.manifestFile = os.path.join(self.gitc_client_dir, '.manifest')
|
self.manifestFile = os.path.join(self.gitc_client_dir, '.manifest')
|
||||||
|
|
||||||
def _ParseProject(self, node, parent = None):
|
def _ParseProject(self, node, parent=None):
|
||||||
"""Override _ParseProject and add support for GITC specific attributes."""
|
"""Override _ParseProject and add support for GITC specific attributes."""
|
||||||
return super(GitcManifest, self)._ParseProject(
|
return super(GitcManifest, self)._ParseProject(
|
||||||
node, parent=parent, old_revision=node.getAttribute('old-revision'))
|
node, parent=parent, old_revision=node.getAttribute('old-revision'))
|
||||||
|
@ -46,8 +46,8 @@ change id will be added.
|
|||||||
|
|
||||||
p = GitCommand(None,
|
p = GitCommand(None,
|
||||||
['rev-parse', '--verify', reference],
|
['rev-parse', '--verify', reference],
|
||||||
capture_stdout = True,
|
capture_stdout=True,
|
||||||
capture_stderr = True)
|
capture_stderr=True)
|
||||||
if p.Wait() != 0:
|
if p.Wait() != 0:
|
||||||
print(p.stderr, file=sys.stderr)
|
print(p.stderr, file=sys.stderr)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
@ -61,8 +61,8 @@ change id will be added.
|
|||||||
|
|
||||||
p = GitCommand(None,
|
p = GitCommand(None,
|
||||||
['cherry-pick', sha1],
|
['cherry-pick', sha1],
|
||||||
capture_stdout = True,
|
capture_stdout=True,
|
||||||
capture_stderr = True)
|
capture_stderr=True)
|
||||||
status = p.Wait()
|
status = p.Wait()
|
||||||
|
|
||||||
print(p.stdout, file=sys.stdout)
|
print(p.stdout, file=sys.stdout)
|
||||||
@ -74,9 +74,9 @@ change id will be added.
|
|||||||
new_msg = self._Reformat(old_msg, sha1)
|
new_msg = self._Reformat(old_msg, sha1)
|
||||||
|
|
||||||
p = GitCommand(None, ['commit', '--amend', '-F', '-'],
|
p = GitCommand(None, ['commit', '--amend', '-F', '-'],
|
||||||
provide_stdin = True,
|
provide_stdin=True,
|
||||||
capture_stdout = True,
|
capture_stdout=True,
|
||||||
capture_stderr = True)
|
capture_stderr=True)
|
||||||
p.stdin.write(new_msg)
|
p.stdin.write(new_msg)
|
||||||
p.stdin.close()
|
p.stdin.close()
|
||||||
if p.Wait() != 0:
|
if p.Wait() != 0:
|
||||||
|
@ -184,10 +184,10 @@ synced and their revisions won't be found.
|
|||||||
self.out = _Coloring(self.manifest.globalConfig)
|
self.out = _Coloring(self.manifest.globalConfig)
|
||||||
self.printText = self.out.nofmt_printer('text')
|
self.printText = self.out.nofmt_printer('text')
|
||||||
if opt.color:
|
if opt.color:
|
||||||
self.printProject = self.out.nofmt_printer('project', attr = 'bold')
|
self.printProject = self.out.nofmt_printer('project', attr='bold')
|
||||||
self.printAdded = self.out.nofmt_printer('green', fg = 'green', attr = 'bold')
|
self.printAdded = self.out.nofmt_printer('green', fg='green', attr='bold')
|
||||||
self.printRemoved = self.out.nofmt_printer('red', fg = 'red', attr = 'bold')
|
self.printRemoved = self.out.nofmt_printer('red', fg='red', attr='bold')
|
||||||
self.printRevision = self.out.nofmt_printer('revision', fg = 'yellow')
|
self.printRevision = self.out.nofmt_printer('revision', fg='yellow')
|
||||||
else:
|
else:
|
||||||
self.printProject = self.printAdded = self.printRemoved = self.printRevision = self.printText
|
self.printProject = self.printAdded = self.printRemoved = self.printRevision = self.printText
|
||||||
|
|
||||||
|
@ -44,12 +44,12 @@ class Info(PagedCommand):
|
|||||||
|
|
||||||
def Execute(self, opt, args):
|
def Execute(self, opt, args):
|
||||||
self.out = _Coloring(self.manifest.globalConfig)
|
self.out = _Coloring(self.manifest.globalConfig)
|
||||||
self.heading = self.out.printer('heading', attr = 'bold')
|
self.heading = self.out.printer('heading', attr='bold')
|
||||||
self.headtext = self.out.nofmt_printer('headtext', fg = 'yellow')
|
self.headtext = self.out.nofmt_printer('headtext', fg='yellow')
|
||||||
self.redtext = self.out.printer('redtext', fg = 'red')
|
self.redtext = self.out.printer('redtext', fg='red')
|
||||||
self.sha = self.out.printer("sha", fg = 'yellow')
|
self.sha = self.out.printer("sha", fg='yellow')
|
||||||
self.text = self.out.nofmt_printer('text')
|
self.text = self.out.nofmt_printer('text')
|
||||||
self.dimtext = self.out.printer('dimtext', attr = 'dim')
|
self.dimtext = self.out.printer('dimtext', attr='dim')
|
||||||
|
|
||||||
self.opt = opt
|
self.opt = opt
|
||||||
|
|
||||||
|
@ -66,8 +66,8 @@ in a Git repository for use during future 'repo init' invocations.
|
|||||||
else:
|
else:
|
||||||
fd = open(opt.output_file, 'w')
|
fd = open(opt.output_file, 'w')
|
||||||
self.manifest.Save(fd,
|
self.manifest.Save(fd,
|
||||||
peg_rev = opt.peg_rev,
|
peg_rev=opt.peg_rev,
|
||||||
peg_rev_upstream = opt.peg_rev_upstream)
|
peg_rev_upstream=opt.peg_rev_upstream)
|
||||||
fd.close()
|
fd.close()
|
||||||
if opt.output_file != '-':
|
if opt.output_file != '-':
|
||||||
print('Saved manifest to %s' % opt.output_file, file=sys.stderr)
|
print('Saved manifest to %s' % opt.output_file, file=sys.stderr)
|
||||||
|
@ -59,5 +59,5 @@ need to be performed by an end-user.
|
|||||||
|
|
||||||
rp.bare_git.gc('--auto')
|
rp.bare_git.gc('--auto')
|
||||||
_PostRepoFetch(rp,
|
_PostRepoFetch(rp,
|
||||||
no_repo_verify = opt.no_repo_verify,
|
no_repo_verify=opt.no_repo_verify,
|
||||||
verbose = True)
|
verbose=True)
|
||||||
|
@ -170,8 +170,8 @@ the following meanings:
|
|||||||
class StatusColoring(Coloring):
|
class StatusColoring(Coloring):
|
||||||
def __init__(self, config):
|
def __init__(self, config):
|
||||||
Coloring.__init__(self, config, 'status')
|
Coloring.__init__(self, config, 'status')
|
||||||
self.project = self.printer('header', attr = 'bold')
|
self.project = self.printer('header', attr='bold')
|
||||||
self.untracked = self.printer('untracked', fg = 'red')
|
self.untracked = self.printer('untracked', fg='red')
|
||||||
|
|
||||||
orig_path = os.getcwd()
|
orig_path = os.getcwd()
|
||||||
try:
|
try:
|
||||||
|
@ -396,8 +396,8 @@ later is required to fix a server side protocol bug.
|
|||||||
err_event=err_event,
|
err_event=err_event,
|
||||||
clone_filter=self.manifest.CloneFilter)
|
clone_filter=self.manifest.CloneFilter)
|
||||||
if self.jobs > 1:
|
if self.jobs > 1:
|
||||||
t = _threading.Thread(target = self._FetchProjectList,
|
t = _threading.Thread(target=self._FetchProjectList,
|
||||||
kwargs = kwargs)
|
kwargs=kwargs)
|
||||||
# Ensure that Ctrl-C will not freeze the repo process.
|
# Ensure that Ctrl-C will not freeze the repo process.
|
||||||
t.daemon = True
|
t.daemon = True
|
||||||
threads.add(t)
|
threads.add(t)
|
||||||
@ -704,16 +704,16 @@ later is required to fix a server side protocol bug.
|
|||||||
gitdir = os.path.join(self.manifest.topdir, path, '.git')
|
gitdir = os.path.join(self.manifest.topdir, path, '.git')
|
||||||
if os.path.exists(gitdir):
|
if os.path.exists(gitdir):
|
||||||
project = Project(
|
project = Project(
|
||||||
manifest = self.manifest,
|
manifest=self.manifest,
|
||||||
name = path,
|
name=path,
|
||||||
remote = RemoteSpec('origin'),
|
remote=RemoteSpec('origin'),
|
||||||
gitdir = gitdir,
|
gitdir=gitdir,
|
||||||
objdir = gitdir,
|
objdir=gitdir,
|
||||||
worktree = os.path.join(self.manifest.topdir, path),
|
worktree=os.path.join(self.manifest.topdir, path),
|
||||||
relpath = path,
|
relpath=path,
|
||||||
revisionExpr = 'HEAD',
|
revisionExpr='HEAD',
|
||||||
revisionId = None,
|
revisionId=None,
|
||||||
groups = None)
|
groups=None)
|
||||||
|
|
||||||
if project.IsDirty() and opt.force_remove_dirty:
|
if project.IsDirty() and opt.force_remove_dirty:
|
||||||
print('WARNING: Removing dirty project "%s": uncommitted changes '
|
print('WARNING: Removing dirty project "%s": uncommitted changes '
|
||||||
@ -1100,9 +1100,9 @@ def _VerifyTag(project):
|
|||||||
|
|
||||||
cmd = [GIT, 'tag', '-v', cur]
|
cmd = [GIT, 'tag', '-v', cur]
|
||||||
proc = subprocess.Popen(cmd,
|
proc = subprocess.Popen(cmd,
|
||||||
stdout = subprocess.PIPE,
|
stdout=subprocess.PIPE,
|
||||||
stderr = subprocess.PIPE,
|
stderr=subprocess.PIPE,
|
||||||
env = env)
|
env=env)
|
||||||
out = proc.stdout.read()
|
out = proc.stdout.read()
|
||||||
proc.stdout.close()
|
proc.stdout.close()
|
||||||
|
|
||||||
|
@ -441,14 +441,14 @@ Gerrit Code Review: https://www.gerritcodereview.com/
|
|||||||
def _GetMergeBranch(self, project):
|
def _GetMergeBranch(self, project):
|
||||||
p = GitCommand(project,
|
p = GitCommand(project,
|
||||||
['rev-parse', '--abbrev-ref', 'HEAD'],
|
['rev-parse', '--abbrev-ref', 'HEAD'],
|
||||||
capture_stdout = True,
|
capture_stdout=True,
|
||||||
capture_stderr = True)
|
capture_stderr=True)
|
||||||
p.Wait()
|
p.Wait()
|
||||||
local_branch = p.stdout.strip()
|
local_branch = p.stdout.strip()
|
||||||
p = GitCommand(project,
|
p = GitCommand(project,
|
||||||
['config', '--get', 'branch.%s.merge' % local_branch],
|
['config', '--get', 'branch.%s.merge' % local_branch],
|
||||||
capture_stdout = True,
|
capture_stdout=True,
|
||||||
capture_stderr = True)
|
capture_stderr=True)
|
||||||
p.Wait()
|
p.Wait()
|
||||||
merge_branch = p.stdout.strip()
|
merge_branch = p.stdout.strip()
|
||||||
return merge_branch
|
return merge_branch
|
||||||
|
Loading…
Reference in New Issue
Block a user