summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--git_command.py26
-rw-r--r--git_config.py24
-rw-r--r--manifest_xml.py68
-rw-r--r--subcmds/cherry_pick.py14
-rw-r--r--subcmds/diffmanifests.py8
-rw-r--r--subcmds/info.py10
-rw-r--r--subcmds/manifest.py4
-rw-r--r--subcmds/selfupdate.py4
-rw-r--r--subcmds/status.py4
-rw-r--r--subcmds/sync.py30
-rw-r--r--subcmds/upload.py8
11 files changed, 100 insertions, 100 deletions
diff --git a/git_command.py b/git_command.py
index 4868ccdf..34efda7d 100644
--- a/git_command.py
+++ b/git_command.py
@@ -208,14 +208,14 @@ class GitCommand(object):
208 def __init__(self, 208 def __init__(self,
209 project, 209 project,
210 cmdv, 210 cmdv,
211 bare = False, 211 bare=False,
212 provide_stdin = False, 212 provide_stdin=False,
213 capture_stdout = False, 213 capture_stdout=False,
214 capture_stderr = False, 214 capture_stderr=False,
215 disable_editor = False, 215 disable_editor=False,
216 ssh_proxy = False, 216 ssh_proxy=False,
217 cwd = None, 217 cwd=None,
218 gitdir = None): 218 gitdir=None):
219 env = self._GetBasicEnv() 219 env = self._GetBasicEnv()
220 220
221 # If we are not capturing std* then need to print it. 221 # If we are not capturing std* then need to print it.
@@ -295,11 +295,11 @@ class GitCommand(object):
295 295
296 try: 296 try:
297 p = subprocess.Popen(command, 297 p = subprocess.Popen(command,
298 cwd = cwd, 298 cwd=cwd,
299 env = env, 299 env=env,
300 stdin = stdin, 300 stdin=stdin,
301 stdout = stdout, 301 stdout=stdout,
302 stderr = stderr) 302 stderr=stderr)
303 except Exception as e: 303 except Exception as e:
304 raise GitError('%s: %s' % (command[1], e)) 304 raise GitError('%s: %s' % (command[1], e))
305 305
diff --git a/git_config.py b/git_config.py
index 8de3200c..8311d9f0 100644
--- a/git_config.py
+++ b/git_config.py
@@ -85,13 +85,13 @@ class GitConfig(object):
85 @classmethod 85 @classmethod
86 def ForUser(cls): 86 def ForUser(cls):
87 if cls._ForUser is None: 87 if cls._ForUser is None:
88 cls._ForUser = cls(configfile = os.path.expanduser('~/.gitconfig')) 88 cls._ForUser = cls(configfile=os.path.expanduser('~/.gitconfig'))
89 return cls._ForUser 89 return cls._ForUser
90 90
91 @classmethod 91 @classmethod
92 def ForRepository(cls, gitdir, defaults=None): 92 def ForRepository(cls, gitdir, defaults=None):
93 return cls(configfile = os.path.join(gitdir, 'config'), 93 return cls(configfile=os.path.join(gitdir, 'config'),
94 defaults = defaults) 94 defaults=defaults)
95 95
96 def __init__(self, configfile, defaults=None, jsonFile=None): 96 def __init__(self, configfile, defaults=None, jsonFile=None):
97 self.file = configfile 97 self.file = configfile
@@ -107,13 +107,13 @@ class GitConfig(object):
107 os.path.dirname(self.file), 107 os.path.dirname(self.file),
108 '.repo_' + os.path.basename(self.file) + '.json') 108 '.repo_' + os.path.basename(self.file) + '.json')
109 109
110 def Has(self, name, include_defaults = True): 110 def Has(self, name, include_defaults=True):
111 """Return true if this configuration file has the key. 111 """Return true if this configuration file has the key.
112 """ 112 """
113 if _key(name) in self._cache: 113 if _key(name) in self._cache:
114 return True 114 return True
115 if include_defaults and self.defaults: 115 if include_defaults and self.defaults:
116 return self.defaults.Has(name, include_defaults = True) 116 return self.defaults.Has(name, include_defaults=True)
117 return False 117 return False
118 118
119 def GetBoolean(self, name): 119 def GetBoolean(self, name):
@@ -142,7 +142,7 @@ class GitConfig(object):
142 v = self._cache[_key(name)] 142 v = self._cache[_key(name)]
143 except KeyError: 143 except KeyError:
144 if self.defaults: 144 if self.defaults:
145 return self.defaults.GetString(name, all_keys = all_keys) 145 return self.defaults.GetString(name, all_keys=all_keys)
146 v = [] 146 v = []
147 147
148 if not all_keys: 148 if not all_keys:
@@ -153,7 +153,7 @@ class GitConfig(object):
153 r = [] 153 r = []
154 r.extend(v) 154 r.extend(v)
155 if self.defaults: 155 if self.defaults:
156 r.extend(self.defaults.GetString(name, all_keys = True)) 156 r.extend(self.defaults.GetString(name, all_keys=True))
157 return r 157 return r
158 158
159 def SetString(self, name, value): 159 def SetString(self, name, value):
@@ -217,7 +217,7 @@ class GitConfig(object):
217 """ 217 """
218 return self._sections.get(section, set()) 218 return self._sections.get(section, set())
219 219
220 def HasSection(self, section, subsection = ''): 220 def HasSection(self, section, subsection=''):
221 """Does at least one key in section.subsection exist? 221 """Does at least one key in section.subsection exist?
222 """ 222 """
223 try: 223 try:
@@ -323,8 +323,8 @@ class GitConfig(object):
323 323
324 p = GitCommand(None, 324 p = GitCommand(None,
325 command, 325 command,
326 capture_stdout = True, 326 capture_stdout=True,
327 capture_stderr = True) 327 capture_stderr=True)
328 if p.Wait() == 0: 328 if p.Wait() == 0:
329 return p.stdout 329 return p.stdout
330 else: 330 else:
@@ -731,7 +731,7 @@ class Remote(object):
731 731
732 def _Get(self, key, all_keys=False): 732 def _Get(self, key, all_keys=False):
733 key = 'remote.%s.%s' % (self.name, key) 733 key = 'remote.%s.%s' % (self.name, key)
734 return self._config.GetString(key, all_keys = all_keys) 734 return self._config.GetString(key, all_keys=all_keys)
735 735
736 736
737class Branch(object): 737class Branch(object):
@@ -780,4 +780,4 @@ class Branch(object):
780 780
781 def _Get(self, key, all_keys=False): 781 def _Get(self, key, all_keys=False):
782 key = 'branch.%s.%s' % (self.name, key) 782 key = 'branch.%s.%s' % (self.name, key)
783 return self._config.GetString(key, all_keys = all_keys) 783 return self._config.GetString(key, all_keys=all_keys)
diff --git a/manifest_xml.py b/manifest_xml.py
index e951bbf5..2be717e2 100644
--- a/manifest_xml.py
+++ b/manifest_xml.py
@@ -140,12 +140,12 @@ class XmlManifest(object):
140 self._load_local_manifests = True 140 self._load_local_manifests = True
141 141
142 self.repoProject = MetaProject(self, 'repo', 142 self.repoProject = MetaProject(self, 'repo',
143 gitdir = os.path.join(repodir, 'repo/.git'), 143 gitdir=os.path.join(repodir, 'repo/.git'),
144 worktree = os.path.join(repodir, 'repo')) 144 worktree=os.path.join(repodir, 'repo'))
145 145
146 self.manifestProject = MetaProject(self, 'manifests', 146 self.manifestProject = MetaProject(self, 'manifests',
147 gitdir = os.path.join(repodir, 'manifests.git'), 147 gitdir=os.path.join(repodir, 'manifests.git'),
148 worktree = os.path.join(repodir, 'manifests')) 148 worktree=os.path.join(repodir, 'manifests'))
149 149
150 self._Unload() 150 self._Unload()
151 151
@@ -682,15 +682,15 @@ class XmlManifest(object):
682 if name not in self._projects: 682 if name not in self._projects:
683 m.PreSync() 683 m.PreSync()
684 gitdir = os.path.join(self.topdir, '%s.git' % name) 684 gitdir = os.path.join(self.topdir, '%s.git' % name)
685 project = Project(manifest = self, 685 project = Project(manifest=self,
686 name = name, 686 name=name,
687 remote = remote.ToRemoteSpec(name), 687 remote=remote.ToRemoteSpec(name),
688 gitdir = gitdir, 688 gitdir=gitdir,
689 objdir = gitdir, 689 objdir=gitdir,
690 worktree = None, 690 worktree=None,
691 relpath = name or None, 691 relpath=name or None,
692 revisionExpr = m.revisionExpr, 692 revisionExpr=m.revisionExpr,
693 revisionId = None) 693 revisionId=None)
694 self._projects[project.name] = [project] 694 self._projects[project.name] = [project]
695 self._paths[project.relpath] = project 695 self._paths[project.relpath] = project
696 696
@@ -798,7 +798,7 @@ class XmlManifest(object):
798 def _UnjoinName(self, parent_name, name): 798 def _UnjoinName(self, parent_name, name):
799 return os.path.relpath(name, parent_name) 799 return os.path.relpath(name, parent_name)
800 800
801 def _ParseProject(self, node, parent = None, **extra_proj_attrs): 801 def _ParseProject(self, node, parent=None, **extra_proj_attrs):
802 """ 802 """
803 reads a <project> element from the manifest file 803 reads a <project> element from the manifest file
804 """ 804 """
@@ -883,24 +883,24 @@ class XmlManifest(object):
883 if node.getAttribute('force-path').lower() in ("yes", "true", "1"): 883 if node.getAttribute('force-path').lower() in ("yes", "true", "1"):
884 gitdir = os.path.join(self.topdir, '%s.git' % path) 884 gitdir = os.path.join(self.topdir, '%s.git' % path)
885 885
886 project = Project(manifest = self, 886 project = Project(manifest=self,
887 name = name, 887 name=name,
888 remote = remote.ToRemoteSpec(name), 888 remote=remote.ToRemoteSpec(name),
889 gitdir = gitdir, 889 gitdir=gitdir,
890 objdir = objdir, 890 objdir=objdir,
891 worktree = worktree, 891 worktree=worktree,
892 relpath = relpath, 892 relpath=relpath,
893 revisionExpr = revisionExpr, 893 revisionExpr=revisionExpr,
894 revisionId = None, 894 revisionId=None,
895 rebase = rebase, 895 rebase=rebase,
896 groups = groups, 896 groups=groups,
897 sync_c = sync_c, 897 sync_c=sync_c,
898 sync_s = sync_s, 898 sync_s=sync_s,
899 sync_tags = sync_tags, 899 sync_tags=sync_tags,
900 clone_depth = clone_depth, 900 clone_depth=clone_depth,
901 upstream = upstream, 901 upstream=upstream,
902 parent = parent, 902 parent=parent,
903 dest_branch = dest_branch, 903 dest_branch=dest_branch,
904 **extra_proj_attrs) 904 **extra_proj_attrs)
905 905
906 for n in node.childNodes: 906 for n in node.childNodes:
@@ -911,7 +911,7 @@ class XmlManifest(object):
911 if n.nodeName == 'annotation': 911 if n.nodeName == 'annotation':
912 self._ParseAnnotation(project, n) 912 self._ParseAnnotation(project, n)
913 if n.nodeName == 'project': 913 if n.nodeName == 'project':
914 project.subprojects.append(self._ParseProject(n, parent = project)) 914 project.subprojects.append(self._ParseProject(n, parent=project))
915 915
916 return project 916 return project
917 917
@@ -1125,7 +1125,7 @@ class GitcManifest(XmlManifest):
1125 gitc_client_name) 1125 gitc_client_name)
1126 self.manifestFile = os.path.join(self.gitc_client_dir, '.manifest') 1126 self.manifestFile = os.path.join(self.gitc_client_dir, '.manifest')
1127 1127
1128 def _ParseProject(self, node, parent = None): 1128 def _ParseProject(self, node, parent=None):
1129 """Override _ParseProject and add support for GITC specific attributes.""" 1129 """Override _ParseProject and add support for GITC specific attributes."""
1130 return super(GitcManifest, self)._ParseProject( 1130 return super(GitcManifest, self)._ParseProject(
1131 node, parent=parent, old_revision=node.getAttribute('old-revision')) 1131 node, parent=parent, old_revision=node.getAttribute('old-revision'))
diff --git a/subcmds/cherry_pick.py b/subcmds/cherry_pick.py
index a541a040..bd396fab 100644
--- a/subcmds/cherry_pick.py
+++ b/subcmds/cherry_pick.py
@@ -46,8 +46,8 @@ change id will be added.
46 46
47 p = GitCommand(None, 47 p = GitCommand(None,
48 ['rev-parse', '--verify', reference], 48 ['rev-parse', '--verify', reference],
49 capture_stdout = True, 49 capture_stdout=True,
50 capture_stderr = True) 50 capture_stderr=True)
51 if p.Wait() != 0: 51 if p.Wait() != 0:
52 print(p.stderr, file=sys.stderr) 52 print(p.stderr, file=sys.stderr)
53 sys.exit(1) 53 sys.exit(1)
@@ -61,8 +61,8 @@ change id will be added.
61 61
62 p = GitCommand(None, 62 p = GitCommand(None,
63 ['cherry-pick', sha1], 63 ['cherry-pick', sha1],
64 capture_stdout = True, 64 capture_stdout=True,
65 capture_stderr = True) 65 capture_stderr=True)
66 status = p.Wait() 66 status = p.Wait()
67 67
68 print(p.stdout, file=sys.stdout) 68 print(p.stdout, file=sys.stdout)
@@ -74,9 +74,9 @@ change id will be added.
74 new_msg = self._Reformat(old_msg, sha1) 74 new_msg = self._Reformat(old_msg, sha1)
75 75
76 p = GitCommand(None, ['commit', '--amend', '-F', '-'], 76 p = GitCommand(None, ['commit', '--amend', '-F', '-'],
77 provide_stdin = True, 77 provide_stdin=True,
78 capture_stdout = True, 78 capture_stdout=True,
79 capture_stderr = True) 79 capture_stderr=True)
80 p.stdin.write(new_msg) 80 p.stdin.write(new_msg)
81 p.stdin.close() 81 p.stdin.close()
82 if p.Wait() != 0: 82 if p.Wait() != 0:
diff --git a/subcmds/diffmanifests.py b/subcmds/diffmanifests.py
index b999699e..9bdb5e14 100644
--- a/subcmds/diffmanifests.py
+++ b/subcmds/diffmanifests.py
@@ -184,10 +184,10 @@ synced and their revisions won't be found.
184 self.out = _Coloring(self.manifest.globalConfig) 184 self.out = _Coloring(self.manifest.globalConfig)
185 self.printText = self.out.nofmt_printer('text') 185 self.printText = self.out.nofmt_printer('text')
186 if opt.color: 186 if opt.color:
187 self.printProject = self.out.nofmt_printer('project', attr = 'bold') 187 self.printProject = self.out.nofmt_printer('project', attr='bold')
188 self.printAdded = self.out.nofmt_printer('green', fg = 'green', attr = 'bold') 188 self.printAdded = self.out.nofmt_printer('green', fg='green', attr='bold')
189 self.printRemoved = self.out.nofmt_printer('red', fg = 'red', attr = 'bold') 189 self.printRemoved = self.out.nofmt_printer('red', fg='red', attr='bold')
190 self.printRevision = self.out.nofmt_printer('revision', fg = 'yellow') 190 self.printRevision = self.out.nofmt_printer('revision', fg='yellow')
191 else: 191 else:
192 self.printProject = self.printAdded = self.printRemoved = self.printRevision = self.printText 192 self.printProject = self.printAdded = self.printRemoved = self.printRevision = self.printText
193 193
diff --git a/subcmds/info.py b/subcmds/info.py
index a9ad52aa..cff97fbd 100644
--- a/subcmds/info.py
+++ b/subcmds/info.py
@@ -44,12 +44,12 @@ class Info(PagedCommand):
44 44
45 def Execute(self, opt, args): 45 def Execute(self, opt, args):
46 self.out = _Coloring(self.manifest.globalConfig) 46 self.out = _Coloring(self.manifest.globalConfig)
47 self.heading = self.out.printer('heading', attr = 'bold') 47 self.heading = self.out.printer('heading', attr='bold')
48 self.headtext = self.out.nofmt_printer('headtext', fg = 'yellow') 48 self.headtext = self.out.nofmt_printer('headtext', fg='yellow')
49 self.redtext = self.out.printer('redtext', fg = 'red') 49 self.redtext = self.out.printer('redtext', fg='red')
50 self.sha = self.out.printer("sha", fg = 'yellow') 50 self.sha = self.out.printer("sha", fg='yellow')
51 self.text = self.out.nofmt_printer('text') 51 self.text = self.out.nofmt_printer('text')
52 self.dimtext = self.out.printer('dimtext', attr = 'dim') 52 self.dimtext = self.out.printer('dimtext', attr='dim')
53 53
54 self.opt = opt 54 self.opt = opt
55 55
diff --git a/subcmds/manifest.py b/subcmds/manifest.py
index 9c1b3f0c..6bb01045 100644
--- a/subcmds/manifest.py
+++ b/subcmds/manifest.py
@@ -66,8 +66,8 @@ in a Git repository for use during future 'repo init' invocations.
66 else: 66 else:
67 fd = open(opt.output_file, 'w') 67 fd = open(opt.output_file, 'w')
68 self.manifest.Save(fd, 68 self.manifest.Save(fd,
69 peg_rev = opt.peg_rev, 69 peg_rev=opt.peg_rev,
70 peg_rev_upstream = opt.peg_rev_upstream) 70 peg_rev_upstream=opt.peg_rev_upstream)
71 fd.close() 71 fd.close()
72 if opt.output_file != '-': 72 if opt.output_file != '-':
73 print('Saved manifest to %s' % opt.output_file, file=sys.stderr) 73 print('Saved manifest to %s' % opt.output_file, file=sys.stderr)
diff --git a/subcmds/selfupdate.py b/subcmds/selfupdate.py
index a8a09b64..b157e2f1 100644
--- a/subcmds/selfupdate.py
+++ b/subcmds/selfupdate.py
@@ -59,5 +59,5 @@ need to be performed by an end-user.
59 59
60 rp.bare_git.gc('--auto') 60 rp.bare_git.gc('--auto')
61 _PostRepoFetch(rp, 61 _PostRepoFetch(rp,
62 no_repo_verify = opt.no_repo_verify, 62 no_repo_verify=opt.no_repo_verify,
63 verbose = True) 63 verbose=True)
diff --git a/subcmds/status.py b/subcmds/status.py
index 63972d72..6012ae24 100644
--- a/subcmds/status.py
+++ b/subcmds/status.py
@@ -170,8 +170,8 @@ the following meanings:
170 class StatusColoring(Coloring): 170 class StatusColoring(Coloring):
171 def __init__(self, config): 171 def __init__(self, config):
172 Coloring.__init__(self, config, 'status') 172 Coloring.__init__(self, config, 'status')
173 self.project = self.printer('header', attr = 'bold') 173 self.project = self.printer('header', attr='bold')
174 self.untracked = self.printer('untracked', fg = 'red') 174 self.untracked = self.printer('untracked', fg='red')
175 175
176 orig_path = os.getcwd() 176 orig_path = os.getcwd()
177 try: 177 try:
diff --git a/subcmds/sync.py b/subcmds/sync.py
index 68ad88d5..13c419c3 100644
--- a/subcmds/sync.py
+++ b/subcmds/sync.py
@@ -396,8 +396,8 @@ later is required to fix a server side protocol bug.
396 err_event=err_event, 396 err_event=err_event,
397 clone_filter=self.manifest.CloneFilter) 397 clone_filter=self.manifest.CloneFilter)
398 if self.jobs > 1: 398 if self.jobs > 1:
399 t = _threading.Thread(target = self._FetchProjectList, 399 t = _threading.Thread(target=self._FetchProjectList,
400 kwargs = kwargs) 400 kwargs=kwargs)
401 # Ensure that Ctrl-C will not freeze the repo process. 401 # Ensure that Ctrl-C will not freeze the repo process.
402 t.daemon = True 402 t.daemon = True
403 threads.add(t) 403 threads.add(t)
@@ -704,16 +704,16 @@ later is required to fix a server side protocol bug.
704 gitdir = os.path.join(self.manifest.topdir, path, '.git') 704 gitdir = os.path.join(self.manifest.topdir, path, '.git')
705 if os.path.exists(gitdir): 705 if os.path.exists(gitdir):
706 project = Project( 706 project = Project(
707 manifest = self.manifest, 707 manifest=self.manifest,
708 name = path, 708 name=path,
709 remote = RemoteSpec('origin'), 709 remote=RemoteSpec('origin'),
710 gitdir = gitdir, 710 gitdir=gitdir,
711 objdir = gitdir, 711 objdir=gitdir,
712 worktree = os.path.join(self.manifest.topdir, path), 712 worktree=os.path.join(self.manifest.topdir, path),
713 relpath = path, 713 relpath=path,
714 revisionExpr = 'HEAD', 714 revisionExpr='HEAD',
715 revisionId = None, 715 revisionId=None,
716 groups = None) 716 groups=None)
717 717
718 if project.IsDirty() and opt.force_remove_dirty: 718 if project.IsDirty() and opt.force_remove_dirty:
719 print('WARNING: Removing dirty project "%s": uncommitted changes ' 719 print('WARNING: Removing dirty project "%s": uncommitted changes '
@@ -1100,9 +1100,9 @@ def _VerifyTag(project):
1100 1100
1101 cmd = [GIT, 'tag', '-v', cur] 1101 cmd = [GIT, 'tag', '-v', cur]
1102 proc = subprocess.Popen(cmd, 1102 proc = subprocess.Popen(cmd,
1103 stdout = subprocess.PIPE, 1103 stdout=subprocess.PIPE,
1104 stderr = subprocess.PIPE, 1104 stderr=subprocess.PIPE,
1105 env = env) 1105 env=env)
1106 out = proc.stdout.read() 1106 out = proc.stdout.read()
1107 proc.stdout.close() 1107 proc.stdout.close()
1108 1108
diff --git a/subcmds/upload.py b/subcmds/upload.py
index 25827c91..b81cf0a8 100644
--- a/subcmds/upload.py
+++ b/subcmds/upload.py
@@ -441,14 +441,14 @@ Gerrit Code Review: https://www.gerritcodereview.com/
441 def _GetMergeBranch(self, project): 441 def _GetMergeBranch(self, project):
442 p = GitCommand(project, 442 p = GitCommand(project,
443 ['rev-parse', '--abbrev-ref', 'HEAD'], 443 ['rev-parse', '--abbrev-ref', 'HEAD'],
444 capture_stdout = True, 444 capture_stdout=True,
445 capture_stderr = True) 445 capture_stderr=True)
446 p.Wait() 446 p.Wait()
447 local_branch = p.stdout.strip() 447 local_branch = p.stdout.strip()
448 p = GitCommand(project, 448 p = GitCommand(project,
449 ['config', '--get', 'branch.%s.merge' % local_branch], 449 ['config', '--get', 'branch.%s.merge' % local_branch],
450 capture_stdout = True, 450 capture_stdout=True,
451 capture_stderr = True) 451 capture_stderr=True)
452 p.Wait() 452 p.Wait()
453 merge_branch = p.stdout.strip() 453 merge_branch = p.stdout.strip()
454 return merge_branch 454 return merge_branch