mirror of
https://gerrit.googlesource.com/git-repo
synced 2024-12-21 07:16:21 +00:00
Merge changes Iaefcbe14,I697a0f64,I19bfe9fe,I06e942c4
* changes: forall: use smart sync override manifest if it exists sync: Remove smart sync override manifest when not in smart sync mode forall: Don't try to get lrev of projects in mirror workspace sync: Improve error message when writing smart sync manifest fails
This commit is contained in:
commit
80e3a37ab5
@ -151,11 +151,15 @@ without iterating through the remaining projects.
|
|||||||
attributes that we need.
|
attributes that we need.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
if not self.manifest.IsMirror:
|
||||||
|
lrev = project.GetRevisionId()
|
||||||
|
else:
|
||||||
|
lrev = None
|
||||||
return {
|
return {
|
||||||
'name': project.name,
|
'name': project.name,
|
||||||
'relpath': project.relpath,
|
'relpath': project.relpath,
|
||||||
'remote_name': project.remote.name,
|
'remote_name': project.remote.name,
|
||||||
'lrev': project.GetRevisionId(),
|
'lrev': lrev,
|
||||||
'rrev': project.revisionExpr,
|
'rrev': project.revisionExpr,
|
||||||
'annotations': dict((a.name, a.value) for a in project.annotations),
|
'annotations': dict((a.name, a.value) for a in project.annotations),
|
||||||
'gitdir': project.gitdir,
|
'gitdir': project.gitdir,
|
||||||
@ -201,6 +205,13 @@ without iterating through the remaining projects.
|
|||||||
mirror = self.manifest.IsMirror
|
mirror = self.manifest.IsMirror
|
||||||
rc = 0
|
rc = 0
|
||||||
|
|
||||||
|
smart_sync_manifest_name = "smart_sync_override.xml"
|
||||||
|
smart_sync_manifest_path = os.path.join(
|
||||||
|
self.manifest.manifestProject.worktree, smart_sync_manifest_name)
|
||||||
|
|
||||||
|
if os.path.isfile(smart_sync_manifest_path):
|
||||||
|
self.manifest.Override(smart_sync_manifest_path)
|
||||||
|
|
||||||
if not opt.regex:
|
if not opt.regex:
|
||||||
projects = self.GetProjects(args)
|
projects = self.GetProjects(args)
|
||||||
else:
|
else:
|
||||||
|
@ -517,6 +517,9 @@ later is required to fix a server side protocol bug.
|
|||||||
self.manifest.Override(opt.manifest_name)
|
self.manifest.Override(opt.manifest_name)
|
||||||
|
|
||||||
manifest_name = opt.manifest_name
|
manifest_name = opt.manifest_name
|
||||||
|
smart_sync_manifest_name = "smart_sync_override.xml"
|
||||||
|
smart_sync_manifest_path = os.path.join(
|
||||||
|
self.manifest.manifestProject.worktree, smart_sync_manifest_name)
|
||||||
|
|
||||||
if opt.smart_sync or opt.smart_tag:
|
if opt.smart_sync or opt.smart_tag:
|
||||||
if not self.manifest.manifest_server:
|
if not self.manifest.manifest_server:
|
||||||
@ -583,17 +586,16 @@ later is required to fix a server side protocol bug.
|
|||||||
[success, manifest_str] = server.GetManifest(opt.smart_tag)
|
[success, manifest_str] = server.GetManifest(opt.smart_tag)
|
||||||
|
|
||||||
if success:
|
if success:
|
||||||
manifest_name = "smart_sync_override.xml"
|
manifest_name = smart_sync_manifest_name
|
||||||
manifest_path = os.path.join(self.manifest.manifestProject.worktree,
|
|
||||||
manifest_name)
|
|
||||||
try:
|
try:
|
||||||
f = open(manifest_path, 'w')
|
f = open(smart_sync_manifest_path, 'w')
|
||||||
try:
|
try:
|
||||||
f.write(manifest_str)
|
f.write(manifest_str)
|
||||||
finally:
|
finally:
|
||||||
f.close()
|
f.close()
|
||||||
except IOError:
|
except IOError as e:
|
||||||
print('error: cannot write manifest to %s' % manifest_path,
|
print('error: cannot write manifest to %s:\n%s'
|
||||||
|
% (smart_sync_manifest_path, e),
|
||||||
file=sys.stderr)
|
file=sys.stderr)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
self._ReloadManifest(manifest_name)
|
self._ReloadManifest(manifest_name)
|
||||||
@ -610,6 +612,13 @@ later is required to fix a server side protocol bug.
|
|||||||
% (self.manifest.manifest_server, e.errcode, e.errmsg),
|
% (self.manifest.manifest_server, e.errcode, e.errmsg),
|
||||||
file=sys.stderr)
|
file=sys.stderr)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
else: # Not smart sync or smart tag mode
|
||||||
|
if os.path.isfile(smart_sync_manifest_path):
|
||||||
|
try:
|
||||||
|
os.remove(smart_sync_manifest_path)
|
||||||
|
except OSError as e:
|
||||||
|
print('error: failed to remove existing smart sync override manifest: %s' %
|
||||||
|
e, file=sys.stderr)
|
||||||
|
|
||||||
rp = self.manifest.repoProject
|
rp = self.manifest.repoProject
|
||||||
rp.PreSync()
|
rp.PreSync()
|
||||||
|
Loading…
Reference in New Issue
Block a user