gerrit: deps: hack up --raw output to avoid confusion
The current PrintCls helper assumes there is only one active GoB host
at a time which the deps tool violates. Handle the --raw output in
deps directly to workaround that. Reworking the code in general to
avoid this will take more surgery, so just unbreak for now.
BUG=chromium:1079371
TEST=`gerrit --raw deps 2171399` shows GoB hosts
Change-Id: I030aba464020e77c6582055d15e01ca039e88dcc
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/chromite/+/2190152
Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
Tested-by: Mike Frysinger <vapier@chromium.org>
diff --git a/scripts/gerrit.py b/scripts/gerrit.py
index b345f53..1fcf89f 100644
--- a/scripts/gerrit.py
+++ b/scripts/gerrit.py
@@ -387,10 +387,16 @@
transitives = _BreadthFirstSearch(
cls, functools.partial(self._Children, opts, _QueryChange),
- visited_key=lambda cl: cl.gerrit_number)
+ visited_key=lambda cl: cl.PatchLink())
- transitives_raw = [cl.patch_dict for cl in transitives]
- PrintCls(opts, transitives_raw)
+ # This is a hack to avoid losing GoB host for each CL. The PrintCls
+ # function assumes the GoB host specified by the user is the only one
+ # that is ever used, but the deps command walks across hosts.
+ if opts.raw:
+ print('\n'.join(x.PatchLink() for x in transitives))
+ else:
+ transitives_raw = [cl.patch_dict for cl in transitives]
+ PrintCls(opts, transitives_raw)
@staticmethod
def _ProcessDeps(opts, querier, cl, deps, required):