1940
1941
file_id=self.path2id(conflicted)))
1941
1942
return conflicts
1944
@needs_tree_write_lock
1945
def auto_resolve(self):
1946
"""Automatically resolve text conflicts according to contents.
1948
Only text conflicts are auto_resolvable. Files with no conflict markers
1949
are considered 'resolved', because bzr always puts conflict markers
1950
into files that have text conflicts. The corresponding .THIS .BASE and
1951
.OTHER files are deleted, as per 'resolve'.
1952
:return: a tuple of ConflictLists: (un_resolved, resolved).
1954
un_resolved = _mod_conflicts.ConflictList()
1955
resolved = _mod_conflicts.ConflictList()
1956
conflict_re = re.compile('^(<{7}|={7}|>{7})')
1957
for conflict in self.conflicts():
1958
if (conflict.typestring != 'text conflict' or
1959
self.kind(conflict.file_id) != 'file'):
1960
un_resolved.append(conflict)
1962
my_file = open(self.id2abspath(conflict.file_id), 'rb')
1964
for line in my_file:
1965
if conflict_re.search(line):
1966
un_resolved.append(conflict)
1969
resolved.append(conflict)
1972
resolved.remove_files(self)
1973
self.set_conflicts(un_resolved)
1974
return un_resolved, resolved
1944
1977
class WorkingTree2(WorkingTree):
1945
1978
"""This is the Format 2 working tree.