Show More
@@ -17,7 +17,7 b' from bzr import bzr_source' | |||||
17 | from p4 import p4_source |
|
17 | from p4 import p4_source | |
18 | import filemap |
|
18 | import filemap | |
19 |
|
19 | |||
20 | import os, shutil |
|
20 | import os, shutil, shlex | |
21 | from mercurial import hg, util, encoding |
|
21 | from mercurial import hg, util, encoding | |
22 | from mercurial.i18n import _ |
|
22 | from mercurial.i18n import _ | |
23 |
|
23 | |||
@@ -142,26 +142,22 b' class converter(object):' | |||||
142 | if not line: |
|
142 | if not line: | |
143 | # Ignore blank lines |
|
143 | # Ignore blank lines | |
144 | continue |
|
144 | continue | |
145 |
|
|
145 | # split line | |
146 | child, parents = line.split(' ', 1) |
|
146 | lex = shlex.shlex(line, posix=True) | |
147 | self.source.checkrevformat(child) |
|
147 | lex.whitespace_split = True | |
148 | parents = parents.replace(',', ' ').split() |
|
148 | lex.whitespace += ',' | |
149 | # check if number of parents are upto 2 max |
|
149 | line = list(lex) | |
150 |
|
|
150 | # check number of parents | |
151 | raise util.Abort(_('syntax error in %s(%d): child '\ |
|
151 | if not (2 <= len(line) <= 3): | |
152 | 'parent1[,parent2] expected') \ |
|
152 | raise util.Abort(_('syntax error in %s(%d): child parent1' | |
153 |
|
|
153 | '[,parent2] expected') % (path, i + 1)) | |
154 |
|
|
154 | for part in line: | |
155 |
|
|
155 | self.source.checkrevformat(part) | |
156 | except ValueError: |
|
156 | child, p1, p2 = line[0], line[1:2], line[2:] | |
157 | raise util.Abort(_('syntax error in %s(%d): child '\ |
|
157 | if p1 == p2: | |
158 | 'parent1[,parent2] expected') \ |
|
158 | m[child] = p1 | |
159 | % (path, i + 1)) |
|
159 | else: | |
160 |
|
|
160 | m[child] = p1 + p2 | |
161 | for p in parents: |
|
|||
162 | if p not in pp: |
|
|||
163 | pp.append(p) |
|
|||
164 | m[child] = pp |
|
|||
165 | # if file does not exist or error reading, exit |
|
161 | # if file does not exist or error reading, exit | |
166 | except IOError: |
|
162 | except IOError: | |
167 | raise util.Abort(_('splicemap file not found or error reading %s:') |
|
163 | raise util.Abort(_('splicemap file not found or error reading %s:') |
General Comments 0
You need to be logged in to leave comments.
Login now