| OLD | NEW |
| (Empty) |
| 1 #!/usr/bin/env python | |
| 2 # Copyright (c) 2014 The Chromium Authors. All rights reserved. | |
| 3 # Use of this source code is governed by a BSD-style license that can be | |
| 4 # found in the LICENSE file. | |
| 5 | |
| 6 | |
| 7 """Forcibly update the local checkout.""" | |
| 8 | |
| 9 | |
| 10 | |
| 11 import os | |
| 12 import shlex | |
| 13 import sys | |
| 14 | |
| 15 BUILDBOT_PATH = os.path.realpath(os.path.join( | |
| 16 os.path.dirname(os.path.abspath(__file__)), os.pardir, os.pardir, os.pardir) | |
| 17 ) | |
| 18 | |
| 19 sys.path.append(os.path.join(BUILDBOT_PATH, 'common')) | |
| 20 sys.path.append(os.path.join(BUILDBOT_PATH, 'site_config')) | |
| 21 sys.path.append(os.path.join(BUILDBOT_PATH, 'third_party', | |
| 22 'chromium_buildbot', 'scripts')) | |
| 23 | |
| 24 import gclient_utils | |
| 25 from py.utils import git_utils | |
| 26 from py.utils import misc | |
| 27 from py.utils import shell_utils | |
| 28 import skia_vars | |
| 29 | |
| 30 | |
| 31 BUILDBOT_GIT_URL = skia_vars.GetGlobalVariable('buildbot_git_url') | |
| 32 GOT_REVISION_PATTERN = 'Skiabot scripts updated to %s' | |
| 33 | |
| 34 | |
| 35 def force_update(): | |
| 36 with misc.ChDir(os.path.join(misc.BUILDBOT_PATH, os.pardir)): | |
| 37 # Run "gclient" before doing anything else to ensure that we get the | |
| 38 # necessary stuff installed. | |
| 39 gclient_utils.GClient() | |
| 40 | |
| 41 # Be sure that we sync to the most recent commit. | |
| 42 buildbot_revision = None | |
| 43 try: | |
| 44 output = git_utils.GetRemoteMasterHash(BUILDBOT_GIT_URL) | |
| 45 if output: | |
| 46 buildbot_revision = shlex.split(output)[0] | |
| 47 except shell_utils.CommandFailedException: | |
| 48 pass | |
| 49 if not buildbot_revision: | |
| 50 buildbot_revision = 'origin/master' | |
| 51 | |
| 52 gclient_utils.Sync(revisions=[('buildbot', buildbot_revision)], | |
| 53 verbose=True, force=True) | |
| 54 got_revision = gclient_utils.GetCheckedOutHash() | |
| 55 print GOT_REVISION_PATTERN % got_revision | |
| 56 | |
| 57 return gclient_utils.GetCheckedOutHash() | |
| 58 | |
| 59 | |
| 60 if __name__ == '__main__': | |
| 61 force_update() | |
| OLD | NEW |