Show More
@@ -117,15 +117,9 b' class mergestate(object):' | |||
|
117 | 117 | returns list of record [(TYPE, data), ...]""" |
|
118 | 118 | v1records = self._readrecordsv1() |
|
119 | 119 | v2records = self._readrecordsv2() |
|
120 | oldv2 = set() # old format version of v2 record | |
|
121 |
|
|
|
122 | if rec[0] == 'L': | |
|
123 | oldv2.add(rec) | |
|
124 | elif rec[0] == 'F': | |
|
125 | # drop the onode data (not contained in v1) | |
|
126 | oldv2.add(('F', _droponode(rec[1]))) | |
|
127 | for rec in v1records: | |
|
128 | if rec not in oldv2: | |
|
120 | if self._v1v2match(v1records, v2records): | |
|
121 | return v2records | |
|
122 | else: | |
|
129 | 123 |
|
|
130 | 124 |
|
|
131 | 125 |
|
@@ -140,8 +134,20 b' class mergestate(object):' | |||
|
140 | 134 |
|
|
141 | 135 |
|
|
142 | 136 |
|
|
137 | ||
|
138 | def _v1v2match(self, v1records, v2records): | |
|
139 | oldv2 = set() # old format version of v2 record | |
|
140 | for rec in v2records: | |
|
141 | if rec[0] == 'L': | |
|
142 | oldv2.add(rec) | |
|
143 | elif rec[0] == 'F': | |
|
144 | # drop the onode data (not contained in v1) | |
|
145 | oldv2.add(('F', _droponode(rec[1]))) | |
|
146 | for rec in v1records: | |
|
147 | if rec not in oldv2: | |
|
148 | return False | |
|
143 | 149 | else: |
|
144 |
return |
|
|
150 | return True | |
|
145 | 151 | |
|
146 | 152 | def _readrecordsv1(self): |
|
147 | 153 | """read on disk merge state for version 1 file |
General Comments 0
You need to be logged in to leave comments.
Login now