870
871
except StopIteration:
871
872
raise errors.MergeModifiedFormatError()
872
873
for s in RioReader(hashfile):
873
file_id = s.get("file_id")
874
# RioReader reads in Unicode, so convert file_ids back to utf8
875
file_id = osutils.safe_file_id(s.get("file_id"), warn=False)
874
876
if file_id not in self.inventory:
876
878
text_hash = s.get("hash")
2251
2253
if dir[2] == _directory:
2252
2254
pending.append(dir)
2256
@needs_tree_write_lock
2257
def auto_resolve(self):
2258
"""Automatically resolve text conflicts according to contents.
2260
Only text conflicts are auto_resolvable. Files with no conflict markers
2261
are considered 'resolved', because bzr always puts conflict markers
2262
into files that have text conflicts. The corresponding .THIS .BASE and
2263
.OTHER files are deleted, as per 'resolve'.
2264
:return: a tuple of ConflictLists: (un_resolved, resolved).
2266
un_resolved = _mod_conflicts.ConflictList()
2267
resolved = _mod_conflicts.ConflictList()
2268
conflict_re = re.compile('^(<{7}|={7}|>{7})')
2269
for conflict in self.conflicts():
2270
if (conflict.typestring != 'text conflict' or
2271
self.kind(conflict.file_id) != 'file'):
2272
un_resolved.append(conflict)
2274
my_file = open(self.id2abspath(conflict.file_id), 'rb')
2276
for line in my_file:
2277
if conflict_re.search(line):
2278
un_resolved.append(conflict)
2281
resolved.append(conflict)
2284
resolved.remove_files(self)
2285
self.set_conflicts(un_resolved)
2286
return un_resolved, resolved
2255
2289
class WorkingTree2(WorkingTree):
2256
2290
"""This is the Format 2 working tree.