changeset 9318:93a8be83ec09

merge backout of 5724cd7b3688
author Dirkjan Ochtman <dirkjan@ochtman.nl>
date Wed, 05 Aug 2009 16:32:57 +0200
parents 23cf7b52785a (diff) 8c1df18452aa (current diff)
children 8982eb292cb5
files
diffstat 7 files changed, 31 insertions(+), 27 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/color.py	Wed Aug 05 16:32:38 2009 +0200
+++ b/hgext/color.py	Wed Aug 05 16:32:57 2009 +0200
@@ -59,6 +59,7 @@
 '''
 
 import os, sys
+import itertools
 
 from mercurial import cmdutil, commands, extensions, error
 from mercurial.i18n import _
@@ -142,14 +143,10 @@
     '''run the qseries command with colored output'''
     ui.pushbuffer()
     retval = orig(ui, repo, **opts)
-    patches = ui.popbuffer().splitlines()
-    for patch in patches:
-        patchname = patch
-        if opts['summary']:
-            patchname = patchname.split(': ', 1)[0]
-        if ui.verbose:
-            patchname = patchname.lstrip().split(' ', 2)[-1]
+    patchlines = ui.popbuffer().splitlines()
+    patchnames = repo.mq.series
 
+    for patch, patchname in itertools.izip(patchlines, patchnames):
         if opts['missing']:
             effects = _patch_effects['missing']
         # Determine if patch is applied.
--- a/hgext/convert/subversion.py	Wed Aug 05 16:32:38 2009 +0200
+++ b/hgext/convert/subversion.py	Wed Aug 05 16:32:57 2009 +0200
@@ -311,7 +311,7 @@
             self.module += '/' + trunk
             self.head = self.latest(self.module, self.last_changed)
             if not self.head:
-                raise util.Abort(_('no revision found in module %s') 
+                raise util.Abort(_('no revision found in module %s')
                                  % self.module)
 
         # First head in the list is the module's head
@@ -454,8 +454,8 @@
                 # Here/tags/tag.1 discarded as well as its children.
                 # It happens with tools like cvs2svn. Such tags cannot
                 # be represented in mercurial.
-                addeds = dict((p, e.copyfrom_path) for p, e 
-                              in origpaths.iteritems() 
+                addeds = dict((p, e.copyfrom_path) for p, e
+                              in origpaths.iteritems()
                               if e.action == 'A' and e.copyfrom_path)
                 badroots = set()
                 for destroot in addeds:
--- a/hgext/notify.py	Wed Aug 05 16:32:38 2009 +0200
+++ b/hgext/notify.py	Wed Aug 05 16:32:57 2009 +0200
@@ -70,7 +70,7 @@
 
 from mercurial.i18n import _
 from mercurial import patch, cmdutil, templater, util, mail
-import email.Parser, fnmatch, socket, time
+import email.Parser, email.Errors, fnmatch, socket, time
 
 # template for single changeset can include email headers.
 single_template = '''
@@ -180,20 +180,25 @@
         '''send message.'''
 
         p = email.Parser.Parser()
-        msg = p.parsestr(data)
+        try:
+            msg = p.parsestr(data)
+        except email.Errors.MessageParseError, inst:
+            raise util.Abort(inst)
 
         # store sender and subject
         sender, subject = msg['From'], msg['Subject']
         del msg['From'], msg['Subject']
-        # store remaining headers
-        headers = msg.items()
-        # create fresh mime message from msg body
-        text = msg.get_payload()
-        # for notification prefer readability over data precision
-        msg = mail.mimeencode(self.ui, text, self.charsets, self.test)
-        # reinstate custom headers
-        for k, v in headers:
-            msg[k] = v
+
+        if not msg.is_multipart():
+            # create fresh mime message from scratch
+            # (multipart templates must take care of this themselves)
+            headers = msg.items()
+            payload = msg.get_payload()
+            # for notification prefer readability over data precision
+            msg = mail.mimeencode(self.ui, payload, self.charsets, self.test)
+            # reinstate custom headers
+            for k, v in headers:
+                msg[k] = v
 
         msg['Date'] = util.datestr(format="%a, %d %b %Y %H:%M:%S %1%2")
 
--- a/mercurial/demandimport.py	Wed Aug 05 16:32:38 2009 +0200
+++ b/mercurial/demandimport.py	Wed Aug 05 16:32:57 2009 +0200
@@ -81,7 +81,10 @@
 def _demandimport(name, globals=None, locals=None, fromlist=None, level=None):
     if not locals or name in ignore or fromlist == ('*',):
         # these cases we can't really delay
-        return _origimport(name, globals, locals, fromlist)
+        if level is None:
+            return _origimport(name, globals, locals, fromlist)
+        else:
+            return _origimport(name, globals, locals, fromlist, level)
     elif not fromlist:
         # import a [as b]
         if '.' in name: # a.b
--- a/mercurial/lsprof.py	Wed Aug 05 16:32:38 2009 +0200
+++ b/mercurial/lsprof.py	Wed Aug 05 16:32:57 2009 +0200
@@ -85,7 +85,7 @@
     try:
         mname = _fn2mod[code.co_filename]
     except KeyError:
-        for k, v in sys.modules.iteritems():
+        for k, v in list(sys.modules.iteritems()):
             if v is None:
                 continue
             if not hasattr(v, '__file__'):
--- a/mercurial/tags.py	Wed Aug 05 16:32:38 2009 +0200
+++ b/mercurial/tags.py	Wed Aug 05 16:32:57 2009 +0200
@@ -210,7 +210,7 @@
     # have no <tagnode>.  The cache is ordered from tip to oldest (which
     # is part of why <headrev> is there: a quick visual check is all
     # that's required to ensure correct order).
-    # 
+    #
     # This information is enough to let us avoid the most expensive part
     # of finding global tags, which is looking up <tagnode> in the
     # manifest for each head.
@@ -243,9 +243,8 @@
         return (None, None, tags, False)
     if cachefile:
         cachefile.close()               # ignore rest of file
-        
+
     repoheads = repo.heads()
-
     # Case 2 (uncommon): empty repo; get out quickly and don't bother
     # writing an empty cache.
     if repoheads == [nullid]:
--- a/mercurial/ui.py	Wed Aug 05 16:32:38 2009 +0200
+++ b/mercurial/ui.py	Wed Aug 05 16:32:57 2009 +0200
@@ -288,7 +288,7 @@
         """Prompt user with msg, read response, and ensure it matches
         one of the provided choices. The index of the choice is returned.
         choices is a sequence of acceptable responses with the format:
-        ('&None', 'E&xec', 'Sym&link') Responses are case insensitive. 
+        ('&None', 'E&xec', 'Sym&link') Responses are case insensitive.
         If ui is not interactive, the default is returned.
         """
         resps = [s[s.index('&')+1].lower() for s in choices]