blob: ec5159104819d6217656978ef3ff8bc21a56bff0 [file] [log] [blame]
# Copyright 2020 The Fuchsia Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from recipe_engine import recipe_test_api
class GitTestApi(recipe_test_api.RecipeTestApi):
def branch(self, step_name, branches, remotes=False):
test_data = "\n".join(
[" %s%s" % ("origin/" if remotes else "", b) for b in branches]
)
return self.step_data(step_name, stdout=self.m.raw_io.output_text(test_data))
def get_remote_branch_head(self, step_name, revision):
return self.step_data(step_name, stdout=self.m.raw_io.output_text(revision))
def get_changed_files(self, step_name, files):
return self.step_data(
step_name,
stdout=self.m.raw_io.output_text("".join("{}\0".format(f) for f in files)),
)
def rev_parse(self, step_name, revision):
return self.step_data(step_name, stdout=self.m.raw_io.output_text(revision))