Commit 58ca062a by Matthias Putz

Update: google git-repo v1.12.33

parent f2235e73
...@@ -4,7 +4,9 @@ Short Version: ...@@ -4,7 +4,9 @@ Short Version:
- Provide a meaningful commit message. - Provide a meaningful commit message.
- Check for coding errors with pylint - Check for coding errors with pylint
- Make sure all code is under the Apache License, 2.0. - Make sure all code is under the Apache License, 2.0.
- Publish your changes for review: - Publish your changes for review.
- Make corrections if requested.
- Verify your changes on gerrit so they can be submitted.
git push https://gerrit-review.googlesource.com/git-repo HEAD:refs/for/master git push https://gerrit-review.googlesource.com/git-repo HEAD:refs/for/master
...@@ -75,6 +77,17 @@ Ensure you have obtained an HTTP password to authenticate: ...@@ -75,6 +77,17 @@ Ensure you have obtained an HTTP password to authenticate:
https://gerrit-review.googlesource.com/new-password https://gerrit-review.googlesource.com/new-password
Ensure that you have the local commit hook installed to automatically
add a ChangeId to your commits:
curl -Lo `git rev-parse --git-dir`/hooks/commit-msg https://gerrit-review.googlesource.com/tools/hooks/commit-msg
chmod +x `git rev-parse --git-dir`/hooks/commit-msg
If you have already committed your changes you will need to amend the commit
to get the ChangeId added.
git commit --amend
Push your patches over HTTPS to the review server, possibly through Push your patches over HTTPS to the review server, possibly through
a remembered remote to make this easier in the future: a remembered remote to make this easier in the future:
...@@ -85,3 +98,18 @@ a remembered remote to make this easier in the future: ...@@ -85,3 +98,18 @@ a remembered remote to make this easier in the future:
You will be automatically emailed a copy of your commits, and any You will be automatically emailed a copy of your commits, and any
comments made by the project maintainers. comments made by the project maintainers.
(5) Make changes if requested
The project maintainer who reviews your changes might request changes to your
commit. If you make the requested changes you will need to amend your commit
and push it to the review server again.
(6) Verify your changes on gerrit
After you receive a Code-Review+2 from the maintainer, select the Verified
button on the gerrit page for the change. This verifies that you have tested
your changes and notifies the maintainer that they are ready to be submitted.
The maintainer will then submit your changes to the repository.
...@@ -47,12 +47,12 @@ following DTD: ...@@ -47,12 +47,12 @@ following DTD:
<!ATTLIST default sync-s CDATA #IMPLIED> <!ATTLIST default sync-s CDATA #IMPLIED>
<!ELEMENT manifest-server (EMPTY)> <!ELEMENT manifest-server (EMPTY)>
<!ATTLIST url CDATA #REQUIRED> <!ATTLIST manifest-server url CDATA #REQUIRED>
<!ELEMENT project (annotation*, <!ELEMENT project (annotation*,
project*, project*,
copyfile?, copyfile*,
linkfile?)> linkfile*)>
<!ATTLIST project name CDATA #REQUIRED> <!ATTLIST project name CDATA #REQUIRED>
<!ATTLIST project path CDATA #IMPLIED> <!ATTLIST project path CDATA #IMPLIED>
<!ATTLIST project remote IDREF #IMPLIED> <!ATTLIST project remote IDREF #IMPLIED>
...@@ -71,14 +71,14 @@ following DTD: ...@@ -71,14 +71,14 @@ following DTD:
<!ATTLIST annotation keep CDATA "true"> <!ATTLIST annotation keep CDATA "true">
<!ELEMENT copyfile (EMPTY)> <!ELEMENT copyfile (EMPTY)>
<!ATTLIST src value CDATA #REQUIRED> <!ATTLIST copyfile src CDATA #REQUIRED>
<!ATTLIST dest value CDATA #REQUIRED> <!ATTLIST copyfile dest CDATA #REQUIRED>
<!ELEMENT linkfile (EMPTY)> <!ELEMENT linkfile (EMPTY)>
<!ATTLIST src value CDATA #REQUIRED> <!ATTLIST linkfile src CDATA #REQUIRED>
<!ATTLIST dest value CDATA #REQUIRED> <!ATTLIST linkfile dest CDATA #REQUIRED>
<!ELEMENT extend-project> <!ELEMENT extend-project (EMPTY)>
<!ATTLIST extend-project name CDATA #REQUIRED> <!ATTLIST extend-project name CDATA #REQUIRED>
<!ATTLIST extend-project path CDATA #IMPLIED> <!ATTLIST extend-project path CDATA #IMPLIED>
<!ATTLIST extend-project groups CDATA #IMPLIED> <!ATTLIST extend-project groups CDATA #IMPLIED>
......
...@@ -169,6 +169,9 @@ class GitCommand(object): ...@@ -169,6 +169,9 @@ class GitCommand(object):
if p is not None: if p is not None:
s = p + ' ' + s s = p + ' ' + s
_setenv(env, 'GIT_CONFIG_PARAMETERS', s) _setenv(env, 'GIT_CONFIG_PARAMETERS', s)
if 'GIT_ALLOW_PROTOCOL' not in env:
_setenv(env, 'GIT_ALLOW_PROTOCOL',
'file:git:http:https:ssh:persistent-http:persistent-https:sso:rpc')
if project: if project:
if not cwd: if not cwd:
......
...@@ -253,7 +253,7 @@ class _LinkFile(object): ...@@ -253,7 +253,7 @@ class _LinkFile(object):
if not portable.os_path_islink(absDest) or (portable.os_path_realpath(absDest) != relSrc): if not portable.os_path_islink(absDest) or (portable.os_path_realpath(absDest) != relSrc):
try: try:
# remove existing file first, since it might be read-only # remove existing file first, since it might be read-only
if os.path.exists(absDest): if os.path.lexists(absDest):
os.remove(absDest) os.remove(absDest)
else: else:
dest_dir = os.path.dirname(absDest) dest_dir = os.path.dirname(absDest)
...@@ -1115,7 +1115,8 @@ class Project(object): ...@@ -1115,7 +1115,8 @@ class Project(object):
clone_bundle=True, clone_bundle=True,
no_tags=False, no_tags=False,
archive=False, archive=False,
optimized_fetch=False): optimized_fetch=False,
prune=False):
"""Perform only the network IO portion of the sync process. """Perform only the network IO portion of the sync process.
Local working directory/branch state is not affected. Local working directory/branch state is not affected.
""" """
...@@ -1186,7 +1187,7 @@ class Project(object): ...@@ -1186,7 +1187,7 @@ class Project(object):
if (need_to_fetch if (need_to_fetch
and not self._RemoteFetch(initial=is_new, quiet=quiet, alt_dir=alt_dir, and not self._RemoteFetch(initial=is_new, quiet=quiet, alt_dir=alt_dir,
current_branch_only=current_branch_only, current_branch_only=current_branch_only,
no_tags=no_tags)): no_tags=no_tags, prune=prune)):
return False return False
if self.worktree: if self.worktree:
...@@ -1587,8 +1588,6 @@ class Project(object): ...@@ -1587,8 +1588,6 @@ class Project(object):
if kill: if kill:
old = self.bare_git.GetHead() old = self.bare_git.GetHead()
if old is None:
old = 'refs/heads/please_never_use_this_as_a_branch_name'
try: try:
self.bare_git.DetachHead(rev) self.bare_git.DetachHead(rev)
...@@ -1600,6 +1599,9 @@ class Project(object): ...@@ -1600,6 +1599,9 @@ class Project(object):
capture_stderr=True) capture_stderr=True)
b.Wait() b.Wait()
finally: finally:
if ID_RE.match(old):
self.bare_git.DetachHead(old)
else:
self.bare_git.SetHead(old) self.bare_git.SetHead(old)
left = self._allrefs left = self._allrefs
...@@ -1800,7 +1802,8 @@ class Project(object): ...@@ -1800,7 +1802,8 @@ class Project(object):
initial=False, initial=False,
quiet=False, quiet=False,
alt_dir=None, alt_dir=None,
no_tags=False): no_tags=False,
prune=False):
is_sha1 = False is_sha1 = False
tag_name = None tag_name = None
...@@ -1913,6 +1916,9 @@ class Project(object): ...@@ -1913,6 +1916,9 @@ class Project(object):
else: else:
cmd.append('--tags') cmd.append('--tags')
if prune:
cmd.append('--prune')
spec = [] spec = []
if not current_branch_only: if not current_branch_only:
# Fetch whole repo # Fetch whole repo
......
#!/usr/bin/env python #!/usr/bin/env python
## repo default configuration # repo default configuration
## #
# REPO_URL = 'https://gerrit.googlesource.com/git-repo' import os
REPO_URL = 'https://github.com/esrlabs/git-repo' REPO_URL = os.environ.get('REPO_URL', None)
if not REPO_URL:
# REPO_URL = 'https://gerrit.googlesource.com/git-repo'
REPO_URL = 'https://github.com/esrlabs/git-repo'
REPO_REV = 'stable' REPO_REV = 'stable'
# Copyright (C) 2008 Google Inc. # Copyright (C) 2008 Google Inc.
...@@ -127,7 +130,6 @@ GITC_FS_ROOT_DIR = '/gitc/manifest-rw/' ...@@ -127,7 +130,6 @@ GITC_FS_ROOT_DIR = '/gitc/manifest-rw/'
import errno import errno
import optparse import optparse
import os
import re import re
import shutil import shutil
import stat import stat
...@@ -227,9 +229,10 @@ group.add_option('--config-name', ...@@ -227,9 +229,10 @@ group.add_option('--config-name',
dest='config_name', action="store_true", default=False, dest='config_name', action="store_true", default=False,
help='Always prompt for name/e-mail') help='Always prompt for name/e-mail')
def _GitcInitOptions(init_optparse):
init_optparse.set_usage("repo gitc-init -u url -c client [options]") def _GitcInitOptions(init_optparse_arg):
g = init_optparse.add_option_group('GITC options') init_optparse_arg.set_usage("repo gitc-init -u url -c client [options]")
g = init_optparse_arg.add_option_group('GITC options')
g.add_option('-f', '--manifest-file', g.add_option('-f', '--manifest-file',
dest='manifest_file', dest='manifest_file',
help='Optional manifest file to use for this GITC client.') help='Optional manifest file to use for this GITC client.')
...@@ -238,6 +241,8 @@ def _GitcInitOptions(init_optparse): ...@@ -238,6 +241,8 @@ def _GitcInitOptions(init_optparse):
help='The name of the gitc_client instance to create or modify.') help='The name of the gitc_client instance to create or modify.')
_gitc_manifest_dir = None _gitc_manifest_dir = None
def get_gitc_manifest_dir(): def get_gitc_manifest_dir():
global _gitc_manifest_dir global _gitc_manifest_dir
if _gitc_manifest_dir is None: if _gitc_manifest_dir is None:
...@@ -252,6 +257,7 @@ def get_gitc_manifest_dir(): ...@@ -252,6 +257,7 @@ def get_gitc_manifest_dir():
pass pass
return _gitc_manifest_dir return _gitc_manifest_dir
def gitc_parse_clientdir(gitc_fs_path): def gitc_parse_clientdir(gitc_fs_path):
"""Parse a path in the GITC FS and return its client name. """Parse a path in the GITC FS and return its client name.
...@@ -274,7 +280,9 @@ def gitc_parse_clientdir(gitc_fs_path): ...@@ -274,7 +280,9 @@ def gitc_parse_clientdir(gitc_fs_path):
return gitc_fs_path.split(manifest_dir)[1].split('/')[0] return gitc_fs_path.split(manifest_dir)[1].split('/')[0]
return gitc_fs_path.split(GITC_FS_ROOT_DIR)[1].split('/')[0] return gitc_fs_path.split(GITC_FS_ROOT_DIR)[1].split('/')[0]
class CloneFailure(Exception): class CloneFailure(Exception):
"""Indicate the remote clone of repo itself failed. """Indicate the remote clone of repo itself failed.
""" """
...@@ -442,8 +450,8 @@ def SetupGnuPG(quiet): ...@@ -442,8 +450,8 @@ def SetupGnuPG(quiet):
cmd = ['gpg', '--import'] cmd = ['gpg', '--import']
try: try:
proc = subprocess.Popen(cmd, proc = subprocess.Popen(cmd,
env = env, env=env,
stdin = subprocess.PIPE) stdin=subprocess.PIPE)
except OSError as e: except OSError as e:
if not quiet: if not quiet:
_print('warning: gpg (GnuPG) is not available.', file=sys.stderr) _print('warning: gpg (GnuPG) is not available.', file=sys.stderr)
...@@ -469,7 +477,7 @@ def _SetConfig(local, name, value): ...@@ -469,7 +477,7 @@ def _SetConfig(local, name, value):
"""Set a git configuration option to the specified value. """Set a git configuration option to the specified value.
""" """
cmd = [GIT, 'config', name, value] cmd = [GIT, 'config', name, value]
if subprocess.Popen(cmd, cwd = local).wait() != 0: if subprocess.Popen(cmd, cwd=local).wait() != 0:
raise CloneFailure() raise CloneFailure()
...@@ -484,7 +492,7 @@ def _InitHttp(): ...@@ -484,7 +492,7 @@ def _InitHttp():
p = n.hosts[host] p = n.hosts[host]
mgr.add_password(p[1], 'http://%s/' % host, p[0], p[2]) mgr.add_password(p[1], 'http://%s/' % host, p[0], p[2])
mgr.add_password(p[1], 'https://%s/' % host, p[0], p[2]) mgr.add_password(p[1], 'https://%s/' % host, p[0], p[2])
except: except: # pylint: disable=bare-except
pass pass
handlers.append(urllib.request.HTTPBasicAuthHandler(mgr)) handlers.append(urllib.request.HTTPBasicAuthHandler(mgr))
handlers.append(urllib.request.HTTPDigestAuthHandler(mgr)) handlers.append(urllib.request.HTTPDigestAuthHandler(mgr))
...@@ -497,6 +505,7 @@ def _InitHttp(): ...@@ -497,6 +505,7 @@ def _InitHttp():
handlers.append(urllib.request.HTTPSHandler(debuglevel=1)) handlers.append(urllib.request.HTTPSHandler(debuglevel=1))
urllib.request.install_opener(urllib.request.build_opener(*handlers)) urllib.request.install_opener(urllib.request.build_opener(*handlers))
def _Fetch(url, local, src, quiet): def _Fetch(url, local, src, quiet):
if not quiet: if not quiet:
_print('Get %s' % url, file=sys.stderr) _print('Get %s' % url, file=sys.stderr)
...@@ -511,13 +520,14 @@ def _Fetch(url, local, src, quiet): ...@@ -511,13 +520,14 @@ def _Fetch(url, local, src, quiet):
cmd.append('+refs/heads/*:refs/remotes/origin/*') cmd.append('+refs/heads/*:refs/remotes/origin/*')
cmd.append('refs/tags/*:refs/tags/*') cmd.append('refs/tags/*:refs/tags/*')
proc = subprocess.Popen(cmd, cwd = local, stderr = err) proc = subprocess.Popen(cmd, cwd=local, stderr=err)
if err: if err:
proc.stderr.read() proc.stderr.read()
proc.stderr.close() proc.stderr.close()
if proc.wait() != 0: if proc.wait() != 0:
raise CloneFailure() raise CloneFailure()
def _DownloadBundle(url, local, quiet): def _DownloadBundle(url, local, quiet):
if not url.endswith('/'): if not url.endswith('/'):
url += '/' url += '/'
...@@ -525,8 +535,8 @@ def _DownloadBundle(url, local, quiet): ...@@ -525,8 +535,8 @@ def _DownloadBundle(url, local, quiet):
proc = subprocess.Popen( proc = subprocess.Popen(
[GIT, 'config', '--get-regexp', 'url.*.insteadof'], [GIT, 'config', '--get-regexp', 'url.*.insteadof'],
cwd = local, cwd=local,
stdout = subprocess.PIPE) stdout=subprocess.PIPE)
for line in proc.stdout: for line in proc.stdout:
m = re.compile(r'^url\.(.*)\.insteadof (.*)$').match(line) m = re.compile(r'^url\.(.*)\.insteadof (.*)$').match(line)
if m: if m:
...@@ -569,6 +579,7 @@ def _DownloadBundle(url, local, quiet): ...@@ -569,6 +579,7 @@ def _DownloadBundle(url, local, quiet):
finally: finally:
dest.close() dest.close()
def _ImportBundle(local): def _ImportBundle(local):
path = os.path.join(local, '.git', 'clone.bundle') path = os.path.join(local, '.git', 'clone.bundle')
try: try:
...@@ -576,6 +587,7 @@ def _ImportBundle(local): ...@@ -576,6 +587,7 @@ def _ImportBundle(local):
finally: finally:
os.remove(path) os.remove(path)
def _Clone(url, local, quiet): def _Clone(url, local, quiet):
"""Clones a git repository to a new subdirectory of repodir """Clones a git repository to a new subdirectory of repodir
""" """
...@@ -588,7 +600,7 @@ def _Clone(url, local, quiet): ...@@ -588,7 +600,7 @@ def _Clone(url, local, quiet):
cmd = [GIT, 'init', '--quiet'] cmd = [GIT, 'init', '--quiet']
try: try:
proc = subprocess.Popen(cmd, cwd = local) proc = subprocess.Popen(cmd, cwd=local)
except OSError as e: except OSError as e:
_print(file=sys.stderr) _print(file=sys.stderr)
_print("fatal: '%s' is not available" % GIT, file=sys.stderr) _print("fatal: '%s' is not available" % GIT, file=sys.stderr)
...@@ -603,7 +615,8 @@ def _Clone(url, local, quiet): ...@@ -603,7 +615,8 @@ def _Clone(url, local, quiet):
_InitHttp() _InitHttp()
_SetConfig(local, 'remote.origin.url', url) _SetConfig(local, 'remote.origin.url', url)
_SetConfig(local, 'remote.origin.fetch', _SetConfig(local,
'remote.origin.fetch',
'+refs/heads/*:refs/remotes/origin/*') '+refs/heads/*:refs/remotes/origin/*')
if _DownloadBundle(url, local, quiet): if _DownloadBundle(url, local, quiet):
_ImportBundle(local) _ImportBundle(local)
...@@ -617,7 +630,7 @@ def _Verify(cwd, branch, quiet): ...@@ -617,7 +630,7 @@ def _Verify(cwd, branch, quiet):
proc = subprocess.Popen(cmd, proc = subprocess.Popen(cmd,
stdout=subprocess.PIPE, stdout=subprocess.PIPE,
stderr=subprocess.PIPE, stderr=subprocess.PIPE,
cwd = cwd) cwd=cwd)
cur = proc.stdout.read().strip() cur = proc.stdout.read().strip()
proc.stdout.close() proc.stdout.close()
...@@ -643,10 +656,10 @@ def _Verify(cwd, branch, quiet): ...@@ -643,10 +656,10 @@ def _Verify(cwd, branch, quiet):
cmd = [GIT, 'tag', '-v', cur] cmd = [GIT, 'tag', '-v', cur]
proc = subprocess.Popen(cmd, proc = subprocess.Popen(cmd,
stdout = subprocess.PIPE, stdout=subprocess.PIPE,
stderr = subprocess.PIPE, stderr=subprocess.PIPE,
cwd = cwd, cwd=cwd,
env = env) env=env)
out = proc.stdout.read() out = proc.stdout.read()
proc.stdout.close() proc.stdout.close()
...@@ -666,21 +679,21 @@ def _Checkout(cwd, branch, rev, quiet): ...@@ -666,21 +679,21 @@ def _Checkout(cwd, branch, rev, quiet):
"""Checkout an upstream branch into the repository and track it. """Checkout an upstream branch into the repository and track it.
""" """
cmd = [GIT, 'update-ref', 'refs/heads/default', rev] cmd = [GIT, 'update-ref', 'refs/heads/default', rev]
if subprocess.Popen(cmd, cwd = cwd).wait() != 0: if subprocess.Popen(cmd, cwd=cwd).wait() != 0:
raise CloneFailure() raise CloneFailure()
_SetConfig(cwd, 'branch.default.remote', 'origin') _SetConfig(cwd, 'branch.default.remote', 'origin')
_SetConfig(cwd, 'branch.default.merge', 'refs/heads/%s' % branch) _SetConfig(cwd, 'branch.default.merge', 'refs/heads/%s' % branch)
cmd = [GIT, 'symbolic-ref', 'HEAD', 'refs/heads/default'] cmd = [GIT, 'symbolic-ref', 'HEAD', 'refs/heads/default']
if subprocess.Popen(cmd, cwd = cwd).wait() != 0: if subprocess.Popen(cmd, cwd=cwd).wait() != 0:
raise CloneFailure() raise CloneFailure()
cmd = [GIT, 'read-tree', '--reset', '-u'] cmd = [GIT, 'read-tree', '--reset', '-u']
if not quiet: if not quiet:
cmd.append('-v') cmd.append('-v')
cmd.append('HEAD') cmd.append('HEAD')
if subprocess.Popen(cmd, cwd = cwd).wait() != 0: if subprocess.Popen(cmd, cwd=cwd).wait() != 0:
raise CloneFailure() raise CloneFailure()
...@@ -702,7 +715,7 @@ def _FindRepo(): ...@@ -702,7 +715,7 @@ def _FindRepo():
return (repo, os.path.join(curdir, repodir)) return (repo, os.path.join(curdir, repodir))
class _Options: class _Options(object):
help = False help = False
...@@ -729,7 +742,7 @@ def _Usage(): ...@@ -729,7 +742,7 @@ def _Usage():
gitc_usage = " gitc-init Initialize a GITC Client.\n" gitc_usage = " gitc-init Initialize a GITC Client.\n"
_print( _print(
"""usage: repo COMMAND [ARGS] """usage: repo COMMAND [ARGS]
repo is not yet installed. Use "repo init" to install it here. repo is not yet installed. Use "repo init" to install it here.
...@@ -737,7 +750,7 @@ The most commonly used repo commands are: ...@@ -737,7 +750,7 @@ The most commonly used repo commands are:
init Install repo in the current working directory init Install repo in the current working directory
""" + gitc_usage + """ + gitc_usage +
""" help Display detailed help on a command """ help Display detailed help on a command
For access to the full online help, install repo ("repo init"). For access to the full online help, install repo ("repo init").
""", file=sys.stderr) """, file=sys.stderr)
...@@ -798,8 +811,8 @@ def _SetDefaultsTo(gitdir): ...@@ -798,8 +811,8 @@ def _SetDefaultsTo(gitdir):
'--git-dir=%s' % gitdir, '--git-dir=%s' % gitdir,
'symbolic-ref', 'symbolic-ref',
'HEAD'], 'HEAD'],
stdout = subprocess.PIPE, stdout=subprocess.PIPE,
stderr = subprocess.PIPE) stderr=subprocess.PIPE)
REPO_REV = proc.stdout.read().strip() REPO_REV = proc.stdout.read().strip()
proc.stdout.close() proc.stdout.close()
...@@ -826,7 +839,8 @@ def main(orig_args): ...@@ -826,7 +839,8 @@ def main(orig_args):
if get_gitc_manifest_dir() and cwd.startswith(get_gitc_manifest_dir()): if get_gitc_manifest_dir() and cwd.startswith(get_gitc_manifest_dir()):
_print('error: repo cannot be used in the GITC local manifest directory.' _print('error: repo cannot be used in the GITC local manifest directory.'
'\nIf you want to work on this GITC client please rerun this ' '\nIf you want to work on this GITC client please rerun this '
'command from the corresponding client under /gitc/', file=sys.stderr) 'command from the corresponding client under /gitc/',
file=sys.stderr)
sys.exit(1) sys.exit(1)
if not repo_main: if not repo_main:
if opt.help: if opt.help:
......
...@@ -241,7 +241,8 @@ without iterating through the remaining projects. ...@@ -241,7 +241,8 @@ without iterating through the remaining projects.
rc = rc or errno.EINTR rc = rc or errno.EINTR
except Exception as e: except Exception as e:
# Catch any other exceptions raised # Catch any other exceptions raised
print('Got an error, terminating the pool: %r' % e, print('Got an error, terminating the pool: %s: %s' %
(type(e).__name__, e),
file=sys.stderr) file=sys.stderr)
pool.terminate() pool.terminate()
rc = rc or getattr(e, 'errno', 1) rc = rc or getattr(e, 'errno', 1)
...@@ -255,7 +256,8 @@ without iterating through the remaining projects. ...@@ -255,7 +256,8 @@ without iterating through the remaining projects.
try: try:
project = self._SerializeProject(p) project = self._SerializeProject(p)
except Exception as e: except Exception as e:
print('Project list error: %r' % e, print('Project list error on project %s: %s: %s' %
(p.name, type(e).__name__, e),
file=sys.stderr) file=sys.stderr)
return return
except KeyboardInterrupt: except KeyboardInterrupt:
......
...@@ -179,7 +179,7 @@ to update the working directory files. ...@@ -179,7 +179,7 @@ to update the working directory files.
r.Save() r.Save()
groups = re.split(r'[,\s]+', opt.groups) groups = re.split(r'[,\s]+', opt.groups)
all_platforms = ['linux', 'darwin'] all_platforms = ['linux', 'darwin', 'windows']
platformize = lambda x: 'platform-' + x platformize = lambda x: 'platform-' + x
if opt.platform == 'auto': if opt.platform == 'auto':
if (not opt.mirror and if (not opt.mirror and
...@@ -188,7 +188,7 @@ to update the working directory files. ...@@ -188,7 +188,7 @@ to update the working directory files.
elif opt.platform == 'all': elif opt.platform == 'all':
groups.extend(map(platformize, all_platforms)) groups.extend(map(platformize, all_platforms))
elif opt.platform in all_platforms: elif opt.platform in all_platforms:
groups.extend(platformize(opt.platform)) groups.append(platformize(opt.platform))
elif opt.platform != 'none': elif opt.platform != 'none':
print('fatal: invalid platform flag', file=sys.stderr) print('fatal: invalid platform flag', file=sys.stderr)
sys.exit(1) sys.exit(1)
......
...@@ -54,6 +54,11 @@ branch but need to incorporate new upstream changes "underneath" them. ...@@ -54,6 +54,11 @@ branch but need to incorporate new upstream changes "underneath" them.
p.add_option('--auto-stash', p.add_option('--auto-stash',
dest='auto_stash', action='store_true', dest='auto_stash', action='store_true',
help='Stash local modifications before starting') help='Stash local modifications before starting')
p.add_option('-m', '--onto-manifest',
dest='onto_manifest', action='store_true',
help='Rebase onto the manifest version instead of upstream '
'HEAD. This helps to make sure the local tree stays '
'consistent if you previously synced to a manifest.')
def Execute(self, opt, args): def Execute(self, opt, args):
all_projects = self.GetProjects(args) all_projects = self.GetProjects(args)
...@@ -106,6 +111,10 @@ branch but need to incorporate new upstream changes "underneath" them. ...@@ -106,6 +111,10 @@ branch but need to incorporate new upstream changes "underneath" them.
if opt.interactive: if opt.interactive:
args.append("-i") args.append("-i")
if opt.onto_manifest:
args.append('--onto')
args.append(project.revisionExpr)
args.append(upbranch.LocalMerge) args.append(upbranch.LocalMerge)
print('# %s: rebasing %s -> %s' print('# %s: rebasing %s -> %s'
......
...@@ -57,10 +57,15 @@ revision specified in the manifest. ...@@ -57,10 +57,15 @@ revision specified in the manifest.
print("error: at least one project must be specified", file=sys.stderr) print("error: at least one project must be specified", file=sys.stderr)
sys.exit(1) sys.exit(1)
all_projects = self.GetProjects(projects,
missing_ok=bool(self.gitc_manifest))
# This must happen after we find all_projects, since GetProjects may need
# the local directory, which will disappear once we save the GITC manifest.
if self.gitc_manifest: if self.gitc_manifest:
all_projects = self.GetProjects(projects, manifest=self.gitc_manifest, gitc_projects = self.GetProjects(projects, manifest=self.gitc_manifest,
missing_ok=True) missing_ok=True)
for project in all_projects: for project in gitc_projects:
if project.old_revision: if project.old_revision:
project.already_synced = True project.already_synced = True
else: else:
...@@ -70,8 +75,10 @@ revision specified in the manifest. ...@@ -70,8 +75,10 @@ revision specified in the manifest.
# Save the GITC manifest. # Save the GITC manifest.
gitc_utils.save_manifest(self.gitc_manifest) gitc_utils.save_manifest(self.gitc_manifest)
all_projects = self.GetProjects(projects, # Make sure we have a valid CWD
missing_ok=bool(self.gitc_manifest)) if not os.path.exists(os.getcwd()):
os.chdir(self.manifest.topdir)
pm = Progress('Starting %s' % nb, len(all_projects)) pm = Progress('Starting %s' % nb, len(all_projects))
for project in all_projects: for project in all_projects:
pm.update() pm.update()
......
...@@ -153,6 +153,9 @@ The --optimized-fetch option can be used to only fetch projects that ...@@ -153,6 +153,9 @@ The --optimized-fetch option can be used to only fetch projects that
are fixed to a sha1 revision if the sha1 revision does not already are fixed to a sha1 revision if the sha1 revision does not already
exist locally. exist locally.
The --prune option can be used to remove any refs that no longer
exist on the remote.
SSH Connections SSH Connections
--------------- ---------------
...@@ -236,6 +239,8 @@ later is required to fix a server side protocol bug. ...@@ -236,6 +239,8 @@ later is required to fix a server side protocol bug.
p.add_option('--optimized-fetch', p.add_option('--optimized-fetch',
dest='optimized_fetch', action='store_true', dest='optimized_fetch', action='store_true',
help='only fetch projects fixed to sha1 if revision does not exist locally') help='only fetch projects fixed to sha1 if revision does not exist locally')
p.add_option('--prune', dest='prune', action='store_true',
help='delete refs that no longer exist on the remote')
if show_smart: if show_smart:
p.add_option('-s', '--smart-sync', p.add_option('-s', '--smart-sync',
dest='smart_sync', action='store_true', dest='smart_sync', action='store_true',
...@@ -307,7 +312,8 @@ later is required to fix a server side protocol bug. ...@@ -307,7 +312,8 @@ later is required to fix a server side protocol bug.
force_sync=opt.force_sync, force_sync=opt.force_sync,
clone_bundle=not opt.no_clone_bundle, clone_bundle=not opt.no_clone_bundle,
no_tags=opt.no_tags, archive=self.manifest.IsArchive, no_tags=opt.no_tags, archive=self.manifest.IsArchive,
optimized_fetch=opt.optimized_fetch) optimized_fetch=opt.optimized_fetch,
prune=opt.prune)
self._fetch_times.Set(project, time.time() - start) self._fetch_times.Set(project, time.time() - start)
# Lock around all the rest of the code, since printing, updating a set # Lock around all the rest of the code, since printing, updating a set
...@@ -316,6 +322,7 @@ later is required to fix a server side protocol bug. ...@@ -316,6 +322,7 @@ later is required to fix a server side protocol bug.
did_lock = True did_lock = True
if not success: if not success:
err_event.set()
print('error: Cannot fetch %s' % project.name, file=sys.stderr) print('error: Cannot fetch %s' % project.name, file=sys.stderr)
if opt.force_broken: if opt.force_broken:
print('warn: --force-broken, continuing to sync', print('warn: --force-broken, continuing to sync',
...@@ -326,7 +333,7 @@ later is required to fix a server side protocol bug. ...@@ -326,7 +333,7 @@ later is required to fix a server side protocol bug.
fetched.add(project.gitdir) fetched.add(project.gitdir)
pm.update() pm.update()
except _FetchError: except _FetchError:
err_event.set() pass
except Exception as e: except Exception as e:
print('error: Cannot fetch %s (%s: %s)' \ print('error: Cannot fetch %s (%s: %s)' \
% (project.name, type(e).__name__, str(e)), file=sys.stderr) % (project.name, type(e).__name__, str(e)), file=sys.stderr)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment