Mercurial > hg
changeset 9325:74e717a21779
Merge with mpm
author | Bryan O'Sullivan <bos@serpentine.com> |
---|---|
date | Thu, 06 Aug 2009 18:48:00 -0700 |
parents | fb66a7d3f28f (diff) ac02b43bc08a (current diff) |
children | 9a69ab6d7cf7 |
files | hgext/mq.py hgext/notify.py mercurial/help.py mercurial/lsprof.py tests/test-mq-qimport.out |
diffstat | 8 files changed, 80 insertions(+), 15 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext/mq.py Mon Jul 27 18:38:20 2009 -0500 +++ b/hgext/mq.py Thu Aug 06 18:48:00 2009 -0700 @@ -105,6 +105,7 @@ message.append(line) format = None elif line == '# HG changeset patch': + message = [] format = "hgpatch" elif (format != "tagdone" and (line.startswith("Subject: ") or line.startswith("subject: "))):
--- a/hgext/notify.py Mon Jul 27 18:38:20 2009 -0500 +++ b/hgext/notify.py Thu Aug 06 18:48:00 2009 -0700 @@ -68,7 +68,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 = ''' @@ -178,20 +178,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 Mon Jul 27 18:38:20 2009 -0500 +++ b/mercurial/demandimport.py Thu Aug 06 18:48:00 2009 -0700 @@ -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 Mon Jul 27 18:38:20 2009 -0500 +++ b/mercurial/lsprof.py Thu Aug 06 18:48:00 2009 -0700 @@ -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/tests/test-mq-qimport Mon Jul 27 18:38:20 2009 -0500 +++ b/tests/test-mq-qimport Thu Aug 06 18:48:00 2009 -0700 @@ -27,6 +27,38 @@ echo % qimport non-existing-file hg qimport non-existing-file +echo % import email +hg qimport --push -n email - <<EOF +From: Username in email <test@example.net> +Subject: [PATCH] Message in email +Date: Fri, 02 Jan 1970 00:00:00 +0000 + +Text before patch. + +# HG changeset patch +# User Username in patch <test@example.net> +# Date 0 0 +# Node ID 1a706973a7d84cb549823634a821d9bdf21c6220 +# Parent 0000000000000000000000000000000000000000 +First line of commit message. + +More text in commit message. + +diff --git a/x b/x +new file mode 100644 +--- /dev/null ++++ b/x +@@ -0,0 +1,1 @@ ++new file +Text after patch. + +EOF + +echo % hg tip -v +hg tip -v +hg qpop +hg qdelete email + echo % import URL echo foo >> foo hg add foo
--- a/tests/test-mq-qimport.out Mon Jul 27 18:38:20 2009 -0500 +++ b/tests/test-mq-qimport.out Thu Aug 06 18:48:00 2009 -0700 @@ -1,5 +1,25 @@ % qimport non-existing-file abort: unable to read non-existing-file +% import email +adding email to series file +applying email +now at: email +% hg tip -v +changeset: 0:1a706973a7d8 +tag: qtip +tag: tip +tag: email +tag: qbase +user: Username in patch <test@example.net> +date: Thu Jan 01 00:00:00 1970 +0000 +files: x +description: +First line of commit message. + +More text in commit message. + + +patch queue now empty % import URL adding url.diff to series file url.diff
--- a/tests/test-repair-strip Mon Jul 27 18:38:20 2009 -0500 +++ b/tests/test-repair-strip Thu Aug 06 18:48:00 2009 -0700 @@ -13,7 +13,11 @@ chmod +$3 $4 hg verify echo % journal contents - cat .hg/store/journal | sed 's/\.i[^\n]*/\.i/' + if [ -f .hg/store/journal ]; then + sed -e 's/\.i[^\n]*/\.i/' .hg/store/journal + else + echo "(no journal)" + fi ls .hg/store/journal >/dev/null 2>&1 && hg recover ls .hg/strip-backup/* >/dev/null 2>&1 && hg unbundle -q .hg/strip-backup/* rm -rf .hg/strip-backup
--- a/tests/test-repair-strip.out Mon Jul 27 18:38:20 2009 -0500 +++ b/tests/test-repair-strip.out Thu Aug 06 18:48:00 2009 -0700 @@ -46,7 +46,7 @@ checking files 3 files, 4 changesets, 4 total revisions % journal contents -cat: .hg/store/journal: No such file or directory +(no journal) % before update 0, strip 2 changeset: 0:cb9a9f314b8b user: test