Dsactivation de l'chappement des caractres 8bits dans darcs.
On utilise DARCS_DONT_ESCAPE_8BIT pour dire a darcs de ne pas echapper les caracteres 8bits. darcs-hash:20071209012351-af139-d8602216488842929727d3607c1827cacd27ded2.gz
This commit is contained in:
parent
4c1a71477a
commit
093598cd46
1 changed files with 5 additions and 20 deletions
|
@ -25,7 +25,7 @@
|
|||
Envoie un mail détaillant le dernier patch appliqué à un dépot.
|
||||
"""
|
||||
|
||||
import commands, os, sys, email, re, cStringIO
|
||||
import commands, os, sys, email
|
||||
|
||||
try:
|
||||
from lxml import etree
|
||||
|
@ -40,7 +40,7 @@ from unicode2ascii import unicode2ascii
|
|||
|
||||
def darcs(args):
|
||||
""" Invoque darcs et renvoie sa sortie. """
|
||||
return commands.getoutput("darcs " + args)
|
||||
return commands.getoutput("env DARCS_DONT_ESCAPE_8BIT=1 darcs " + args)
|
||||
|
||||
def get_patch_properties():
|
||||
""" Récupère les informations a propos du dernier patch. """
|
||||
|
@ -54,8 +54,8 @@ def get_patch_properties():
|
|||
'shortrepo': os.path.basename(cwd),
|
||||
'date': prop.attrib['local_date'],
|
||||
'hash': prop.attrib['hash'],
|
||||
'name': prop.findtext('name'),
|
||||
'comment': prop.findtext('comment'),
|
||||
'name': prop.findtext('name').encode("UTF-8"),
|
||||
'comment': prop.findtext('comment').encode("UTF-8"),
|
||||
'diff': diff,
|
||||
'changes': darcs("changes --match='hash %s' --summary" % hash) }
|
||||
|
||||
|
@ -69,20 +69,6 @@ Subject: Darcs record (%(shortrepo)s): %(name)s
|
|||
"""
|
||||
TEMPLATE_FILE = "_darcs/third-party/darcs-send-changes/email-template"
|
||||
|
||||
__darcs_escaped_re = re.compile('\\[_\\\\[0-9a-f][0-9a-f]_\\]')
|
||||
def darcs_unescape(str):
|
||||
""" Converti les séquences d'échappement de darcs en charactère unicode. """
|
||||
start = 0
|
||||
newstr = cStringIO.StringIO()
|
||||
s = __darcs_escaped_re.search(str, start)
|
||||
while s:
|
||||
newstr.write(str[start:s.start()])
|
||||
newstr.write(chr(int(str[s.start()+3:s.start()+5], 16)))
|
||||
start = s.end()
|
||||
s = __darcs_escaped_re.search(str, start)
|
||||
newstr.write(str[start:])
|
||||
return newstr.getvalue()
|
||||
|
||||
def send_changes(smtp, recipient, patch_props, template=DEFAULT_TEMPLATE):
|
||||
""" Formatte et envoie un mail avec les modifications sur le dernier
|
||||
patch appliqué au dépot.
|
||||
|
@ -100,8 +86,7 @@ peut contenir les variables suivantes:
|
|||
si template est None, DEFAULT_TEMPLATE est utilisé.
|
||||
"""
|
||||
patch_props["recipient"] = ", ".join(recipient)
|
||||
rawmail = darcs_unescape((template or DEFAULT_TEMPLATE) % patch_props)
|
||||
mail = email.message_from_string(rawmail)
|
||||
mail = email.message_from_string((template or DEFAULT_TEMPLATE) % patch_props)
|
||||
if not mail['Content-Transfer-Encoding']:
|
||||
mail['Content-Transfer-Encoding'] = 'quoted-printable'
|
||||
if not mail.get_charset():
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue