Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(659)

Side by Side Diff: scripts/slave/recipe_modules/gclient/test_api.py

Issue 1151423002: Move recipe engine to third_party/recipe_engine. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/build
Patch Set: Moved field_composer_test with its buddies Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 # Copyright 2014 The Chromium Authors. All rights reserved. 1 # Copyright 2014 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 import hashlib 5 import hashlib
6 6
7 from slave import recipe_test_api 7 from recipe_engine import recipe_test_api
8 8
9 class GclientTestApi(recipe_test_api.RecipeTestApi): 9 class GclientTestApi(recipe_test_api.RecipeTestApi):
10 def output_json(self, projects, git_mode=False): 10 def output_json(self, projects, git_mode=False):
11 """Deterministically synthesize json.output test data for gclient's 11 """Deterministically synthesize json.output test data for gclient's
12 --output-json option. 12 --output-json option.
13 13
14 Args: 14 Args:
15 projects - a list of project paths (e.g. ['src', 'src/dependency']) 15 projects - a list of project paths (e.g. ['src', 'src/dependency'])
16 git_mode - Return git hashes instead of svn revs. 16 git_mode - Return git hashes instead of svn revs.
17 """ 17 """
(...skipping 10 matching lines...) Expand all
28 28
29 @staticmethod 29 @staticmethod
30 def gen_revision(project, GIT_MODE): 30 def gen_revision(project, GIT_MODE):
31 """Hash project to bogus deterministic revision values.""" 31 """Hash project to bogus deterministic revision values."""
32 h = hashlib.sha1(project) 32 h = hashlib.sha1(project)
33 if GIT_MODE: 33 if GIT_MODE:
34 return h.hexdigest() 34 return h.hexdigest()
35 else: 35 else:
36 import struct 36 import struct
37 return struct.unpack('!I', h.digest()[:4])[0] % 300000 37 return struct.unpack('!I', h.digest()[:4])[0] % 300000
OLDNEW
« no previous file with comments | « scripts/slave/recipe_modules/gclient/config.py ('k') | scripts/slave/recipe_modules/generator_script/api.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698