Merge lp:~gz/hydrazine/use_bzr_config_email_561211 into lp:hydrazine

Proposed by Martin Packman
Status: Merged
Approved by: Martin Pool
Approved revision: 92
Merged at revision: 97
Proposed branch: lp:~gz/hydrazine/use_bzr_config_email_561211
Merge into: lp:hydrazine
Diff against target: 19 lines (+2/-5)
1 file modified
feed-pqm (+2/-5)
To merge this branch: bzr merge lp:~gz/hydrazine/use_bzr_config_email_561211
Reviewer Review Type Date Requested Status
Martin Pool Approve
Review via email: mp+78738@code.launchpad.net

Description of the change

Currently hydrazine insists on looking at $EMAIL for your address, complains if it's not set, then looks at what your launchpad account has as your preferred email. This branch changes it to just use Bazaar's config instead, which is already needed for the GPG settings and will check $BZR_EMAIL, bazaar.conf, $EMAIL, then platform specific settings in that order.

Perhaps a (non-warning) print should be added back in to say which email is actually being used as this is a slight behaviour change and might surprise some people if they have funny bzr settings but sensible launchpad settings?

To post a comment you must log in.
Revision history for this message
Martin Pool (mbp) wrote :

I think printing something as the message is sent would be worthwhile, but this is good as it is. Thanks!

review: Approve
Revision history for this message
John A Meinel (jameinel) wrote :

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 10/9/2011 1:07 AM, Martin Packman wrote:
> Martin Packman has proposed merging
> lp:~gz/hydrazine/use_bzr_config_email_561211 into lp:hydrazine.
>
> Requested reviews: hydrazine-core (hydrazine-core)
>
> For more details, see:
> https://code.launchpad.net/~gz/hydrazine/use_bzr_config_email_561211/+merge/78738
>
> Currently hydrazine insists on looking at $EMAIL for your address,
> complains if it's not set, then looks at what your launchpad
> account has as your preferred email. This branch changes it to just
> use Bazaar's config instead, which is already needed for the GPG
> settings and will check $BZR_EMAIL, bazaar.conf, $EMAIL, then
> platform specific settings in that order.
>
> Perhaps a (non-warning) print should be added back in to say which
> email is actually being used as this is a slight behaviour change
> and might surprise some people if they have funny bzr settings but
> sensible launchpad settings?

Looks fine to me. I wonder if we could have
launchpad.me.preferred_email_address.email somehow as a fallback. I
think config can raise an exception if it can't determine an email
address?

(Not voting, because I don't think I actually have voting rights, and
Launchpad will reject my comment.)

John
=:->

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk6SlqIACgkQJdeBCYSNAAO/ogCdEVQPeQGiegpXHIKixyKpS491
sRMAoID4LwEwFo4GZcFyY5a0uMukTSZO
=xJ1/
-----END PGP SIGNATURE-----

Revision history for this message
Martin Packman (gz) wrote :

> Looks fine to me. I wonder if we could have
> launchpad.me.preferred_email_address.email somehow as a fallback. I
> think config can raise an exception if it can't determine an email
> address?

Yes, there's NoWhoami which is raised by newer bzrlib versions. I'm not sure which is more surprising if you have a misconfigured bzr identity and are trying to use feed-pqm, failing with that or using (potentially) a different account from launchpad.

I'll add the print and note the change in NEWS.

93. By Martin Packman

Add print with email address being used but not as a warning

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'feed-pqm'
2--- feed-pqm 2011-06-02 10:40:25 +0000
3+++ feed-pqm 2011-10-12 22:32:23 +0000
4@@ -144,13 +144,10 @@
5 print raw_message
6
7 config = GlobalConfig()
8+ my_email = config.user_email()
9+ print "Will send email from address <%s>" % (my_email,)
10 signer = gpg.GPGStrategy(config)
11 signed_message = signer.sign(raw_message.encode('utf8'))
12- try:
13- my_email = os.environ['EMAIL']
14- except KeyError:
15- my_email = launchpad.me.preferred_email_address.email
16- print "EMAIL environment variable not set, using %s" % my_email
17 # TODO: put in bug numbers as well.
18 commit_message = u"(%s) %s (%s)" % (launchpad.me.name, mp.commit_message,
19 mp.source_branch.owner.display_name)

Subscribers

People subscribed via source and target branches

to all changes: