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

Side by Side Diff: git_number.py

Issue 184113002: Add git-map and git-short-map to depot_tools. (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/depot_tools.git@new_branch
Patch Set: Make it work on windows Created 6 years, 9 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
« no previous file with comments | « git_nav_downstream.py ('k') | testing_support/git_test_utils.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright 2013 The Chromium Authors. All rights reserved. 2 # Copyright 2013 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 """Usage: %prog [options] [<commitref>]* 6 """Usage: %prog [options] [<commitref>]*
7 7
8 If no <commitref>'s are supplied, it defaults to HEAD. 8 If no <commitref>'s are supplied, it defaults to HEAD.
9 9
10 Calculates the generation number for one or more commits in a git repo. 10 Calculates the generation number for one or more commits in a git repo.
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 with git.ScopedPool(kind=POOL_KIND) as leaf_pool: 146 with git.ScopedPool(kind=POOL_KIND) as leaf_pool:
147 for item in leaf_pool.imap(leaf_map_fn, prefixes_trees): 147 for item in leaf_pool.imap(leaf_map_fn, prefixes_trees):
148 updater.stdin.write(item) 148 updater.stdin.write(item)
149 inc() 149 inc()
150 150
151 updater.stdin.close() 151 updater.stdin.close()
152 updater.wait() 152 updater.wait()
153 assert updater.returncode == 0 153 assert updater.returncode == 0
154 154
155 tree_id = git.run('write-tree', env=env) 155 tree_id = git.run('write-tree', env=env)
156 commit_cmd = ['commit-tree', '-m', msg, '-p'] + git.hashes(REF) 156 commit_cmd = ['commit-tree', '-m', msg, '-p'] + git.hash_multi(REF)
157 for t in targets: 157 for t in targets:
158 commit_cmd.extend(['-p', binascii.hexlify(t)]) 158 commit_cmd.extend(['-p', binascii.hexlify(t)])
159 commit_cmd.append(tree_id) 159 commit_cmd.append(tree_id)
160 commit_hash = git.run(*commit_cmd) 160 commit_hash = git.run(*commit_cmd)
161 git.run('update-ref', REF, commit_hash) 161 git.run('update-ref', REF, commit_hash)
162 DIRTY_TREES.clear() 162 DIRTY_TREES.clear()
163 163
164 164
165 def preload_tree(prefix): 165 def preload_tree(prefix):
166 """Returns the prefix and parsed tree object for the specified prefix.""" 166 """Returns the prefix and parsed tree object for the specified prefix."""
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 finalize(targets) 258 finalize(targets)
259 259
260 print '\n'.join(map(str, map(get_num, targets))) 260 print '\n'.join(map(str, map(get_num, targets)))
261 return 0 261 return 0
262 except KeyboardInterrupt: 262 except KeyboardInterrupt:
263 return 1 263 return 1
264 264
265 265
266 if __name__ == '__main__': # pragma: no cover 266 if __name__ == '__main__': # pragma: no cover
267 sys.exit(main()) 267 sys.exit(main())
OLDNEW
« no previous file with comments | « git_nav_downstream.py ('k') | testing_support/git_test_utils.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698