comparison hgext/convert/monotone.py @ 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 b40e90341ae2
children 4a4c7f6a5912 087cc65bebff
comparison
equal deleted inserted replaced
6631:a2b13cac0922 6632:aa3f61884a48
14 self.ui = ui 14 self.ui = ui
15 self.path = path 15 self.path = path
16 16
17 # regular expressions for parsing monotone output 17 # regular expressions for parsing monotone output
18 space = r'\s*' 18 space = r'\s*'
19 name = r'\s+"((?:[^"]|\\")*)"\s*' 19 name = r'\s+"((?:\\"|[^"])*)"\s*'
20 value = name 20 value = name
21 revision = r'\s+\[(\w+)\]\s*' 21 revision = r'\s+\[(\w+)\]\s*'
22 lines = r'(?:.|\n)+' 22 lines = r'(?:.|\n)+'
23 23
24 self.dir_re = re.compile(space + "dir" + name) 24 self.dir_re = re.compile(space + "dir" + name)
96 return False 96 return False
97 97
98 def mtngetcerts(self, rev): 98 def mtngetcerts(self, rev):
99 certs = {"author":"<missing>", "date":"<missing>", 99 certs = {"author":"<missing>", "date":"<missing>",
100 "changelog":"<missing>", "branch":"<missing>"} 100 "changelog":"<missing>", "branch":"<missing>"}
101 cert_list = self.mtnrun("certs", rev).split("\n\n") 101 cert_list = self.mtnrun("certs", rev).split('\n\n key "')
102 for e in cert_list: 102 for e in cert_list:
103 m = self.cert_re.match(e) 103 m = self.cert_re.match(e)
104 if m: 104 if m:
105 certs[m.group(1)] = m.group(2) 105 name, value = m.groups()
106 value = value.replace(r'\"', '"')
107 value = value.replace(r'\\', '\\')
108 certs[name] = value
106 return certs 109 return certs
107 110
108 def mtnrenamefiles(self, files, fromdir, todir): 111 def mtnrenamefiles(self, files, fromdir, todir):
109 renamed = {} 112 renamed = {}
110 for tofile in files: 113 for tofile in files: