mirror of
https://gerrit.googlesource.com/git-repo
synced 2025-07-04 20:17:16 +00:00
Compare commits
5 Commits
Author | SHA1 | Date | |
---|---|---|---|
13f323b2c2 | |||
12ee5446e9 | |||
e158e3802d | |||
3bbbcaf99d | |||
d4b13c280b |
@ -5,6 +5,6 @@
|
|||||||
<pydev_pathproperty name="org.python.pydev.PROJECT_SOURCE_PATH">
|
<pydev_pathproperty name="org.python.pydev.PROJECT_SOURCE_PATH">
|
||||||
<path>/git-repo</path>
|
<path>/git-repo</path>
|
||||||
</pydev_pathproperty>
|
</pydev_pathproperty>
|
||||||
<pydev_property name="org.python.pydev.PYTHON_PROJECT_VERSION">python 2.6</pydev_property>
|
<pydev_property name="org.python.pydev.PYTHON_PROJECT_VERSION">python 2.7</pydev_property>
|
||||||
<pydev_property name="org.python.pydev.PYTHON_PROJECT_INTERPRETER">Default</pydev_property>
|
<pydev_property name="org.python.pydev.PYTHON_PROJECT_INTERPRETER">Default</pydev_property>
|
||||||
</pydev_project>
|
</pydev_project>
|
||||||
|
@ -7,7 +7,7 @@ easier to work with Git. The repo command is an executable Python script
|
|||||||
that you can put anywhere in your path.
|
that you can put anywhere in your path.
|
||||||
|
|
||||||
* Homepage: https://gerrit.googlesource.com/git-repo/
|
* Homepage: https://gerrit.googlesource.com/git-repo/
|
||||||
* Bug reports: https://code.google.com/p/git-repo/issues/
|
* Bug reports: https://bugs.chromium.org/p/gerrit/issues/list?q=component:repo
|
||||||
* Source: https://gerrit.googlesource.com/git-repo/
|
* Source: https://gerrit.googlesource.com/git-repo/
|
||||||
* Overview: https://source.android.com/source/developing.html
|
* Overview: https://source.android.com/source/developing.html
|
||||||
* Docs: https://source.android.com/source/using-repo.html
|
* Docs: https://source.android.com/source/using-repo.html
|
||||||
|
25
event_log.py
25
event_log.py
@ -18,8 +18,6 @@ from __future__ import print_function
|
|||||||
import json
|
import json
|
||||||
import multiprocessing
|
import multiprocessing
|
||||||
|
|
||||||
from pyversion import is_python3
|
|
||||||
|
|
||||||
TASK_COMMAND = 'command'
|
TASK_COMMAND = 'command'
|
||||||
TASK_SYNC_NETWORK = 'sync-network'
|
TASK_SYNC_NETWORK = 'sync-network'
|
||||||
TASK_SYNC_LOCAL = 'sync-local'
|
TASK_SYNC_LOCAL = 'sync-local'
|
||||||
@ -53,7 +51,6 @@ class EventLog(object):
|
|||||||
def __init__(self):
|
def __init__(self):
|
||||||
"""Initializes the event log."""
|
"""Initializes the event log."""
|
||||||
self._log = []
|
self._log = []
|
||||||
self._next_id = _EventIdGenerator()
|
|
||||||
self._parent = None
|
self._parent = None
|
||||||
|
|
||||||
def Add(self, name, task_name, start, finish=None, success=None,
|
def Add(self, name, task_name, start, finish=None, success=None,
|
||||||
@ -73,7 +70,7 @@ class EventLog(object):
|
|||||||
A dictionary of the event added to the log.
|
A dictionary of the event added to the log.
|
||||||
"""
|
"""
|
||||||
event = {
|
event = {
|
||||||
'id': (kind, self._next_id.__next__() if is_python3() else self._next_id.next()),
|
'id': (kind, _NextEventId()),
|
||||||
'name': name,
|
'name': name,
|
||||||
'task_name': task_name,
|
'task_name': task_name,
|
||||||
'start_time': start,
|
'start_time': start,
|
||||||
@ -164,16 +161,16 @@ class EventLog(object):
|
|||||||
f.write('\n')
|
f.write('\n')
|
||||||
|
|
||||||
|
|
||||||
def _EventIdGenerator():
|
# An integer id that is unique across this invocation of the program.
|
||||||
"""Returns multi-process safe iterator that generates locally unique id.
|
_EVENT_ID = multiprocessing.Value('i', 1)
|
||||||
|
|
||||||
Yields:
|
def _NextEventId():
|
||||||
|
"""Helper function for grabbing the next unique id.
|
||||||
|
|
||||||
|
Returns:
|
||||||
A unique, to this invocation of the program, integer id.
|
A unique, to this invocation of the program, integer id.
|
||||||
"""
|
"""
|
||||||
eid = multiprocessing.Value('i', 1)
|
with _EVENT_ID.get_lock():
|
||||||
|
val = _EVENT_ID.value
|
||||||
while True:
|
_EVENT_ID.value += 1
|
||||||
with eid.get_lock():
|
return val
|
||||||
val = eid.value
|
|
||||||
eid.value += 1
|
|
||||||
yield val
|
|
||||||
|
17
repo
17
repo
@ -23,7 +23,7 @@ REPO_REV = 'stable'
|
|||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
# increment this whenever we make important changes to this script
|
# increment this whenever we make important changes to this script
|
||||||
VERSION = (1, 24)
|
VERSION = (1, 25)
|
||||||
|
|
||||||
# increment this if the MAINTAINER_KEYS block is modified
|
# increment this if the MAINTAINER_KEYS block is modified
|
||||||
KEYRING_VERSION = (1, 2)
|
KEYRING_VERSION = (1, 2)
|
||||||
@ -113,7 +113,7 @@ repodir = '.repo' # name of repo's private directory
|
|||||||
S_repo = 'repo' # special repo repository
|
S_repo = 'repo' # special repo repository
|
||||||
S_manifests = 'manifests' # special manifest repository
|
S_manifests = 'manifests' # special manifest repository
|
||||||
REPO_MAIN = S_repo + '/main.py' # main script
|
REPO_MAIN = S_repo + '/main.py' # main script
|
||||||
MIN_PYTHON_VERSION = (2, 6) # minimum supported python version
|
MIN_PYTHON_VERSION = (2, 7) # minimum supported python version
|
||||||
GITC_CONFIG_FILE = '/gitc/.config'
|
GITC_CONFIG_FILE = '/gitc/.config'
|
||||||
GITC_FS_ROOT_DIR = '/gitc/manifest-rw/'
|
GITC_FS_ROOT_DIR = '/gitc/manifest-rw/'
|
||||||
|
|
||||||
@ -152,9 +152,12 @@ def _print(*objects, **kwargs):
|
|||||||
# Python version check
|
# Python version check
|
||||||
ver = sys.version_info
|
ver = sys.version_info
|
||||||
if (ver[0], ver[1]) < MIN_PYTHON_VERSION:
|
if (ver[0], ver[1]) < MIN_PYTHON_VERSION:
|
||||||
_print('error: Python version %s unsupported.\n'
|
_print('error: Python version {} unsupported.\n'
|
||||||
'Please use Python 2.6 - 2.7 instead.'
|
'Please use Python {}.{} instead.'.format(
|
||||||
% sys.version.split(' ')[0], file=sys.stderr)
|
sys.version.split(' ')[0],
|
||||||
|
MIN_PYTHON_VERSION[0],
|
||||||
|
MIN_PYTHON_VERSION[1],
|
||||||
|
), file=sys.stderr)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
home_dot_repo = os.path.expanduser('~/.repoconfig')
|
home_dot_repo = os.path.expanduser('~/.repoconfig')
|
||||||
@ -180,7 +183,7 @@ group.add_option('-b', '--manifest-branch',
|
|||||||
group.add_option('-m', '--manifest-name',
|
group.add_option('-m', '--manifest-name',
|
||||||
dest='manifest_name',
|
dest='manifest_name',
|
||||||
help='initial manifest file', metavar='NAME.xml')
|
help='initial manifest file', metavar='NAME.xml')
|
||||||
group.add_option('-c', '--current-branch',
|
group.add_option('--current-branch',
|
||||||
dest='current_branch_only', action='store_true',
|
dest='current_branch_only', action='store_true',
|
||||||
help='fetch only current manifest branch from server')
|
help='fetch only current manifest branch from server')
|
||||||
group.add_option('--mirror',
|
group.add_option('--mirror',
|
||||||
@ -909,6 +912,6 @@ def main(orig_args):
|
|||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
if ver[0] == 3:
|
if ver[0] == 3:
|
||||||
_print('warning: Python 3 support is currently experimental. YMMV.\n'
|
_print('warning: Python 3 support is currently experimental. YMMV.\n'
|
||||||
'Please use Python 2.6 - 2.7 instead.',
|
'Please use Python 2.7 instead.',
|
||||||
file=sys.stderr)
|
file=sys.stderr)
|
||||||
main(sys.argv[1:])
|
main(sys.argv[1:])
|
||||||
|
@ -95,7 +95,7 @@ to update the working directory files.
|
|||||||
g.add_option('-b', '--manifest-branch',
|
g.add_option('-b', '--manifest-branch',
|
||||||
dest='manifest_branch',
|
dest='manifest_branch',
|
||||||
help='manifest branch or revision', metavar='REVISION')
|
help='manifest branch or revision', metavar='REVISION')
|
||||||
g.add_option('-c', '--current-branch',
|
g.add_option('--current-branch',
|
||||||
dest='current_branch_only', action='store_true',
|
dest='current_branch_only', action='store_true',
|
||||||
help='fetch only current manifest branch from server')
|
help='fetch only current manifest branch from server')
|
||||||
g.add_option('-m', '--manifest-name',
|
g.add_option('-m', '--manifest-name',
|
||||||
|
Reference in New Issue
Block a user