Rev 62: Merge from trunk in file:///home/jelmer/bzr-submit/nowrap/

Jelmer Vernooij jelmer at samba.org
Wed Apr 11 15:24:29 BST 2007


At file:///home/jelmer/bzr-submit/nowrap/

------------------------------------------------------------
revno: 62
revision-id: jelmer at samba.org-20070411142424-8n2iy03yn6bmr0sh
parent: jelmer at samba.org-20070409153200-g8d83fg53tnbbfbr
parent: jelmer at samba.org-20070409153408-w669pmw6slksneh5
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: nowrap
timestamp: Wed 2007-04-11 16:24:24 +0200
message:
  Merge from trunk
added:
  .bzrignore                     bzrignore-20070409153230-9poel1aypla8k19r-1
modified:
  submit_helpers.py              submit_helpers.py-20060624164558-9aabyghnw7kxeuwg-2
  test_submit_bundle.py          test_submit_bundle.p-20070128205938-j61ty7zc1fxv9dba-1
    ------------------------------------------------------------
    revno: 59.1.5
    merged: jelmer at samba.org-20070409153408-w669pmw6slksneh5
    parent: jelmer at samba.org-20070409153242-02xxt9ycbgw0tz28
    committer: Jelmer Vernooij <jelmer at samba.org>
    branch nick: trunk
    timestamp: Mon 2007-04-09 17:34:08 +0200
    message:
      Move get_mailto() function out of BranchConfigSubmitBundle.
    ------------------------------------------------------------
    revno: 59.1.4
    merged: jelmer at samba.org-20070409153242-02xxt9ycbgw0tz28
    parent: jelmer at samba.org-20070407224628-xk7amkuat6y08vgk
    committer: Jelmer Vernooij <jelmer at samba.org>
    branch nick: trunk
    timestamp: Mon 2007-04-09 17:32:42 +0200
    message:
      Ignore tags files.
=== added file '.bzrignore'
--- a/.bzrignore	1970-01-01 00:00:00 +0000
+++ b/.bzrignore	2007-04-09 15:32:42 +0000
@@ -0,0 +1,1 @@
+tags

=== modified file 'submit_helpers.py'
--- a/submit_helpers.py	2007-04-09 15:32:00 +0000
+++ b/submit_helpers.py	2007-04-11 14:24:24 +0000
@@ -92,40 +92,40 @@
         password = self._get_user_option('smtp_password')
         return password
     
-    def get_mailto(self, predefined, target, remember, dry_run):
-        """Get the address where the message is sent to."""
-        mail_to = None
-        if predefined is None:
-            mail_to = self.get_submit_address(target)
+def get_mailto(config, predefined, target, remember, dry_run):
+    """Get the address where the message is sent to."""
+    mail_to = None
+    if predefined is None:
+        mail_to = config.get_submit_address(target)
+    else:
+        mail_to = predefined
+        
+    if remember and mail_to:
+        config.set_submit_address(predefined, target)
+    
+    # Neither predefined nor a default address
+    if not mail_to and dry_run:
+        if target in type_option_mappings:
+            if type_option_mappings[target] == 'submit-maintainer':
+                mail_to = "mailbot:bzr.plugins.submit--dry-run at localhost"
+            else:
+                mail_to = "mailto:bzr.plugins.submit--dry-run at localhost"
         else:
-            mail_to = predefined
-            
-        if remember and mail_to:
-            self.set_submit_address(predefined, target)
-        
-        # Neither predefined nor a default address
-        if not mail_to and dry_run:
-            if target in type_option_mappings:
-                if type_option_mappings[target] == 'submit-maintainer':
-                    mail_to = "mailbot:bzr.plugins.submit--dry-run at localhost"
-                else:
-                    mail_to = "mailto:bzr.plugins.submit--dry-run at localhost"
-            else:
-                mail_to = "bzr.plugins.submit--dry-run at localhost"
-        
-        # Still no address?
-        if not mail_to:
-            raise BzrCommandError("No mailto address set. Try supplying --address=devlist at example.com.")
-        
-        multipart = True
-        pqm = False
-        if mail_to.startswith("mailbot:"):
-            pqm = True
-            multipart = False
-            mail_to = mail_to[8:]
-        elif mail_to.startswith("mailto:"):
-            mail_to = mail_to[7:]
-        return (mail_to, multipart, pqm)
+            mail_to = "bzr.plugins.submit--dry-run at localhost"
+    
+    # Still no address?
+    if not mail_to:
+        raise BzrCommandError("No mailto address set. Try supplying --address=devlist at example.com.")
+    
+    multipart = True
+    pqm = False
+    if mail_to.startswith("mailbot:"):
+        pqm = True
+        multipart = False
+        mail_to = mail_to[8:]
+    elif mail_to.startswith("mailto:"):
+        mail_to = mail_to[7:]
+    return (mail_to, multipart, pqm)
 
 
 
