OLD | NEW |
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 atexit | 5 import atexit |
6 import collections | 6 import collections |
7 import datetime | 7 import datetime |
8 import os | 8 import os |
9 import shutil | 9 import shutil |
10 import subprocess | 10 import subprocess |
(...skipping 22 matching lines...) Expand all Loading... |
33 * AUTHOR_NAME | 33 * AUTHOR_NAME |
34 * AUTHOR_EMAIL | 34 * AUTHOR_EMAIL |
35 * AUTHOR_DATE - must be a datetime.datetime instance | 35 * AUTHOR_DATE - must be a datetime.datetime instance |
36 * COMMITTER_NAME | 36 * COMMITTER_NAME |
37 * COMMITTER_EMAIL | 37 * COMMITTER_EMAIL |
38 * COMMITTER_DATE - must be a datetime.datetime instance | 38 * COMMITTER_DATE - must be a datetime.datetime instance |
39 | 39 |
40 For file content, if 'data' is None, then this commit will `git rm` that file. | 40 For file content, if 'data' is None, then this commit will `git rm` that file. |
41 """ | 41 """ |
42 BASE_TEMP_DIR = tempfile.mkdtemp(suffix='base', prefix='git_repo') | 42 BASE_TEMP_DIR = tempfile.mkdtemp(suffix='base', prefix='git_repo') |
43 atexit.register(shutil.rmtree, BASE_TEMP_DIR) | |
44 | 43 |
45 # Singleton objects to specify specific data in a commit dictionary. | 44 # Singleton objects to specify specific data in a commit dictionary. |
46 AUTHOR_NAME = object() | 45 AUTHOR_NAME = object() |
47 AUTHOR_EMAIL = object() | 46 AUTHOR_EMAIL = object() |
48 AUTHOR_DATE = object() | 47 AUTHOR_DATE = object() |
49 COMMITTER_NAME = object() | 48 COMMITTER_NAME = object() |
50 COMMITTER_EMAIL = object() | 49 COMMITTER_EMAIL = object() |
51 COMMITTER_DATE = object() | 50 COMMITTER_DATE = object() |
52 | 51 |
53 DEFAULT_AUTHOR_NAME = 'Author McAuthorly' | 52 DEFAULT_AUTHOR_NAME = 'Author McAuthorly' |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
230 else: | 229 else: |
231 assert current is not None | 230 assert current is not None |
232 hash_to_msg[current] = line | 231 hash_to_msg[current] = line |
233 ret.add_partial(line) | 232 ret.add_partial(line) |
234 for parent in parents: | 233 for parent in parents: |
235 ret.add_partial(line, hash_to_msg[parent]) | 234 ret.add_partial(line, hash_to_msg[parent]) |
236 current = None | 235 current = None |
237 parents = [] | 236 parents = [] |
238 assert current is None | 237 assert current is None |
239 return ret | 238 return ret |
OLD | NEW |