mirror of
https://gerrit.googlesource.com/git-repo
synced 2024-12-21 07:16:21 +00:00
Use remote.*.projectname to indicate the target project for upload
This way "forks" of a project, e.g. the linux kernel, can be setup to use different destination projects in the review server by creating different remotes in the client side Git repository. Signed-off-by: Shawn O. Pearce <sop@google.com>
This commit is contained in:
parent
70cd4ab270
commit
339ba9f6f7
@ -258,6 +258,7 @@ class Remote(object):
|
||||
self.name = name
|
||||
self.url = self._Get('url')
|
||||
self.review = self._Get('review')
|
||||
self.projectname = self._Get('projectname')
|
||||
self.fetch = map(lambda x: RefSpec.FromString(x),
|
||||
self._Get('fetch', all=True))
|
||||
|
||||
@ -299,6 +300,7 @@ class Remote(object):
|
||||
"""
|
||||
self._Set('url', self.url)
|
||||
self._Set('review', self.review)
|
||||
self._Set('projectname', self.projectname)
|
||||
self._Set('fetch', map(lambda x: str(x), self.fetch))
|
||||
|
||||
def _Set(self, key, value):
|
||||
|
10
project.py
10
project.py
@ -461,13 +461,17 @@ class Project(object):
|
||||
if not base_list:
|
||||
raise GitError('no base refs, cannot upload %s' % branch.name)
|
||||
|
||||
if not branch.remote.projectname:
|
||||
branch.remote.projectname = self.name
|
||||
branch.remote.Save()
|
||||
|
||||
print >>sys.stderr, ''
|
||||
_info("Uploading %s to %s:", branch.name, self.name)
|
||||
try:
|
||||
UploadBundle(project = self,
|
||||
server = branch.remote.review,
|
||||
email = self.UserEmail,
|
||||
dest_project = self.name,
|
||||
dest_project = branch.remote.projectname,
|
||||
dest_branch = dest_branch,
|
||||
src_branch = R_HEADS + branch.name,
|
||||
bases = base_list)
|
||||
@ -887,6 +891,8 @@ class Project(object):
|
||||
url += '/%s.git' % self.name
|
||||
remote.url = url
|
||||
remote.review = self.remote.reviewUrl
|
||||
if remote.projectname is None:
|
||||
remote.projectname = self.name
|
||||
|
||||
if self.worktree:
|
||||
remote.ResetFetch(mirror=False)
|
||||
@ -898,6 +904,8 @@ class Project(object):
|
||||
remote = self.GetRemote(r.name)
|
||||
remote.url = r.fetchUrl
|
||||
remote.review = r.reviewUrl
|
||||
if remote.projectname is None:
|
||||
remote.projectname = self.name
|
||||
remote.ResetFetch()
|
||||
remote.Save()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user