mirror of
https://gerrit.googlesource.com/git-repo
synced 2025-07-02 20:17:19 +00:00
Compare commits
3 Commits
Author | SHA1 | Date | |
---|---|---|---|
719965af35 | |||
5732e47ebb | |||
f3fdf823cf |
@ -24,6 +24,7 @@ import time
|
|||||||
import xmlrpclib
|
import xmlrpclib
|
||||||
|
|
||||||
from git_command import GIT
|
from git_command import GIT
|
||||||
|
from git_refs import R_HEADS
|
||||||
from project import HEAD
|
from project import HEAD
|
||||||
from project import Project
|
from project import Project
|
||||||
from project import RemoteSpec
|
from project import RemoteSpec
|
||||||
@ -147,32 +148,36 @@ later is required to fix a server side protocol bug.
|
|||||||
if not path:
|
if not path:
|
||||||
continue
|
continue
|
||||||
if path not in new_project_paths:
|
if path not in new_project_paths:
|
||||||
project = Project(
|
"""If the path has already been deleted, we don't need to do it
|
||||||
manifest = self.manifest,
|
"""
|
||||||
name = path,
|
if os.path.exists(self.manifest.topdir + '/' + path):
|
||||||
remote = RemoteSpec('origin'),
|
project = Project(
|
||||||
gitdir = os.path.join(self.manifest.topdir,
|
manifest = self.manifest,
|
||||||
path, '.git'),
|
name = path,
|
||||||
worktree = os.path.join(self.manifest.topdir, path),
|
remote = RemoteSpec('origin'),
|
||||||
relpath = path,
|
gitdir = os.path.join(self.manifest.topdir,
|
||||||
revisionExpr = 'HEAD',
|
path, '.git'),
|
||||||
revisionId = None)
|
worktree = os.path.join(self.manifest.topdir, path),
|
||||||
if project.IsDirty():
|
relpath = path,
|
||||||
print >>sys.stderr, 'error: Cannot remove project "%s": \
|
revisionExpr = 'HEAD',
|
||||||
|
revisionId = None)
|
||||||
|
|
||||||
|
if project.IsDirty():
|
||||||
|
print >>sys.stderr, 'error: Cannot remove project "%s": \
|
||||||
uncommitted changes are present' % project.relpath
|
uncommitted changes are present' % project.relpath
|
||||||
print >>sys.stderr, ' commit changes, then run sync again'
|
print >>sys.stderr, ' commit changes, then run sync again'
|
||||||
return -1
|
return -1
|
||||||
else:
|
else:
|
||||||
print >>sys.stderr, 'Deleting obsolete path %s' % project.worktree
|
print >>sys.stderr, 'Deleting obsolete path %s' % project.worktree
|
||||||
shutil.rmtree(project.worktree)
|
shutil.rmtree(project.worktree)
|
||||||
# Try deleting parent subdirs if they are empty
|
# Try deleting parent subdirs if they are empty
|
||||||
dir = os.path.dirname(project.worktree)
|
dir = os.path.dirname(project.worktree)
|
||||||
while dir != self.manifest.topdir:
|
while dir != self.manifest.topdir:
|
||||||
try:
|
try:
|
||||||
os.rmdir(dir)
|
os.rmdir(dir)
|
||||||
except OSError:
|
except OSError:
|
||||||
break
|
break
|
||||||
dir = os.path.dirname(dir)
|
dir = os.path.dirname(dir)
|
||||||
|
|
||||||
new_project_paths.sort()
|
new_project_paths.sort()
|
||||||
fd = open(file_path, 'w')
|
fd = open(file_path, 'w')
|
||||||
@ -201,6 +206,8 @@ uncommitted changes are present' % project.relpath
|
|||||||
p = self.manifest.manifestProject
|
p = self.manifest.manifestProject
|
||||||
b = p.GetBranch(p.CurrentBranch)
|
b = p.GetBranch(p.CurrentBranch)
|
||||||
branch = b.merge
|
branch = b.merge
|
||||||
|
if branch.startswith(R_HEADS):
|
||||||
|
branch = branch[len(R_HEADS):]
|
||||||
|
|
||||||
env = dict(os.environ)
|
env = dict(os.environ)
|
||||||
if (env.has_key('TARGET_PRODUCT') and
|
if (env.has_key('TARGET_PRODUCT') and
|
||||||
@ -219,13 +226,13 @@ uncommitted changes are present' % project.relpath
|
|||||||
f = open(manifest_path, 'w')
|
f = open(manifest_path, 'w')
|
||||||
try:
|
try:
|
||||||
f.write(manifest_str)
|
f.write(manifest_str)
|
||||||
self.manifest.Override(manifest_name)
|
|
||||||
finally:
|
finally:
|
||||||
f.close()
|
f.close()
|
||||||
except IOError:
|
except IOError:
|
||||||
print >>sys.stderr, 'error: cannot write manifest to %s' % \
|
print >>sys.stderr, 'error: cannot write manifest to %s' % \
|
||||||
manifest_path
|
manifest_path
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
self.manifest.Override(manifest_name)
|
||||||
else:
|
else:
|
||||||
print >>sys.stderr, 'error: %s' % manifest_str
|
print >>sys.stderr, 'error: %s' % manifest_str
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
Reference in New Issue
Block a user