summaryrefslogtreecommitdiffstats
path: root/main.py
diff options
context:
space:
mode:
authorMike Frysinger <vapier@google.com>2021-06-14 16:17:27 -0400
committerMike Frysinger <vapier@google.com>2021-06-15 06:08:13 +0000
commitd58d0dd3bf40f2c5e754c8a0a622c7d4e58425b8 (patch)
tree37fc46209f7822a29b0879bc2aa7405323f3db4a /main.py
parentd88b369a42462cf5fe4ff2a09b9b7b52e0ee333a (diff)
downloadgit-repo-d58d0dd3bf40f2c5e754c8a0a622c7d4e58425b8.tar.gz
commands: pass settings via __init__
Instead of setting properties on the instantiated command, pass them via the constructor like normal objects. Change-Id: I8787499bd2be68565875ffe243c3cf2024b36ae7 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/309324 Reviewed-by: Raman Tenneti <rtenneti@google.com> Tested-by: Mike Frysinger <vapier@google.com>
Diffstat (limited to 'main.py')
-rwxr-xr-xmain.py24
1 files changed, 13 insertions, 11 deletions
diff --git a/main.py b/main.py
index 1f3a7683..32ad0ff6 100755
--- a/main.py
+++ b/main.py
@@ -195,23 +195,25 @@ class _Repo(object):
195 195
196 SetDefaultColoring(gopts.color) 196 SetDefaultColoring(gopts.color)
197 197
198 git_trace2_event_log = EventLog()
199 repo_client = RepoClient(self.repodir)
200 gitc_manifest = None
201 gitc_client_name = gitc_utils.parse_clientdir(os.getcwd())
202 if gitc_client_name:
203 gitc_manifest = GitcClient(self.repodir, gitc_client_name)
204 repo_client.isGitcClient = True
205
198 try: 206 try:
199 cmd = self.commands[name]() 207 cmd = self.commands[name](
208 repodir=self.repodir,
209 client=repo_client,
210 manifest=repo_client.manifest,
211 gitc_manifest=gitc_manifest)
200 except KeyError: 212 except KeyError:
201 print("repo: '%s' is not a repo command. See 'repo help'." % name, 213 print("repo: '%s' is not a repo command. See 'repo help'." % name,
202 file=sys.stderr) 214 file=sys.stderr)
203 return 1 215 return 1
204 216
205 git_trace2_event_log = EventLog()
206 cmd.repodir = self.repodir
207 cmd.client = RepoClient(cmd.repodir)
208 cmd.manifest = cmd.client.manifest
209 cmd.gitc_manifest = None
210 gitc_client_name = gitc_utils.parse_clientdir(os.getcwd())
211 if gitc_client_name:
212 cmd.gitc_manifest = GitcClient(cmd.repodir, gitc_client_name)
213 cmd.client.isGitcClient = True
214
215 Editor.globalConfig = cmd.client.globalConfig 217 Editor.globalConfig = cmd.client.globalConfig
216 218
217 if not isinstance(cmd, MirrorSafeCommand) and cmd.manifest.IsMirror: 219 if not isinstance(cmd, MirrorSafeCommand) and cmd.manifest.IsMirror: