summaryrefslogtreecommitdiffstats
path: root/project.py
diff options
context:
space:
mode:
authorShawn O. Pearce <sop@google.com>2008-11-11 17:12:43 -0800
committerShawn O. Pearce <sop@google.com>2008-11-12 09:12:19 -0800
commitc99883fee990a1baa7e0bf5f854c7485b7d0f0d9 (patch)
tree870cfd73b1fc2faf53da6d613ae820984695b305 /project.py
parentec18b4bac4f3c0760c26e83b8ade01ad1c815a9b (diff)
downloadgit-repo-c99883fee990a1baa7e0bf5f854c7485b7d0f0d9.tar.gz
Teach 'repo upload --replace' how to add replacement patch setsv1.3
Users are prompted with the list of known changes we are about to upload, and they can fill out the current change numbers for any changes which already exist in the data store. For each of those changes the change number and commit id is sent as part of the upload request, so Gerrit can insert the new commit as a new patch set of the existing change, rather than make a new change. This facility permits developers to replace a patch so they can address comments made on a prior version of the same change. Signed-off-by: Shawn O. Pearce <sop@google.com>
Diffstat (limited to 'project.py')
-rw-r--r--project.py19
1 files changed, 16 insertions, 3 deletions
diff --git a/project.py b/project.py
index 1e25c2c9..39550335 100644
--- a/project.py
+++ b/project.py
@@ -104,6 +104,7 @@ class ReviewableBranch(object):
104 self.project = project 104 self.project = project
105 self.branch = branch 105 self.branch = branch
106 self.base = base 106 self.base = base
107 self.replace_changes = None
107 108
108 @property 109 @property
109 def name(self): 110 def name(self):
@@ -124,6 +125,16 @@ class ReviewableBranch(object):
124 return self._commit_cache 125 return self._commit_cache
125 126
126 @property 127 @property
128 def unabbrev_commits(self):
129 r = dict()
130 for commit in self.project.bare_git.rev_list(
131 not_rev(self.base),
132 R_HEADS + self.name,
133 '--'):
134 r[commit[0:8]] = commit
135 return r
136
137 @property
127 def date(self): 138 def date(self):
128 return self.project.bare_git.log( 139 return self.project.bare_git.log(
129 '--pretty=format:%cd', 140 '--pretty=format:%cd',
@@ -132,7 +143,8 @@ class ReviewableBranch(object):
132 '--') 143 '--')
133 144
134 def UploadForReview(self): 145 def UploadForReview(self):
135 self.project.UploadForReview(self.name) 146 self.project.UploadForReview(self.name,
147 self.replace_changes)
136 148
137 @property 149 @property
138 def tip_url(self): 150 def tip_url(self):
@@ -444,7 +456,7 @@ class Project(object):
444 return rb 456 return rb
445 return None 457 return None
446 458
447 def UploadForReview(self, branch=None): 459 def UploadForReview(self, branch=None, replace_changes=None):
448 """Uploads the named branch for code review. 460 """Uploads the named branch for code review.
449 """ 461 """
450 if branch is None: 462 if branch is None:
@@ -482,7 +494,8 @@ class Project(object):
482 dest_project = branch.remote.projectname, 494 dest_project = branch.remote.projectname,
483 dest_branch = dest_branch, 495 dest_branch = dest_branch,
484 src_branch = R_HEADS + branch.name, 496 src_branch = R_HEADS + branch.name,
485 bases = base_list) 497 bases = base_list,
498 replace_changes = replace_changes)
486 except proto_client.ClientLoginError: 499 except proto_client.ClientLoginError:
487 raise UploadError('Login failure') 500 raise UploadError('Login failure')
488 except urllib2.HTTPError, e: 501 except urllib2.HTTPError, e: