changeset 6632:aa3f61884a48

convert.monotone: fix quotes and backslashes in change descriptions.
author David Reiss <davidn@gmail.com>
date Fri, 16 May 2008 00:48:23 -0700
parents a2b13cac0922
children 67a2d2d9bf21
files hgext/convert/monotone.py
diffstat 1 files changed, 6 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/convert/monotone.py	Thu May 29 22:21:29 2008 +0200
+++ b/hgext/convert/monotone.py	Fri May 16 00:48:23 2008 -0700
@@ -16,7 +16,7 @@
 
         # regular expressions for parsing monotone output
         space    = r'\s*'
-        name     = r'\s+"((?:[^"]|\\")*)"\s*'
+        name     = r'\s+"((?:\\"|[^"])*)"\s*'
         value    = name
         revision = r'\s+\[(\w+)\]\s*'
         lines    = r'(?:.|\n)+'
@@ -98,11 +98,14 @@
     def mtngetcerts(self, rev):
         certs = {"author":"<missing>", "date":"<missing>",
             "changelog":"<missing>", "branch":"<missing>"}
-        cert_list = self.mtnrun("certs", rev).split("\n\n")
+        cert_list = self.mtnrun("certs", rev).split('\n\n      key "')
         for e in cert_list:
             m = self.cert_re.match(e)
             if m:
-                certs[m.group(1)] = m.group(2)
+                name, value = m.groups()
+                value = value.replace(r'\"', '"')
+                value = value.replace(r'\\', '\\')
+                certs[name] = value
         return certs
 
     def mtnrenamefiles(self, files, fromdir, todir):