blob: 72485e148aba538d434400e76af29b34ad76e02f [file] [log] [blame]
#!/usr/bin/env python
# Copyright (c) 2019, the R8 project authors. Please see the AUTHORS file
# for details. All rights reserved. Use of this source code is governed by a
# BSD-style license that can be found in the LICENSE file.
import utils
import subprocess
def GitClone(url, checkout_dir):
cmd = ['git', 'clone', url, checkout_dir]
utils.PrintCmd(cmd)
return subprocess.check_call(cmd)
def GetHeadRevision(checkout_dir, use_master=False):
revision_from = 'origin/master' if use_master else 'HEAD'
cmd = ['git', 'rev-parse', revision_from]
utils.PrintCmd(cmd)
with utils.ChangedWorkingDirectory(checkout_dir):
return subprocess.check_output(cmd).strip()