Rev 5620: (jelmer) Print error when both --email and a new identity are specified to in file:///home/pqm/archives/thelove/bzr/%2Btrunk/

Canonical.com Patch Queue Manager pqm at pqm.ubuntu.com
Wed Jan 19 06:56:27 UTC 2011


At file:///home/pqm/archives/thelove/bzr/%2Btrunk/

------------------------------------------------------------
revno: 5620 [merge]
revision-id: pqm at pqm.ubuntu.com-20110119065626-z6yj3e3xcfhg5jmv
parent: pqm at pqm.ubuntu.com-20110119015019-rjy0csgtwo4ohi0i
parent: jelmer at samba.org-20110119061358-qm58pzvcp2l9cdx4
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Wed 2011-01-19 06:56:26 +0000
message:
  (jelmer) Print error when both --email and a new identity are specified to
   'bzr whoami'. (Jelmer Vernooij)
modified:
  bzrlib/builtins.py             builtins.py-20050830033751-fc01482b9ca23183
  bzrlib/tests/blackbox/test_whoami.py test_whoami.py-20060629025641-8h3m2ch7kutqx7ug-1
  doc/en/release-notes/bzr-2.4.txt bzr2.4.txt-20110114053217-k7ym9jfz243fddjm-1
=== modified file 'bzrlib/builtins.py'
--- a/bzrlib/builtins.py	2011-01-12 01:01:53 +0000
+++ b/bzrlib/builtins.py	2011-01-18 22:30:23 +0000
@@ -3425,6 +3425,10 @@
                 self.outf.write(c.username() + '\n')
             return
 
+        if email:
+            raise errors.BzrCommandError("--email can only be used to display existing "
+                                         "identity")
+
         # display a warning if an email address isn't included in the given name.
         try:
             _mod_config.extract_email_address(name)

=== modified file 'bzrlib/tests/blackbox/test_whoami.py'
--- a/bzrlib/tests/blackbox/test_whoami.py	2011-01-10 22:20:12 +0000
+++ b/bzrlib/tests/blackbox/test_whoami.py	2011-01-18 22:30:23 +0000
@@ -17,11 +17,8 @@
 
 """Black-box tests for bzr whoami."""
 
-import os
-
 import bzrlib
 from bzrlib import (
-    osutils,
     config,
     )
 from bzrlib.tests import TestCaseWithTransport
@@ -39,6 +36,11 @@
         self.assertTrue(len(out) > 0)
         self.assertEquals(1, out.count('@'))
 
+    def test_whoami_email_arg(self):
+        # whoami --email is mutually exclusive with any arguments
+        out = self.run_bzr("whoami --email 'foo <foo at example.com>'", 3)[0]
+        self.assertEquals("", out)
+
     def test_whoami_branch(self):
         """branch specific user identity works."""
         wt = self.make_branch_and_tree('.')

=== modified file 'doc/en/release-notes/bzr-2.4.txt'
--- a/doc/en/release-notes/bzr-2.4.txt	2011-01-19 01:03:43 +0000
+++ b/doc/en/release-notes/bzr-2.4.txt	2011-01-19 06:13:58 +0000
@@ -45,6 +45,9 @@
   Launhcpad without requiring the target branch to be specified. (Jelmer Vernooij,
   #704647)
 
+* ``bzr whoami`` will now display an error if both a new identity and ``--email``
+  were specified. (Jelmer Vernooij, #680449)
+
 Documentation
 *************
 




More information about the bazaar-commits mailing list