Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow only a git hash to be specified. #71

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 10 additions & 9 deletions repo.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def git_update(self):
if rc != 0:
self.suite.log.fail("ERROR: git fetch was unsuccessful")

# if we need a special branch or are working on a PR, check it out now
# if we need a special branch, hash or are working on a PR, check it out now
if self.pr_wanted is not None:
self.suite.log.log("fetching PR {}".format(self.pr_wanted))
_, _, rc = test_util.run("git fetch origin pull/{}/head:pr-{}".format(
Expand All @@ -70,6 +70,14 @@ def git_update(self):
if rc != 0:
self.suite.log.fail("ERROR: git checkout was unsuccessful")

elif self.hash_wanted is not None:
self.suite.log.log("git checkout {} ".format(self.hash_wanted))
_, _, rc = test_util.run("git checkout {}".format(self.hash_wanted),
stdin=True, outfile="git.{}.out".format(self.name))

if rc != 0:
self.suite.log.fail("ERROR: git update was unsuccessful")

elif self.branch_orig != self.branch_wanted:
self.suite.log.log("git checkout {} in {}".format(self.branch_wanted, self.dir))
_, _, rc = test_util.run("git checkout {}".format(self.branch_wanted),
Expand All @@ -81,21 +89,14 @@ def git_update(self):
else:
self.branch_wanted = self.branch_orig

# get up to date on our branch or hash
# get up to date on our branch
if self.pr_wanted is None:
if self.hash_wanted == "" or self.hash_wanted is None:
self.suite.log.log("'git pull' in {}".format(self.dir))

_, _, rc = test_util.run("git pull", stdin=True,
outfile="git.{}.out".format(self.name))

else:
_, _, rc = test_util.run("git checkout {}".format(self.hash_wanted),
outfile="git.{}.out".format(self.name))

if rc != 0:
self.suite.log.fail("ERROR: git update was unsuccessful")

shutil.copy("git.{}.out".format(self.name), self.suite.full_web_dir)

def save_head(self):
Expand Down