##// END OF EJS Templates
patch: fix git sendmail handling without proper mail headers
Patrick Mezard -
r5418:9b469bdb default
parent child Browse files
Show More
@@ -59,6 +59,7 b' def extract(ui, fileobj):'
59
59
60 subject = msg['Subject']
60 subject = msg['Subject']
61 user = msg['From']
61 user = msg['From']
62 gitsendmail = 'git-send-email' in msg.get('X-Mailer', '')
62 # should try to parse msg['Date']
63 # should try to parse msg['Date']
63 date = None
64 date = None
64 nodeid = None
65 nodeid = None
@@ -111,7 +112,7 b' def extract(ui, fileobj):'
111 nodeid = line[10:]
112 nodeid = line[10:]
112 elif line.startswith("# Parent "):
113 elif line.startswith("# Parent "):
113 parents.append(line[10:])
114 parents.append(line[10:])
114 elif line == '---' and 'git-send-email' in msg['X-Mailer']:
115 elif line == '---' and gitsendmail:
115 ignoretext = True
116 ignoretext = True
116 if not line.startswith('# ') and not ignoretext:
117 if not line.startswith('# ') and not ignoretext:
117 cfp.write(line)
118 cfp.write(line)
@@ -94,10 +94,11 b' hg --cwd b tip | grep second'
94 rm -r b
94 rm -r b
95
95
96 # subject: duplicate detection, removal of [PATCH]
96 # subject: duplicate detection, removal of [PATCH]
97 # The '---' tests the gitsendmail handling without proper mail headers
97 cat > mkmsg2.py <<EOF
98 cat > mkmsg2.py <<EOF
98 import email.Message, sys
99 import email.Message, sys
99 msg = email.Message.Message()
100 msg = email.Message.Message()
100 msg.set_payload('email patch\n\nnext line\n' + open('tip.patch').read())
101 msg.set_payload('email patch\n\nnext line\n---\n' + open('tip.patch').read())
101 msg['Subject'] = '[PATCH] email patch'
102 msg['Subject'] = '[PATCH] email patch'
102 msg['From'] = 'email patcher'
103 msg['From'] = 'email patcher'
103 sys.stdout.write(msg.as_string())
104 sys.stdout.write(msg.as_string())
@@ -111,6 +111,7 b' applying patch from stdin'
111 email patch
111 email patch
112
112
113 next line
113 next line
114 ---
114 % hg import in a subdirectory
115 % hg import in a subdirectory
115 requesting all changes
116 requesting all changes
116 adding changesets
117 adding changesets
General Comments 0
You need to be logged in to leave comments. Login now