| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright 2014 The Chromium Authors. All rights reserved. | 2 # Copyright 2014 The Chromium Authors. All rights reserved. |
| 3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
| 5 | 5 |
| 6 import codecs | 6 import codecs |
| 7 import copy | 7 import copy |
| 8 import cStringIO |
| 9 import json |
| 8 import optparse | 10 import optparse |
| 9 import os | 11 import os |
| 10 import pprint | 12 import pprint |
| 11 import shutil | 13 import shutil |
| 12 import socket | 14 import socket |
| 13 import subprocess | 15 import subprocess |
| 14 import sys | 16 import sys |
| 15 import time | 17 import time |
| 18 import urllib2 |
| 16 import urlparse | 19 import urlparse |
| 17 | 20 |
| 18 import os.path as path | 21 import os.path as path |
| 19 | 22 |
| 20 from common import chromium_utils | 23 from common import chromium_utils |
| 21 | 24 |
| 22 | 25 |
| 23 RECOGNIZED_PATHS = { | 26 RECOGNIZED_PATHS = { |
| 24 # If SVN path matches key, the entire URL is rewritten to the Git url. | 27 # If SVN path matches key, the entire URL is rewritten to the Git url. |
| 25 '/chrome/trunk/src': | 28 '/chrome/trunk/src': |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 THIS_DIR = path.abspath(os.getcwd()) | 112 THIS_DIR = path.abspath(os.getcwd()) |
| 110 BUILDER_DIR = path.dirname(THIS_DIR) | 113 BUILDER_DIR = path.dirname(THIS_DIR) |
| 111 SLAVE_DIR = path.dirname(BUILDER_DIR) | 114 SLAVE_DIR = path.dirname(BUILDER_DIR) |
| 112 CACHE_DIR = path.join(SLAVE_DIR, 'cache_dir') | 115 CACHE_DIR = path.join(SLAVE_DIR, 'cache_dir') |
| 113 # Because we print CACHE_DIR out into a .gclient file, and then later run | 116 # Because we print CACHE_DIR out into a .gclient file, and then later run |
| 114 # eval() on it, backslashes need to be escaped, otherwise "E:\b\build" gets | 117 # eval() on it, backslashes need to be escaped, otherwise "E:\b\build" gets |
| 115 # parsed as "E:[\x08][\x08]uild". | 118 # parsed as "E:[\x08][\x08]uild". |
| 116 if sys.platform.startswith('win'): | 119 if sys.platform.startswith('win'): |
| 117 CACHE_DIR = CACHE_DIR.replace('\\', '\\\\') | 120 CACHE_DIR = CACHE_DIR.replace('\\', '\\\\') |
| 118 | 121 |
| 122 # Find the patch tool. |
| 123 ROOT_BUILD_DIR = path.dirname(SLAVE_DIR) |
| 124 ROOT_B_DIR = path.dirname(ROOT_BUILD_DIR) |
| 125 BUILD_INTERNAL_DIR = path.join(ROOT_B_DIR, 'build_internal') |
| 126 if sys.platform.startswith('win'): |
| 127 PATCH_TOOL = path.join(BUILD_INTERNAL_DIR, 'tools', 'patch.EXE') |
| 128 else: |
| 129 PATCH_TOOL = '/usr/bin/patch' |
| 130 |
| 119 | 131 |
| 120 class SubprocessFailed(Exception): | 132 class SubprocessFailed(Exception): |
| 121 def __init__(self, message, code): | 133 def __init__(self, message, code): |
| 122 Exception.__init__(self, message) | 134 Exception.__init__(self, message) |
| 123 self.code = code | 135 self.code = code |
| 124 | 136 |
| 125 | 137 |
| 126 def call(*args, **kwargs): | 138 def call(*args, **kwargs): |
| 127 """Interactive subprocess call.""" | 139 """Interactive subprocess call.""" |
| 128 kwargs['stdout'] = subprocess.PIPE | 140 kwargs['stdout'] = subprocess.PIPE |
| 129 kwargs['stderr'] = subprocess.STDOUT | 141 kwargs['stderr'] = subprocess.STDOUT |
| 142 stdin_data = kwargs.pop('stdin_data', None) |
| 143 if stdin_data: |
| 144 kwargs['stdin'] = subprocess.PIPE |
| 145 out = cStringIO.StringIO() |
| 130 for attempt in xrange(RETRIES): | 146 for attempt in xrange(RETRIES): |
| 131 attempt_msg = ' (retry #%d)' % attempt if attempt else '' | 147 attempt_msg = ' (retry #%d)' % attempt if attempt else '' |
| 132 print '===Running %s%s===' % (' '.join(args), attempt_msg) | 148 print '===Running %s%s===' % (' '.join(args), attempt_msg) |
| 133 start_time = time.time() | 149 start_time = time.time() |
| 134 proc = subprocess.Popen(args, **kwargs) | 150 proc = subprocess.Popen(args, **kwargs) |
| 151 if stdin_data: |
| 152 proc.stdin.write(stdin_data) |
| 153 proc.stdin.close() |
| 135 # This is here because passing 'sys.stdout' into stdout for proc will | 154 # This is here because passing 'sys.stdout' into stdout for proc will |
| 136 # produce out of order output. | 155 # produce out of order output. |
| 137 while True: | 156 while True: |
| 138 buf = proc.stdout.read(1) | 157 buf = proc.stdout.read(1) |
| 139 if not buf: | 158 if not buf: |
| 140 break | 159 break |
| 141 sys.stdout.write(buf) | 160 sys.stdout.write(buf) |
| 161 out.write(buf) |
| 142 code = proc.wait() | 162 code = proc.wait() |
| 143 elapsed_time = ((time.time() - start_time) / 60.0) | 163 elapsed_time = ((time.time() - start_time) / 60.0) |
| 144 if not code: | 164 if not code: |
| 145 print '===Succeeded in %.1f mins===' % elapsed_time | 165 print '===Succeeded in %.1f mins===' % elapsed_time |
| 146 print | 166 print |
| 147 return 0 | 167 return out.getvalue() |
| 148 print '===Failed in %.1f mins===' % elapsed_time | 168 print '===Failed in %.1f mins===' % elapsed_time |
| 149 print | 169 print |
| 150 | 170 |
| 151 raise SubprocessFailed('%s failed with code %d in %s after %d attempts.' % | 171 raise SubprocessFailed('%s failed with code %d in %s after %d attempts.' % |
| 152 (' '.join(args), code, os.getcwd(), RETRIES), code) | 172 (' '.join(args), code, os.getcwd(), RETRIES), code) |
| 153 | 173 |
| 154 | 174 |
| 155 def git(*args, **kwargs): | 175 def git(*args, **kwargs): |
| 156 """Wrapper around call specifically for Git commands.""" | 176 """Wrapper around call specifically for Git commands.""" |
| 157 git_executable = 'git' | 177 git_executable = 'git' |
| 158 # On windows, subprocess doesn't fuzzy-match 'git' to 'git.bat', so we | 178 # On windows, subprocess doesn't fuzzy-match 'git' to 'git.bat', so we |
| 159 # have to do it explicitly. This is better than passing shell=True. | 179 # have to do it explicitly. This is better than passing shell=True. |
| 160 if sys.platform.startswith('win'): | 180 if sys.platform.startswith('win'): |
| 161 git_executable += '.bat' | 181 git_executable += '.bat' |
| 162 cmd = (git_executable,) + args | 182 cmd = (git_executable,) + args |
| 163 call(*cmd, **kwargs) | 183 return call(*cmd, **kwargs) |
| 164 | 184 |
| 165 | 185 |
| 166 def get_gclient_spec(solutions): | 186 def get_gclient_spec(solutions): |
| 167 return GCLIENT_TEMPLATE % { | 187 return GCLIENT_TEMPLATE % { |
| 168 'solutions': pprint.pformat(solutions, indent=4), | 188 'solutions': pprint.pformat(solutions, indent=4), |
| 169 'cache_dir': '"%s"' % CACHE_DIR | 189 'cache_dir': '"%s"' % CACHE_DIR |
| 170 } | 190 } |
| 171 | 191 |
| 172 | 192 |
| 173 def check_enabled(master, builder, slave): | 193 def check_enabled(master, builder, slave): |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 277 with codecs.open('.gclient', mode='w', encoding='utf-8') as f: | 297 with codecs.open('.gclient', mode='w', encoding='utf-8') as f: |
| 278 f.write(get_gclient_spec(solutions)) | 298 f.write(get_gclient_spec(solutions)) |
| 279 | 299 |
| 280 | 300 |
| 281 def gclient_sync(): | 301 def gclient_sync(): |
| 282 gclient_bin = 'gclient.bat' if sys.platform.startswith('win') else 'gclient' | 302 gclient_bin = 'gclient.bat' if sys.platform.startswith('win') else 'gclient' |
| 283 call(gclient_bin, 'sync', '--verbose', '--reset', '--force', | 303 call(gclient_bin, 'sync', '--verbose', '--reset', '--force', |
| 284 '--nohooks', '--noprehooks') | 304 '--nohooks', '--noprehooks') |
| 285 | 305 |
| 286 | 306 |
| 307 def create_less_than_or_equal_regex(number): |
| 308 """ Return a regular expression to test whether an integer less than or equal |
| 309 to 'number' is present in a given string. |
| 310 """ |
| 311 |
| 312 # In three parts, build a regular expression that match any numbers smaller |
| 313 # than 'number'. |
| 314 # For example, 78656 would give a regular expression that looks like: |
| 315 # Part 1 |
| 316 # (78356| # 78356 |
| 317 # Part 2 |
| 318 # 7835[0-5]| # 78350-78355 |
| 319 # 783[0-4][0-9]| # 78300-78349 |
| 320 # 78[0-2][0-9]{2}| # 78000-78299 |
| 321 # 7[0-7][0-9]{3}| # 70000-77999 |
| 322 # [0-6][0-9]{4}| # 10000-69999 |
| 323 # Part 3 |
| 324 # [0-9]{1,4} # 0-9999 |
| 325 |
| 326 # Part 1: Create an array with all the regexes, as described above. |
| 327 # Prepopulate it with the number itself. |
| 328 number = str(number) |
| 329 expressions = [number] |
| 330 |
| 331 # Convert the number to a list, so we can translate digits in it to |
| 332 # expressions. |
| 333 num_list = list(number) |
| 334 num_len = len(num_list) |
| 335 |
| 336 # Part 2: Go through all the digits in the number, starting from the end. |
| 337 # Each iteration appends a line to 'expressions'. |
| 338 for index in range (num_len - 1, -1, -1): |
| 339 # Convert this digit back to an integer. |
| 340 digit = int(num_list[index]) |
| 341 |
| 342 # Part 2.1: No processing if this digit is a zero. |
| 343 if digit == 0: |
| 344 continue |
| 345 |
| 346 # Part 2.2: We switch the current digit X by a range "[0-(X-1)]". |
| 347 if digit == 1: |
| 348 num_list[index] = '0' |
| 349 else: |
| 350 num_list[index] = '[0-%d]' % (digit - 1) |
| 351 |
| 352 # Part 2.3: We set all following digits to be "[0-9]". |
| 353 # Since we just decrementented a digit in a most important position, all |
| 354 # following digits don't matter. The possible numbers will always be smaller |
| 355 # than before we decremented. |
| 356 if (index + 1) < num_len: |
| 357 if (num_len - (index + 1)) == 1: |
| 358 num_list[index + 1] = '[0-9]' |
| 359 else: |
| 360 num_list[index + 1] = '[0-9]{%s}' % (num_len - (index + 1)) |
| 361 |
| 362 # Part 2.4: Add this new sub-expression to the list. |
| 363 expressions.append(''.join(num_list[:min(index+2, num_len)])) |
| 364 |
| 365 # Part 3: We add all the full ranges to match all numbers that are at least |
| 366 # one order of magnitude smaller than the original numbers. |
| 367 if num_len == 2: |
| 368 expressions.append('[0-9]') |
| 369 elif num_len > 2: |
| 370 expressions.append('[0-9]{1,%s}' % (num_len - 1)) |
| 371 |
| 372 # All done. We now have our final regular expression. |
| 373 regex = '(%s)' % ('|'.join(expressions)) |
| 374 return regex |
| 375 |
| 376 |
| 287 def get_git_hash(revision, dir_name): | 377 def get_git_hash(revision, dir_name): |
| 288 match = "^git-svn-id: [^ ]*@%d" % revision | 378 match = "^git-svn-id: [^ ]*@%s " % create_less_than_or_equal_regex(revision) |
| 289 cmd = ['git', 'log', '--grep', match, '--format=%H', dir_name] | 379 cmd = ['git', 'log', '-E', '--grep', match, '--format=%H', '--max-count=1'] |
| 290 return subprocess.check_output(cmd).strip() or None | 380 results = call(*cmd, cwd=dir_name).strip().splitlines() |
| 381 if results: |
| 382 return results[0] |
| 383 raise Exception('We can\'t resolve svn revision %s into a git hash' % |
| 384 revision) |
| 291 | 385 |
| 292 | 386 |
| 293 def deps2git(sln_dirs): | 387 def deps2git(sln_dirs): |
| 294 for sln_dir in sln_dirs: | 388 for sln_dir in sln_dirs: |
| 295 deps_file = path.join(os.getcwd(), sln_dir, 'DEPS') | 389 deps_file = path.join(os.getcwd(), sln_dir, 'DEPS') |
| 296 deps_git_file = path.join(os.getcwd(), sln_dir, '.DEPS.git') | 390 deps_git_file = path.join(os.getcwd(), sln_dir, '.DEPS.git') |
| 297 if not path.isfile(deps_file): | 391 if not path.isfile(deps_file): |
| 298 return | 392 return |
| 299 # Do we have a better way of doing this....? | 393 # Do we have a better way of doing this....? |
| 300 repo_type = 'internal' if 'internal' in sln_dir else 'public' | 394 repo_type = 'internal' if 'internal' in sln_dir else 'public' |
| 301 call(sys.executable, DEPS2GIT_PATH, '-t', repo_type, | 395 call(sys.executable, DEPS2GIT_PATH, '-t', repo_type, |
| 302 '--cache_dir=%s' % CACHE_DIR, | 396 '--cache_dir=%s' % CACHE_DIR, |
| 303 '--deps=%s' % deps_file, '--out=%s' % deps_git_file) | 397 '--deps=%s' % deps_file, '--out=%s' % deps_git_file) |
| 304 | 398 |
| 305 | 399 |
| 400 def emit_got_revision(revision): |
| 401 print '@@@SET_BUILD_PROPERTY@got_revision@%s@@@' % revision |
| 402 |
| 306 def git_checkout(solutions, revision): | 403 def git_checkout(solutions, revision): |
| 307 build_dir = os.getcwd() | 404 build_dir = os.getcwd() |
| 308 # Revision only applies to the first solution. | 405 # Revision only applies to the first solution. |
| 309 first_solution = True | 406 first_solution = True |
| 310 for sln in solutions: | 407 for sln in solutions: |
| 311 name = sln['name'] | 408 name = sln['name'] |
| 312 url = sln['url'] | 409 url = sln['url'] |
| 313 sln_dir = path.join(build_dir, name) | 410 sln_dir = path.join(build_dir, name) |
| 314 if not path.isdir(sln_dir): | 411 if not path.isdir(sln_dir): |
| 315 git('clone', url, sln_dir) | 412 git('clone', url, sln_dir) |
| 316 | 413 |
| 317 # Clean out .DEPS.git changes first. | 414 # Clean out .DEPS.git changes first. |
| 318 try: | 415 try: |
| 319 git('reset', '--hard', cwd=sln_dir) | 416 git('reset', '--hard', cwd=sln_dir) |
| 320 except SubprocessFailed as e: | 417 except SubprocessFailed as e: |
| 321 if e.code == 128: | 418 if e.code == 128: |
| 322 # Exited abnormally, theres probably something wrong with the checkout. | 419 # Exited abnormally, theres probably something wrong with the checkout. |
| 323 # Lets wipe the checkout and try again. | 420 # Lets wipe the checkout and try again. |
| 324 chromium_utils.RemoveDirectory(sln_dir) | 421 chromium_utils.RemoveDirectory(sln_dir) |
| 325 git('clone', url, sln_dir) | 422 git('clone', url, sln_dir) |
| 326 git('reset', '--hard', cwd=sln_dir) | 423 git('reset', '--hard', cwd=sln_dir) |
| 327 else: | 424 else: |
| 328 raise | 425 raise |
| 329 | 426 |
| 330 git('clean', '-df', cwd=sln_dir) | 427 git('clean', '-df', cwd=sln_dir) |
| 331 git('pull', 'origin', 'master', cwd=sln_dir) | 428 git('pull', 'origin', 'master', cwd=sln_dir) |
| 332 # TODO(hinoka): We probably have to make use of revision mapping. | 429 # TODO(hinoka): We probably have to make use of revision mapping. |
| 333 if first_solution and revision and revision.lower() != 'head': | 430 if first_solution and revision and revision.lower() != 'head': |
| 431 emit_got_revision(revision) |
| 334 if revision and revision.isdigit() and len(revision) < 40: | 432 if revision and revision.isdigit() and len(revision) < 40: |
| 335 # rev_num is really a svn revision number, convert it into a git hash. | 433 # rev_num is really a svn revision number, convert it into a git hash. |
| 336 git_ref = get_git_hash(revision, name) | 434 git_ref = get_git_hash(int(revision), name) |
| 337 else: | 435 else: |
| 338 # rev_num is actually a git hash or ref, we can just use it. | 436 # rev_num is actually a git hash or ref, we can just use it. |
| 339 git_ref = revision | 437 git_ref = revision |
| 340 git('checkout', git_ref, cwd=sln_dir) | 438 git('checkout', git_ref, cwd=sln_dir) |
| 341 else: | 439 else: |
| 342 git('checkout', 'origin/master', cwd=sln_dir) | 440 git('checkout', 'origin/master', cwd=sln_dir) |
| 441 if first_solution: |
| 442 git_ref = git('log', '--format=%H', '--max-count=1', |
| 443 cwd=sln_dir).strip() |
| 343 | 444 |
| 344 first_solution = False | 445 first_solution = False |
| 446 return git_ref |
| 345 | 447 |
| 346 | 448 |
| 347 def apply_issue(issue, patchset, root, server): | 449 def _download(url): |
| 348 pass | 450 """Fetch url and return content, with retries for flake.""" |
| 451 for attempt in xrange(RETRIES): |
| 452 try: |
| 453 return urllib2.urlopen(url).read() |
| 454 except Exception: |
| 455 if attempt == RETRIES - 1: |
| 456 raise |
| 457 |
| 458 |
| 459 def apply_issue_svn(root, patch_url): |
| 460 patch_data = call('svn', 'cat', patch_url) |
| 461 call(PATCH_TOOL, '-p0', '--remove-empty-files', '--force', '--forward', |
| 462 stdin_data=patch_data, cwd=root) |
| 463 |
| 464 |
| 465 def apply_issue_rietveld(issue, patchset, root, server, rev_map, revision): |
| 466 apply_issue_bin = ('apply_issue.bat' if sys.platform.startswith('win') |
| 467 else 'apply_issue') |
| 468 rev_map = json.loads(rev_map) |
| 469 if root in rev_map and rev_map[root] == 'got_revision': |
| 470 rev_map[root] = revision |
| 471 call(apply_issue_bin, |
| 472 '--root_dir', root, |
| 473 '--issue', issue, |
| 474 '--patchset', patchset, |
| 475 '--no-auth', |
| 476 '--server', server, |
| 477 '--revision-mapping', json.dumps(rev_map), |
| 478 '--base_ref', revision, |
| 479 '--force') |
| 349 | 480 |
| 350 | 481 |
| 351 def check_flag(flag_file): | 482 def check_flag(flag_file): |
| 352 """Returns True if the flag file is present.""" | 483 """Returns True if the flag file is present.""" |
| 353 return os.path.isfile(flag_file) | 484 return os.path.isfile(flag_file) |
| 354 | 485 |
| 355 | 486 |
| 356 def delete_flag(flag_file): | 487 def delete_flag(flag_file): |
| 357 """Remove bot update flag.""" | 488 """Remove bot update flag.""" |
| 358 if os.path.isfile(flag_file): | 489 if os.path.isfile(flag_file): |
| 359 os.remove(flag_file) | 490 os.remove(flag_file) |
| 360 | 491 |
| 361 | 492 |
| 362 def emit_flag(flag_file): | 493 def emit_flag(flag_file): |
| 363 """Deposit a bot update flag on the system to tell gclient not to run.""" | 494 """Deposit a bot update flag on the system to tell gclient not to run.""" |
| 364 print 'Emitting flag file at %s' % flag_file | 495 print 'Emitting flag file at %s' % flag_file |
| 365 with open(flag_file, 'wb') as f: | 496 with open(flag_file, 'wb') as f: |
| 366 f.write('Success!') | 497 f.write('Success!') |
| 367 | 498 |
| 368 | 499 |
| 369 def parse_args(): | 500 def parse_args(): |
| 370 parse = optparse.OptionParser() | 501 parse = optparse.OptionParser() |
| 371 | 502 |
| 372 parse.add_option('--issue', help='Issue number to patch from.') | 503 parse.add_option('--issue', help='Issue number to patch from.') |
| 373 parse.add_option('--patchset', | 504 parse.add_option('--patchset', |
| 374 help='Patchset from issue to patch from, if applicable.') | 505 help='Patchset from issue to patch from, if applicable.') |
| 375 parse.add_option('--patch_url', help='Optional URL to SVN patch.') | 506 parse.add_option('--patch_url', help='Optional URL to SVN patch.') |
| 376 parse.add_option('--root', help='Repository root.') | 507 parse.add_option('--root', help='Repository root.') |
| 377 parse.add_option('--rietveld_server', help='Rietveld server.') | 508 parse.add_option('--rietveld_server', |
| 509 default='codereview.chromium.org', |
| 510 help='Rietveld server.') |
| 378 parse.add_option('--specs', help='Gcilent spec.') | 511 parse.add_option('--specs', help='Gcilent spec.') |
| 379 parse.add_option('--master', help='Master name.') | 512 parse.add_option('--master', help='Master name.') |
| 380 parse.add_option('-f', '--force', action='store_true', | 513 parse.add_option('-f', '--force', action='store_true', |
| 381 help='Bypass check to see if we want to be run. ' | 514 help='Bypass check to see if we want to be run. ' |
| 382 'Should ONLY be used locally.') | 515 'Should ONLY be used locally.') |
| 383 # TODO(hinoka): We don't actually use this yet, we should factor this in. | 516 parse.add_option('--revision_mapping') |
| 384 parse.add_option('--revision-mapping') | |
| 385 parse.add_option('--revision') | 517 parse.add_option('--revision') |
| 386 parse.add_option('--slave_name', default=socket.getfqdn().split('.')[0], | 518 parse.add_option('--slave_name', default=socket.getfqdn().split('.')[0], |
| 387 help='Hostname of the current machine, ' | 519 help='Hostname of the current machine, ' |
| 388 'used for determining whether or not to activate.') | 520 'used for determining whether or not to activate.') |
| 389 parse.add_option('--builder_name', help='Name of the builder, ' | 521 parse.add_option('--builder_name', help='Name of the builder, ' |
| 390 'used for determining whether or not to activate.') | 522 'used for determining whether or not to activate.') |
| 391 parse.add_option('--build_dir', default=os.getcwd()) | 523 parse.add_option('--build_dir', default=os.getcwd()) |
| 392 parse.add_option('--flag_file', default=path.join(os.getcwd(), | 524 parse.add_option('--flag_file', default=path.join(os.getcwd(), |
| 393 'update.flag')) | 525 'update.flag')) |
| 394 | 526 |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 430 ensure_no_checkout(dir_names, '.svn') | 562 ensure_no_checkout(dir_names, '.svn') |
| 431 emit_flag(options.flag_file) | 563 emit_flag(options.flag_file) |
| 432 else: | 564 else: |
| 433 delete_flag(options.flag_file) | 565 delete_flag(options.flag_file) |
| 434 return | 566 return |
| 435 | 567 |
| 436 # Get a checkout of each solution, without DEPS or hooks. | 568 # Get a checkout of each solution, without DEPS or hooks. |
| 437 # Calling git directory because there is no way to run Gclient without | 569 # Calling git directory because there is no way to run Gclient without |
| 438 # invoking DEPS. | 570 # invoking DEPS. |
| 439 print 'Fetching Git checkout' | 571 print 'Fetching Git checkout' |
| 440 git_checkout(git_solutions, options.revision) | 572 got_revision = git_checkout(git_solutions, options.revision) |
| 441 | 573 |
| 442 # TODO(hinoka): This must be implemented before we can turn this on for TS. | 574 options.root = options.root or dir_names[0] |
| 443 # if options.issue: | 575 if options.patch_url: |
| 444 # apply_issue(options.issue, options.patchset, options.root, options.server) | 576 apply_issue_svn(options.root, options.patch_url) |
| 577 elif options.issue: |
| 578 apply_issue_rietveld(options.issue, options.patchset, options.root, |
| 579 options.rietveld_server, options.revision_mapping, |
| 580 got_revision) |
| 445 | 581 |
| 446 # Magic to get deps2git to work with internal DEPS. | 582 # Magic to get deps2git to work with internal DEPS. |
| 447 shutil.copyfile(S2G_INTERNAL_FROM_PATH, S2G_INTERNAL_DEST_PATH) | 583 shutil.copyfile(S2G_INTERNAL_FROM_PATH, S2G_INTERNAL_DEST_PATH) |
| 448 deps2git(dir_names) | 584 deps2git(dir_names) |
| 449 | 585 |
| 450 gclient_configure(git_solutions) | 586 gclient_configure(git_solutions) |
| 451 gclient_sync() | 587 gclient_sync() |
| 452 | 588 |
| 453 | 589 |
| 454 if __name__ == '__main__': | 590 if __name__ == '__main__': |
| 455 sys.exit(main()) | 591 sys.exit(main()) |
| OLD | NEW |