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