Merge lp:~andrea.corbellini/tarmac/save-commit-author into lp:tarmac

Proposed by Andrea Corbellini
Status: Rejected
Rejected by: Paul Hummer
Proposed branch: lp:~andrea.corbellini/tarmac/save-commit-author
Merge into: lp:tarmac
Diff against target: None lines
To merge this branch: bzr merge lp:~andrea.corbellini/tarmac/save-commit-author
Reviewer Review Type Date Requested Status
Paul Hummer Disapprove
Review via email: mp+7105@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Andrea Corbellini (andrea.corbellini) wrote :

This branch allows Tarmac to pick up the author of the candidate branch and save it in the commit.

Revision history for this message
dobey (dobey) wrote :

This picks up the owner and their preferred e-mail, which may not be the e-mail they committed with, nor want to use for the commit. I think what we really want to do is pull the committer name/e-mail from the last commit in the pending merge before committing it to trunk.

Revision history for this message
Paul Hummer (rockstar) wrote :

Andrea-

  I really appreciate your effort in this, and for participating in Tarmac development. There are a number of flaws in this implementation. For instance, what if the user has elected to hide his email address from everyone. What if the user is committing code under a different user name (I do this a lot, since I have Canonical projects and non-Canonical projects).

  I'm quite happy to sit down with you and talk about an implementation that would work, and happy to help you along with it. I really appreciate your help in making Tarmac better.

review: Disapprove
Revision history for this message
Andrea Corbellini (andrea.corbellini) wrote :

No problem! :-)
I haven't much time in this period so I can't work on a different
implementation, for now. Thanks for the review.

Unmerged revisions

106. By Andrea Corbellini

Save the author of the branch in the commit message.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'tarmac/bin.py'
--- tarmac/bin.py 2009-05-28 18:40:35 +0000
+++ tarmac/bin.py 2009-06-05 14:52:58 +0000
@@ -99,6 +99,17 @@
99 return [comment.reviewer for comment in candidate.all_comments99 return [comment.reviewer for comment in candidate.all_comments
100 if comment.vote == u'Approve'].join(', ')100 if comment.vote == u'Approve'].join(', ')
101101
102 def _get_author(self, source_branch):
103 '''Get the author of the branch and return a string in the form
104 "Display Name <email@address>"
105 '''
106 owner = source_branch.owner
107 if owner.hide_email_addresses:
108 return str(owner.display_name)
109 else:
110 return '%s <%s>' % (
111 owner.display_name, owner.preferred_email_address.email)
112
102 def main(self):113 def main(self):
103 '''See `TarmacScript.main`.'''114 '''See `TarmacScript.main`.'''
104115
@@ -152,6 +163,7 @@
152 'commit_message': commit_message}163 'commit_message': commit_message}
153164
154 source_branch = Branch(candidate.source_branch)165 source_branch = Branch(candidate.source_branch)
166 commit_author = self._get_author(source_branch)
155167
156 try:168 try:
157 trunk.merge(source_branch)169 trunk.merge(source_branch)
@@ -168,10 +180,9 @@
168 trunk.cleanup()180 trunk.cleanup()
169 else:181 else:
170 print 'Committing...'182 print 'Committing...'
171 trunk.commit(commit_message)183 trunk.commit(commit_message, commit_author)
172 except Exception, e:184 except Exception, e:
173 print e185 print e
174 trunk.cleanup()186 trunk.cleanup()
175187
176 tarmac_hooks['post_tarmac_commit'].fire()188 tarmac_hooks['post_tarmac_commit'].fire()
177
178189
=== modified file 'tarmac/branch.py'
--- tarmac/branch.py 2009-05-28 18:40:35 +0000
+++ tarmac/branch.py 2009-06-05 14:52:58 +0000
@@ -40,13 +40,16 @@
40 if self.has_tree:40 if self.has_tree:
41 self._set_up_working_tree()41 self._set_up_working_tree()
4242
43 def commit(self, commit_message):43 def commit(self, commit_message, commit_author):
44 '''Commit changes.'''44 '''Commit changes.'''
45 if not self.has_tree:45 if not self.has_tree:
46 raise Exception('This branch has no working tree.')46 raise Exception('This branch has no working tree.')
47 self.tree.commit(commit_message)47 self.tree.commit(commit_message, authors=[commit_author])
4848
49 @property49 @property
50 def landing_candidates(self):50 def landing_candidates(self):
51 return self.lp_branch.landing_candidates51 return self.lp_branch.landing_candidates
5252
53 @property
54 def owner(self):
55 return self.lp_branch.owner

Subscribers

People subscribed via source and target branches