@@ -295,13 +295,13 @@
         mail_from = config.username()
 
     try:
-        mail_to, multipart, pqm = config.get_mailto(address, target, 
+        mail_to, multipart, pqm = get_mailto(address, target, 
             remember, dry_run)
     except BzrCommandError:
         #Ugly hack
         import __init__
         __init__.read_options(branch)
-        mail_to, multipart, pqm = config.get_mailto(address, target, 
+        mail_to, multipart, pqm = get_mailto(address, target, 
             remember, dry_run)
     
     bundle_text = get_bundle_text(base, revision, remember)

=== modified file 'test_submit_bundle.py'
--- a/test_submit_bundle.py	2007-04-07 22:46:28 +0000
+++ b/test_submit_bundle.py	2007-04-09 15:34:08 +0000
@@ -23,7 +23,7 @@
 
 from bzrlib.plugins.submit import parse_submit_options
 from bzrlib.plugins.submit.submit_helpers import (BranchConfigSubmitBundle, 
-                                                  get_subject)
+                                                  get_mailto, get_subject)
 
 class TestParseSubmitOptions(TestCase):
     def test_simple(self):
@@ -90,18 +90,19 @@
     def test_get_mailto_no_address(self):
         """Make sure a BzrCommandError is raised if there is no address set."""
         self.assertRaises(BzrCommandError, 
-                lambda: self.config.get_mailto(None, None, False, False))
+                lambda: get_mailto(self.config, None, None, False, False))
 
     def test_get_mailto_remember(self):
         """Make sure remember works."""
         self.assertEquals(("foo at example.com", True, False),
-            self.config.get_mailto("foo at example.com", "default", True, False))
+            get_mailto(self.config, "foo at example.com", "default", 
+                                   True, False))
         self.assertEquals("foo at example.com", self.config.get_submit_address("default"))
 
     def test_get_mailto_noremember(self):
         """Make sure remember=False doesn't store anything."""
         self.assertEquals(("foo at example.com", True, False),
-            self.config.get_mailto("foo at example.com", "default", False, False))
+            get_mailto(self.config, "foo at example.com", "default", False, False))
         self.assertIs(None, self.config.get_submit_address("default"))
 
     def test_get_mailto_nopredefined(self):
@@ -109,19 +110,19 @@
         get_submit_address."""
         self.config.set_user_option("submit-address", "bar at example.com")
         self.assertEquals(("bar at example.com", True, False),
-            self.config.get_mailto(None, "default", False, False))
+            get_mailto(self.config, None, "default", False, False))
 
     def test_get_mailto_nopredefined(self):
         """Make sure get_mailto() strips mailto: prefixes."""
         self.assertEquals(("bar at example.com", True, False),
-            self.config.get_mailto("mailto:bar at example.com", "default", False, 
+            get_mailto(self.config, "mailto:bar at example.com", "default", False, 
                 False))
 
     def test_get_mailto_mailbot(self):
         """Make sure get_mailto() strips mailbot: prefixes and 
         returns the pqm setting correctly. """
         self.assertEquals(("bar at example.com", False, True),
-            self.config.get_mailto("mailbot:bar at example.com", "default", False, 
+           get_mailto(self.config, "mailbot:bar at example.com", "default", False, 
                 False))
 
 class TestGetSubject(TestCaseInTempDir):




More information about the bazaar-commits mailing list