Merge lp:~jelmer/bzr/no-more-email-file into lp:bzr

Proposed by Jelmer Vernooij on 2011-12-13
Status: Merged
Approved by: Martin Packman on 2011-12-13
Approved revision: 6366
Merged at revision: 6363
Proposed branch: lp:~jelmer/bzr/no-more-email-file
Merge into: lp:bzr
Diff against target: 120 lines (+12/-31)
5 files modified
bzrlib/config.py (+0/-7)
bzrlib/tests/blackbox/test_commit.py (+1/-1)
bzrlib/tests/blackbox/test_sign_my_commits.py (+1/-1)
bzrlib/tests/test_config.py (+6/-22)
doc/en/release-notes/bzr-2.5.txt (+4/-0)
To merge this branch: bzr merge lp:~jelmer/bzr/no-more-email-file
Reviewer Review Type Date Requested Status
Martin Pool Approve on 2011-12-14
Martin Packman (community) 2011-12-13 Approve on 2011-12-13
Review via email: mp+85551@code.launchpad.net

Commit message

Remove support for the .bzr/branch/email file.

Description of the change

Remove support for the .bzr/branch/email file.

This causes overhead talking to remote servers, and it duplicates something for which
we already have many alternatives - the 'email' configuration option and the
$EMAIL and $BZR_EMAIL environment variables. There is also no way of setting
it, other than knowing the name of the file and creating it manually.

To post a comment you must log in.
Martin Packman (gz) wrote :

Nice, and more than a little funny, land it before Vincent cries any more.

review: Approve
Jelmer Vernooij (jelmer) wrote :

sent to pqm by email

Martin Pool (mbp) wrote :

Great, thanks

  vote approve

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'bzrlib/config.py'
2--- bzrlib/config.py 2011-12-09 16:15:52 +0000
3+++ bzrlib/config.py 2011-12-13 20:55:25 +0000
4@@ -1396,13 +1396,6 @@
5 e.g. "John Hacker <jhacker@example.com>"
6 This is looked up in the email controlfile for the branch.
7 """
8- try:
9- return (self.branch._transport.get_bytes("email")
10- .decode(osutils.get_user_encoding())
11- .rstrip("\r\n"))
12- except (errors.NoSuchFile, errors.PermissionDenied), e:
13- pass
14-
15 return self._get_best_value('_get_user_id')
16
17 def _get_change_editor(self):
18
19=== modified file 'bzrlib/tests/blackbox/test_commit.py'
20--- bzrlib/tests/blackbox/test_commit.py 2011-12-05 16:55:20 +0000
21+++ bzrlib/tests/blackbox/test_commit.py 2011-12-13 20:55:25 +0000
22@@ -873,4 +873,4 @@
23 # being too low. If rpc_count increases, more network roundtrips have
24 # become necessary for this use case. Please do not adjust this number
25 # upwards without agreement from bzr's network support maintainers.
26- self.assertLength(220, self.hpss_calls)
27+ self.assertLength(213, self.hpss_calls)
28
29=== modified file 'bzrlib/tests/blackbox/test_sign_my_commits.py'
30--- bzrlib/tests/blackbox/test_sign_my_commits.py 2011-11-28 14:18:56 +0000
31+++ bzrlib/tests/blackbox/test_sign_my_commits.py 2011-12-13 20:55:25 +0000
32@@ -164,7 +164,7 @@
33 # being too low. If rpc_count increases, more network roundtrips have
34 # become necessary for this use case. Please do not adjust this number
35 # upwards without agreement from bzr's network support maintainers.
36- self.assertLength(54, self.hpss_calls)
37+ self.assertLength(51, self.hpss_calls)
38
39 def test_verify_commits(self):
40 self.setup_smart_server_with_call_log()
41
42=== modified file 'bzrlib/tests/test_config.py'
43--- bzrlib/tests/test_config.py 2011-12-09 16:15:52 +0000
44+++ bzrlib/tests/test_config.py 2011-12-13 20:55:25 +0000
45@@ -328,13 +328,13 @@
46
47 class FakeBranch(object):
48
49- def __init__(self, base=None, user_id=None):
50+ def __init__(self, base=None):
51 if base is None:
52 self.base = "http://example.com/branches/demo"
53 else:
54 self.base = base
55 self._transport = self.control_files = \
56- FakeControlFilesAndTransport(user_id=user_id)
57+ FakeControlFilesAndTransport()
58
59 def _get_config(self):
60 return config.TransportConfig(self._transport, 'branch.conf')
61@@ -348,16 +348,10 @@
62
63 class FakeControlFilesAndTransport(object):
64
65- def __init__(self, user_id=None):
66+ def __init__(self):
67 self.files = {}
68- if user_id:
69- self.files['email'] = user_id
70 self._transport = self
71
72- def get_utf8(self, filename):
73- # from LockableFiles
74- raise AssertionError("get_utf8 should no longer be used")
75-
76 def get(self, filename):
77 # from Transport
78 try:
79@@ -1761,24 +1755,14 @@
80 return my_config
81
82 def test_user_id(self):
83- branch = FakeBranch(user_id='Robert Collins <robertc@example.net>')
84+ branch = FakeBranch()
85 my_config = config.BranchConfig(branch)
86- self.assertEqual("Robert Collins <robertc@example.net>",
87- my_config.username())
88+ self.assertIsNot(None, my_config.username())
89 my_config.branch.control_files.files['email'] = "John"
90 my_config.set_user_option('email',
91 "Robert Collins <robertc@example.org>")
92- self.assertEqual("John", my_config.username())
93- del my_config.branch.control_files.files['email']
94 self.assertEqual("Robert Collins <robertc@example.org>",
95- my_config.username())
96-
97- def test_not_set_in_branch(self):
98- my_config = self.get_branch_config(global_config=sample_config_text)
99- self.assertEqual(u"Erik B\u00e5gfors <erik@bagfors.nu>",
100- my_config._get_user_id())
101- my_config.branch.control_files.files['email'] = "John"
102- self.assertEqual("John", my_config._get_user_id())
103+ my_config.username())
104
105 def test_BZR_EMAIL_OVERRIDES(self):
106 self.overrideEnv('BZR_EMAIL', "Robert Collins <robertc@example.org>")
107
108=== modified file 'doc/en/release-notes/bzr-2.5.txt'
109--- doc/en/release-notes/bzr-2.5.txt 2011-12-12 13:44:20 +0000
110+++ doc/en/release-notes/bzr-2.5.txt 2011-12-13 20:55:25 +0000
111@@ -15,6 +15,10 @@
112
113 .. These may require users to change the way they use Bazaar.
114
115+* The '.bzr/branch/email' file is no longer read to determine the users'
116+ identity. Instead, the 'email' setting in '.bzr/branch/branch.conf'
117+ should be used. (Jelmer Vernooij, #903894)
118+
119 New Features
120 ************
121