Show More
@@ -120,6 +120,42 b' class converter(object):' | |||||
120 |
|
120 | |||
121 | self.splicemap = self.parsesplicemap(opts.get('splicemap')) |
|
121 | self.splicemap = self.parsesplicemap(opts.get('splicemap')) | |
122 | self.branchmap = mapfile(ui, opts.get('branchmap')) |
|
122 | self.branchmap = mapfile(ui, opts.get('branchmap')) | |
|
123 | self.closemap = self.parseclosemap(opts.get('closemap')) | |||
|
124 | ||||
|
125 | def parseclosemap(self, path): | |||
|
126 | """ check and validate the closemap format and | |||
|
127 | return a list of revs to close. | |||
|
128 | Format checking has two parts. | |||
|
129 | 1. generic format which is same across all source types | |||
|
130 | 2. specific format checking which may be different for | |||
|
131 | different source type. This logic is implemented in | |||
|
132 | checkrevformat function in source files like | |||
|
133 | hg.py, subversion.py etc. | |||
|
134 | """ | |||
|
135 | ||||
|
136 | if not path: | |||
|
137 | return [] | |||
|
138 | m = [] | |||
|
139 | try: | |||
|
140 | fp = open(path, 'r') | |||
|
141 | for i, line in enumerate(fp): | |||
|
142 | line = line.splitlines()[0].rstrip() | |||
|
143 | if not line: | |||
|
144 | # Ignore blank lines | |||
|
145 | continue | |||
|
146 | # split line | |||
|
147 | lex = shlex.shlex(line, posix=True) | |||
|
148 | lex.whitespace_split = True | |||
|
149 | lex.whitespace += ',' | |||
|
150 | line = list(lex) | |||
|
151 | for part in line: | |||
|
152 | self.source.checkrevformat(part, 'closemap') | |||
|
153 | m.extend(line) | |||
|
154 | # if file does not exist or error reading, exit | |||
|
155 | except IOError: | |||
|
156 | raise util.Abort(_('closemap file not found or error reading %s:') | |||
|
157 | % path) | |||
|
158 | return m | |||
123 |
|
159 | |||
124 | def parsesplicemap(self, path): |
|
160 | def parsesplicemap(self, path): | |
125 | """ check and validate the splicemap format and |
|
161 | """ check and validate the splicemap format and | |
@@ -408,6 +444,9 b' class converter(object):' | |||||
408 | except KeyError: |
|
444 | except KeyError: | |
409 | parents = [b[0] for b in pbranches] |
|
445 | parents = [b[0] for b in pbranches] | |
410 | source = progresssource(self.ui, self.source, len(files)) |
|
446 | source = progresssource(self.ui, self.source, len(files)) | |
|
447 | if self.closemap and rev in self.closemap: | |||
|
448 | commit.extra['close'] = 1 | |||
|
449 | ||||
411 | newnode = self.dest.putcommit(files, copies, parents, commit, |
|
450 | newnode = self.dest.putcommit(files, copies, parents, commit, | |
412 | source, self.map) |
|
451 | source, self.map) | |
413 | source.close() |
|
452 | source.close() |
General Comments 0
You need to be logged in to leave comments.
Login now