Merge lp:~jtv/launchpad/bug-643345 into lp:launchpad
| Status: | Merged | ||||
|---|---|---|---|---|---|
| Merged at revision: | 11599 | ||||
| Proposed branch: | lp:~jtv/launchpad/bug-643345 | ||||
| Merge into: | lp:launchpad | ||||
| Diff against target: |
262 lines (+108/-24) 4 files modified
lib/lp/code/model/directbranchcommit.py (+21/-4) lib/lp/code/tests/test_directbranchcommit.py (+71/-12) lib/lp/translations/scripts/tests/test_translations_to_branch.py (+13/-5) lib/lp/translations/scripts/translations_to_branch.py (+3/-3) |
||||
| To merge this branch: | bzr merge lp:~jtv/launchpad/bug-643345 | ||||
| Related bugs: |
|
| Reviewer | Review Type | Date Requested | Status |
|---|---|---|---|
| Tim Penhey (community) | production-change | Approve on 2010-09-27 | |
| Robert Collins | production-change | 2010-09-22 | Pending |
| Launchpad code reviewers | code | 2010-09-22 | Pending |
|
Review via email:
|
|||
Commit Message
Fixes translations-
Description of the Change
= Bug 643345 =
For cherrypicking.
DirectBranchCommit has been changed in such a way that it errors out when the committer has no preferred email (which is often the case with teams). This is breaking our daily translations-
This branch fixes that. It makes several changes:
* Allows a user of DirectBranchCommit to specify a bzr committer id as a string.
* Makes DirectBranchCommit fall back to a safe default for the committer id.
* Documents and tests the choice of default committer (it's the branch owner).
* Sets a more accurate committer string in translations exports.
* Cleans out the obsolete boilerplate that we used to need at the bottom of each unit test.
* Sanitizes the inheritance tree for some test classes.
There are probably better fixes for the general case. This branch lays some groundwork for them, but is primarily intended to solve our immediate problem.
To test:
{{{
./bin/test -vvc lp.code.
./bin/test -vvc lp.translations -t branch
}}}
No lint,
Jeroen
| Michael Nelson (michael.nelson) wrote : | # |
I didn't realise Tim was already reviewing this, but here were my notes up until I did:
> === modified file 'lib/lp/
> --- lib/lp/
> +++ lib/lp/
> @@ -74,9 +75,13 @@
> `DirectBranchCo
>
> :param db_branch: a Launchpad `Branch` object.
> - :param committer: the `Person` writing to the branch.
> + :param committer: the `Person` writing to the branch. Defaults to
> + the branch owner.
> :param no_race_check: don't check for other commits before committing
> our changes, for use in tests.
> + :param committer_string: Optional description (typically with email
> + address) of the committer for use in bzr. If not given, the
> + `committer`'s email address will be used instead.
It wasn't obvious to me without looking below that this isn't an actual commit
string provided by the committer.
> """
> self.db_branch = db_branch
>
> @@ -85,6 +90,7 @@
> if committer is None:
> committer = db_branch.owner
> self.committer = committer
> + self.committer_
>
> self.no_race_check = no_race_check
>
> @@ -176,6 +182,17 @@
> raise ConcurrentUpdat
> "Branch has been changed. Not committing.")
>
> + def getBzrCommitter
> + """Find the committer id to pass to bzr."""
> + if self.committer_
> + return self.committer_
> + elif self.committer.
> + return format_
The bug history shows Aaron changing the title of the bug to:
"Using preferredemail as a public email id is wrong and broken."
If so, should the above elif be included?
> + else:
> + return '"%s" <%s>' % (
> + self.committer.
> + config.
> +
> def commit(self, commit_message, txn=None):
> """Commit to branch.
>
IRC log:
09:26 < noodles775> jtv: only things I've thought so far are:
09:27 < noodles775> 1) It wasn't obvious to me without reading the code below that committer_string isn't an actual commit string provided (somehow) by the committer. Not sure if there's a better name, or maybe its just me.
09:28 < noodles775> 2) In getBzrCommitterID you're using self.committer.
09:28 < noodles775> (but I don't know the background)
09:29 < jtv> noodles775: I'd be happy to come up with a better name for 1. As for 2, that falls under the "laying groundwork" part—there must be better fixes, but for now I just want the failures out of the way.
09:30 < noodles775> Yes, but (regarding 2) couldn't you just remove that elif for the moment to get the failures out of the way?
09:30 < thumper> jtv: reviewed
09:30 < jtv> noodles775: well AIUI it's wrong _because_ it's not guaranteed to be present.
09:31 <...
| Jeroen T. Vermeulen (jtv) wrote : | # |
> For the TestGetBzrCommi
> do something like:
>
> committer = DirectBranchCom
> self.addCleanup
Great! Done.
> The test should also work in the DatabaseFunctio
> ZopelessDatabas
> that layer, in which case, document it.
Changed the layer.
> How about "Launchpad Translations on behalf of %s"?
I was hesitant to put it like that because it's longer, but agree it's better. Done.

For the TestGetBzrCommi tterID test case, remove the tearDown, and instead
do something like:
committer = DirectBranchCom mit(... ) (committer. unlock)
self.addCleanup
The test should also work in the DatabaseFunctio nalLayer rather than the eLayer. Unless there is a reason why you are running it in
ZopelessDatabas
that layer, in which case, document it.
How about "Launchpad Translations on behalf of %s"?