Commit 58ca062a by Matthias Putz

Update: google git-repo v1.12.33

parent f2235e73
......@@ -4,7 +4,9 @@ Short Version:
- Provide a meaningful commit message.
- Check for coding errors with pylint
- 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
......@@ -75,6 +77,17 @@ Ensure you have obtained an HTTP password to authenticate:
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
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
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:
<!ATTLIST default sync-s CDATA #IMPLIED>
<!ELEMENT manifest-server (EMPTY)>
<!ATTLIST url CDATA #REQUIRED>
<!ATTLIST manifest-server url CDATA #REQUIRED>
<!ELEMENT project (annotation*,
project*,
copyfile?,
linkfile?)>
copyfile*,
linkfile*)>
<!ATTLIST project name CDATA #REQUIRED>
<!ATTLIST project path CDATA #IMPLIED>
<!ATTLIST project remote IDREF #IMPLIED>
......@@ -71,14 +71,14 @@ following DTD:
<!ATTLIST annotation keep CDATA "true">
<!ELEMENT copyfile (EMPTY)>
<!ATTLIST src value CDATA #REQUIRED>
<!ATTLIST dest value CDATA #REQUIRED>
<!ATTLIST copyfile src CDATA #REQUIRED>
<!ATTLIST copyfile dest CDATA #REQUIRED>
<!ELEMENT linkfile (EMPTY)>
<!ATTLIST src value CDATA #REQUIRED>
<!ATTLIST dest value CDATA #REQUIRED>
<!ATTLIST linkfile src CDATA #REQUIRED>
<!ATTLIST linkfile dest CDATA #REQUIRED>
<!ELEMENT extend-project>
<!ELEMENT extend-project (EMPTY)>
<!ATTLIST extend-project name CDATA #REQUIRED>
<!ATTLIST extend-project path CDATA #IMPLIED>
<!ATTLIST extend-project groups CDATA #IMPLIED>
......
......@@ -169,6 +169,9 @@ class GitCommand(object):
if p is not None:
s = p + ' ' + 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 not cwd:
......
......@@ -253,7 +253,7 @@ class _LinkFile(object):
if not portable.os_path_islink(absDest) or (portable.os_path_realpath(absDest) != relSrc):
try:
# remove existing file first, since it might be read-only
if os.path.exists(absDest):
if os.path.lexists(absDest):
os.remove(absDest)
else:
dest_dir = os.path.dirname(absDest)
......@@ -1115,7 +1115,8 @@ class Project(object):
clone_bundle=True,
no_tags=False,
archive=False,
optimized_fetch=False):
optimized_fetch=False,
prune=False):
"""Perform only the network IO portion of the sync process.
Local working directory/branch state is not affected.
"""
......@@ -1186,7 +1187,7 @@ class Project(object):
if (need_to_fetch
and not self._RemoteFetch(initial=is_new, quiet=quiet, alt_dir=alt_dir,
current_branch_only=current_branch_only,
no_tags=no_tags)):
no_tags=no_tags, prune=prune)):
return False
if self.worktree:
......@@ -1587,8 +1588,6 @@ class Project(object):
if kill:
old = self.bare_git.GetHead()
if old is None:
old = 'refs/heads/please_never_use_this_as_a_branch_name'
try:
self.bare_git.DetachHead(rev)
......@@ -1600,6 +1599,9 @@ class Project(object):
capture_stderr=True)
b.Wait()
finally:
if ID_RE.match(old):
self.bare_git.DetachHead(old)
else:
self.bare_git.SetHead(old)
left = self._allrefs
......@@ -1800,7 +1802,8 @@ class Project(object):
initial=False,
quiet=False,
alt_dir=None,
no_tags=False):
no_tags=False,
prune=False):
is_sha1 = False
tag_name = None
......@@ -1913,6 +1916,9 @@ class Project(object):
else:
cmd.append('--tags')
if prune:
cmd.append('--prune')
spec = []
if not current_branch_only:
# Fetch whole repo
......
#!/usr/bin/env python
## repo default configuration
##
# REPO_URL = 'https://gerrit.googlesource.com/git-repo'
REPO_URL = 'https://github.com/esrlabs/git-repo'
# repo default configuration
#
import os
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'
# Copyright (C) 2008 Google Inc.
......@@ -127,7 +130,6 @@ GITC_FS_ROOT_DIR = '/gitc/manifest-rw/'
import errno
import optparse
import os
import re
import shutil
import stat
......@@ -227,9 +229,10 @@ group.add_option('--config-name',
dest='config_name', action="store_true", default=False,
help='Always prompt for name/e-mail')
def _GitcInitOptions(init_optparse):
init_optparse.set_usage("repo gitc-init -u url -c client [options]")
g = init_optparse.add_option_group('GITC options')
def _GitcInitOptions(init_optparse_arg):
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',
dest='manifest_file',
help='Optional manifest file to use for this GITC client.')
......@@ -238,6 +241,8 @@ def _GitcInitOptions(init_optparse):
help='The name of the gitc_client instance to create or modify.')
_gitc_manifest_dir = None
def get_gitc_manifest_dir():
global _gitc_manifest_dir
if _gitc_manifest_dir is None:
......@@ -252,6 +257,7 @@ def get_gitc_manifest_dir():
pass
return _gitc_manifest_dir
def gitc_parse_clientdir(gitc_fs_path):
"""Parse a path in the GITC FS and return its client name.
......@@ -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(GITC_FS_ROOT_DIR)[1].split('/')[0]
class CloneFailure(Exception):
"""Indicate the remote clone of repo itself failed.
"""
......@@ -442,8 +450,8 @@ def SetupGnuPG(quiet):
cmd = ['gpg', '--import']
try:
proc = subprocess.Popen(cmd,
env = env,
stdin = subprocess.PIPE)
env=env,
stdin=subprocess.PIPE)
except OSError as e:
if not quiet:
_print('warning: gpg (GnuPG) is not available.', file=sys.stderr)
......@@ -469,7 +477,7 @@ def _SetConfig(local, name, value):
"""Set a git configuration option to the specified value.
"""
cmd = [GIT, 'config', name, value]
if subprocess.Popen(cmd, cwd = local).wait() != 0:
if subprocess.Popen(cmd, cwd=local).wait() != 0:
raise CloneFailure()
......@@ -484,7 +492,7 @@ def _InitHttp():
p = n.hosts[host]
mgr.add_password(p[1], 'http://%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
handlers.append(urllib.request.HTTPBasicAuthHandler(mgr))
handlers.append(urllib.request.HTTPDigestAuthHandler(mgr))
......@@ -497,6 +505,7 @@ def _InitHttp():
handlers.append(urllib.request.HTTPSHandler(debuglevel=1))
urllib.request.install_opener(urllib.request.build_opener(*handlers))
def _Fetch(url, local, src, quiet):
if not quiet:
_print('Get %s' % url, file=sys.stderr)
......@@ -511,13 +520,14 @@ def _Fetch(url, local, src, quiet):
cmd.append('+refs/heads/*:refs/remotes/origin/*')
cmd.append('refs/tags/*:refs/tags/*')
proc = subprocess.Popen(cmd, cwd = local, stderr = err)
proc = subprocess.Popen(cmd, cwd=local, stderr=err)
if err:
proc.stderr.read()
proc.stderr.close()
if proc.wait() != 0:
raise CloneFailure()
def _DownloadBundle(url, local, quiet):
if not url.endswith('/'):
url += '/'
......@@ -525,8 +535,8 @@ def _DownloadBundle(url, local, quiet):
proc = subprocess.Popen(
[GIT, 'config', '--get-regexp', 'url.*.insteadof'],
cwd = local,
stdout = subprocess.PIPE)
cwd=local,
stdout=subprocess.PIPE)
for line in proc.stdout:
m = re.compile(r'^url\.(.*)\.insteadof (.*)$').match(line)
if m:
......@@ -569,6 +579,7 @@ def _DownloadBundle(url, local, quiet):
finally:
dest.close()
def _ImportBundle(local):
path = os.path.join(local, '.git', 'clone.bundle')
try:
......@@ -576,6 +587,7 @@ def _ImportBundle(local):
finally:
os.remove(path)
def _Clone(url, local, quiet):
"""Clones a git repository to a new subdirectory of repodir
"""
......@@ -588,7 +600,7 @@ def _Clone(url, local, quiet):
cmd = [GIT, 'init', '--quiet']
try:
proc = subprocess.Popen(cmd, cwd = local)
proc = subprocess.Popen(cmd, cwd=local)
except OSError as e:
_print(file=sys.stderr)
_print("fatal: '%s' is not available" % GIT, file=sys.stderr)
......@@ -603,7 +615,8 @@ def _Clone(url, local, quiet):
_InitHttp()
_SetConfig(local, 'remote.origin.url', url)
_SetConfig(local, 'remote.origin.fetch',
_SetConfig(local,
'remote.origin.fetch',
'+refs/heads/*:refs/remotes/origin/*')
if _DownloadBundle(url, local, quiet):
_ImportBundle(local)
......@@ -617,7 +630,7 @@ def _Verify(cwd, branch, quiet):
proc = subprocess.Popen(cmd,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
cwd = cwd)
cwd=cwd)
cur = proc.stdout.read().strip()
proc.stdout.close()
......@@ -643,10 +656,10 @@ def _Verify(cwd, branch, quiet):
cmd = [GIT, 'tag', '-v', cur]
proc = subprocess.Popen(cmd,
stdout = subprocess.PIPE,
stderr = subprocess.PIPE,
cwd = cwd,
env = env)
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
cwd=cwd,
env=env)
out = proc.stdout.read()
proc.stdout.close()
......@@ -666,21 +679,21 @@ def _Checkout(cwd, branch, rev, quiet):
"""Checkout an upstream branch into the repository and track it.
"""
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()
_SetConfig(cwd, 'branch.default.remote', 'origin')
_SetConfig(cwd, 'branch.default.merge', 'refs/heads/%s' % branch)
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()
cmd = [GIT, 'read-tree', '--reset', '-u']
if not quiet:
cmd.append('-v')
cmd.append('HEAD')
if subprocess.Popen(cmd, cwd = cwd).wait() != 0:
if subprocess.Popen(cmd, cwd=cwd).wait() != 0:
raise CloneFailure()
......@@ -702,7 +715,7 @@ def _FindRepo():
return (repo, os.path.join(curdir, repodir))
class _Options:
class _Options(object):
help = False
......@@ -729,7 +742,7 @@ def _Usage():
gitc_usage = " gitc-init Initialize a GITC Client.\n"
_print(
"""usage: repo COMMAND [ARGS]
"""usage: repo COMMAND [ARGS]
repo is not yet installed. Use "repo init" to install it here.
......@@ -737,7 +750,7 @@ The most commonly used repo commands are:
init Install repo in the current working directory
""" + 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").
""", file=sys.stderr)
......@@ -798,8 +811,8 @@ def _SetDefaultsTo(gitdir):
'--git-dir=%s' % gitdir,
'symbolic-ref',
'HEAD'],
stdout = subprocess.PIPE,
stderr = subprocess.PIPE)
stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
REPO_REV = proc.stdout.read().strip()
proc.stdout.close()
......@@ -826,7 +839,8 @@ def main(orig_args):
if get_gitc_manifest_dir() and cwd.startswith(get_gitc_manifest_dir()):
_print('error: repo cannot be used in the GITC local manifest directory.'
'\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)
if not repo_main:
if opt.help:
......
......@@ -241,7 +241,8 @@ without iterating through the remaining projects.
rc = rc or errno.EINTR
except Exception as e:
# 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)
pool.terminate()
rc = rc or getattr(e, 'errno', 1)
......@@ -255,7 +256,8 @@ without iterating through the remaining projects.
try:
project = self._SerializeProject(p)
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)
return
except KeyboardInterrupt:
......
......@@ -179,7 +179,7 @@ to update the working directory files.
r.Save()
groups = re.split(r'[,\s]+', opt.groups)
all_platforms = ['linux', 'darwin']
all_platforms = ['linux', 'darwin', 'windows']
platformize = lambda x: 'platform-' + x
if opt.platform == 'auto':
if (not opt.mirror and
......@@ -188,7 +188,7 @@ to update the working directory files.
elif opt.platform == 'all':
groups.extend(map(platformize, all_platforms))
elif opt.platform in all_platforms:
groups.extend(platformize(opt.platform))
groups.append(platformize(opt.platform))
elif opt.platform != 'none':
print('fatal: invalid platform flag', file=sys.stderr)
sys.exit(1)
......
......@@ -54,6 +54,11 @@ branch but need to incorporate new upstream changes "underneath" them.
p.add_option('--auto-stash',
dest='auto_stash', action='store_true',
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):
all_projects = self.GetProjects(args)
......@@ -106,6 +111,10 @@ branch but need to incorporate new upstream changes "underneath" them.
if opt.interactive:
args.append("-i")
if opt.onto_manifest:
args.append('--onto')
args.append(project.revisionExpr)
args.append(upbranch.LocalMerge)
print('# %s: rebasing %s -> %s'
......
......@@ -57,10 +57,15 @@ revision specified in the manifest.
print("error: at least one project must be specified", file=sys.stderr)
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:
all_projects = self.GetProjects(projects, manifest=self.gitc_manifest,
gitc_projects = self.GetProjects(projects, manifest=self.gitc_manifest,
missing_ok=True)
for project in all_projects:
for project in gitc_projects:
if project.old_revision:
project.already_synced = True
else:
......@@ -70,8 +75,10 @@ revision specified in the manifest.
# Save the GITC manifest.
gitc_utils.save_manifest(self.gitc_manifest)
all_projects = self.GetProjects(projects,
missing_ok=bool(self.gitc_manifest))
# Make sure we have a valid CWD
if not os.path.exists(os.getcwd()):
os.chdir(self.manifest.topdir)
pm = Progress('Starting %s' % nb, len(all_projects))
for project in all_projects:
pm.update()
......
......@@ -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
exist locally.
The --prune option can be used to remove any refs that no longer
exist on the remote.
SSH Connections
---------------
......@@ -236,6 +239,8 @@ later is required to fix a server side protocol bug.
p.add_option('--optimized-fetch',
dest='optimized_fetch', action='store_true',
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:
p.add_option('-s', '--smart-sync',
dest='smart_sync', action='store_true',
......@@ -307,7 +312,8 @@ later is required to fix a server side protocol bug.
force_sync=opt.force_sync,
clone_bundle=not opt.no_clone_bundle,
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)
# 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.
did_lock = True
if not success:
err_event.set()
print('error: Cannot fetch %s' % project.name, file=sys.stderr)
if opt.force_broken:
print('warn: --force-broken, continuing to sync',
......@@ -326,7 +333,7 @@ later is required to fix a server side protocol bug.
fetched.add(project.gitdir)
pm.update()
except _FetchError:
err_event.set()
pass
except Exception as e:
print('error: Cannot fetch %s (%s: %s)' \
% (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