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
=== modified file 'bzrlib/config.py'
--- bzrlib/config.py 2011-12-09 16:15:52 +0000
+++ bzrlib/config.py 2011-12-13 20:55:25 +0000
@@ -1396,13 +1396,6 @@
1396 e.g. "John Hacker <jhacker@example.com>"1396 e.g. "John Hacker <jhacker@example.com>"
1397 This is looked up in the email controlfile for the branch.1397 This is looked up in the email controlfile for the branch.
1398 """1398 """
1399 try:
1400 return (self.branch._transport.get_bytes("email")
1401 .decode(osutils.get_user_encoding())
1402 .rstrip("\r\n"))
1403 except (errors.NoSuchFile, errors.PermissionDenied), e:
1404 pass
1405
1406 return self._get_best_value('_get_user_id')1399 return self._get_best_value('_get_user_id')
14071400
1408 def _get_change_editor(self):1401 def _get_change_editor(self):
14091402
=== modified file 'bzrlib/tests/blackbox/test_commit.py'
--- bzrlib/tests/blackbox/test_commit.py 2011-12-05 16:55:20 +0000
+++ bzrlib/tests/blackbox/test_commit.py 2011-12-13 20:55:25 +0000
@@ -873,4 +873,4 @@
873 # being too low. If rpc_count increases, more network roundtrips have873 # being too low. If rpc_count increases, more network roundtrips have
874 # become necessary for this use case. Please do not adjust this number874 # become necessary for this use case. Please do not adjust this number
875 # upwards without agreement from bzr's network support maintainers.875 # upwards without agreement from bzr's network support maintainers.
876 self.assertLength(220, self.hpss_calls)876 self.assertLength(213, self.hpss_calls)
877877
=== modified file 'bzrlib/tests/blackbox/test_sign_my_commits.py'
--- bzrlib/tests/blackbox/test_sign_my_commits.py 2011-11-28 14:18:56 +0000
+++ bzrlib/tests/blackbox/test_sign_my_commits.py 2011-12-13 20:55:25 +0000
@@ -164,7 +164,7 @@
164 # being too low. If rpc_count increases, more network roundtrips have164 # being too low. If rpc_count increases, more network roundtrips have
165 # become necessary for this use case. Please do not adjust this number165 # become necessary for this use case. Please do not adjust this number
166 # upwards without agreement from bzr's network support maintainers.166 # upwards without agreement from bzr's network support maintainers.
167 self.assertLength(54, self.hpss_calls)167 self.assertLength(51, self.hpss_calls)
168168
169 def test_verify_commits(self):169 def test_verify_commits(self):
170 self.setup_smart_server_with_call_log()170 self.setup_smart_server_with_call_log()
171171
=== modified file 'bzrlib/tests/test_config.py'
--- bzrlib/tests/test_config.py 2011-12-09 16:15:52 +0000
+++ bzrlib/tests/test_config.py 2011-12-13 20:55:25 +0000
@@ -328,13 +328,13 @@
328328
329class FakeBranch(object):329class FakeBranch(object):
330330
331 def __init__(self, base=None, user_id=None):331 def __init__(self, base=None):
332 if base is None:332 if base is None:
333 self.base = "http://example.com/branches/demo"333 self.base = "http://example.com/branches/demo"
334 else:334 else:
335 self.base = base335 self.base = base
336 self._transport = self.control_files = \336 self._transport = self.control_files = \
337 FakeControlFilesAndTransport(user_id=user_id)337 FakeControlFilesAndTransport()
338338
339 def _get_config(self):339 def _get_config(self):
340 return config.TransportConfig(self._transport, 'branch.conf')340 return config.TransportConfig(self._transport, 'branch.conf')
@@ -348,16 +348,10 @@
348348
349class FakeControlFilesAndTransport(object):349class FakeControlFilesAndTransport(object):
350350
351 def __init__(self, user_id=None):351 def __init__(self):
352 self.files = {}352 self.files = {}
353 if user_id:
354 self.files['email'] = user_id
355 self._transport = self353 self._transport = self
356354
357 def get_utf8(self, filename):
358 # from LockableFiles
359 raise AssertionError("get_utf8 should no longer be used")
360
361 def get(self, filename):355 def get(self, filename):
362 # from Transport356 # from Transport
363 try:357 try:
@@ -1761,24 +1755,14 @@
1761 return my_config1755 return my_config
17621756
1763 def test_user_id(self):1757 def test_user_id(self):
1764 branch = FakeBranch(user_id='Robert Collins <robertc@example.net>')1758 branch = FakeBranch()
1765 my_config = config.BranchConfig(branch)1759 my_config = config.BranchConfig(branch)
1766 self.assertEqual("Robert Collins <robertc@example.net>",1760 self.assertIsNot(None, my_config.username())
1767 my_config.username())
1768 my_config.branch.control_files.files['email'] = "John"1761 my_config.branch.control_files.files['email'] = "John"
1769 my_config.set_user_option('email',1762 my_config.set_user_option('email',
1770 "Robert Collins <robertc@example.org>")1763 "Robert Collins <robertc@example.org>")
1771 self.assertEqual("John", my_config.username())
1772 del my_config.branch.control_files.files['email']
1773 self.assertEqual("Robert Collins <robertc@example.org>",1764 self.assertEqual("Robert Collins <robertc@example.org>",
1774 my_config.username())1765 my_config.username())
1775
1776 def test_not_set_in_branch(self):
1777 my_config = self.get_branch_config(global_config=sample_config_text)
1778 self.assertEqual(u"Erik B\u00e5gfors <erik@bagfors.nu>",
1779 my_config._get_user_id())
1780 my_config.branch.control_files.files['email'] = "John"
1781 self.assertEqual("John", my_config._get_user_id())
17821766
1783 def test_BZR_EMAIL_OVERRIDES(self):1767 def test_BZR_EMAIL_OVERRIDES(self):
1784 self.overrideEnv('BZR_EMAIL', "Robert Collins <robertc@example.org>")1768 self.overrideEnv('BZR_EMAIL', "Robert Collins <robertc@example.org>")
17851769
=== modified file 'doc/en/release-notes/bzr-2.5.txt'
--- doc/en/release-notes/bzr-2.5.txt 2011-12-12 13:44:20 +0000
+++ doc/en/release-notes/bzr-2.5.txt 2011-12-13 20:55:25 +0000
@@ -15,6 +15,10 @@
1515
16.. These may require users to change the way they use Bazaar.16.. These may require users to change the way they use Bazaar.
1717
18* The '.bzr/branch/email' file is no longer read to determine the users'
19 identity. Instead, the 'email' setting in '.bzr/branch/branch.conf'
20 should be used. (Jelmer Vernooij, #903894)
21
18New Features22New Features
19************23************
2024