1151
1151
def cook_conflicts(raw_conflicts, tt):
1152
1152
"""Generate a list of cooked conflicts, sorted by file path"""
1153
1153
def key(conflict):
1154
if conflict[2] is not None:
1155
return conflict[2], conflict[0]
1156
elif len(conflict) == 6:
1157
return conflict[4], conflict[0]
1154
if conflict.path is not None:
1155
return conflict.path, conflict.typestring
1156
elif getattr(conflict, "conflict_path", None) is not None:
1157
return conflict.conflict_path, conflict.typestring
1159
return None, conflict[0]
1159
return None, conflict.typestring
1161
1161
return sorted(list(iter_cook_conflicts(raw_conflicts, tt)), key=key)
1185
1185
def conflicts_strings(conflicts):
1186
1186
"""Generate strings for the provided conflicts"""
1187
1187
for conflict in conflicts:
1188
conflict_type = conflict[0]
1189
if conflict_type == 'text conflict':
1190
yield 'Text conflict in %s' % conflict[2]
1191
elif conflict_type == 'contents conflict':
1192
yield 'Contents conflict in %s' % conflict[2]
1193
elif conflict_type == 'path conflict':
1194
yield 'Path conflict: %s / %s' % conflict[2:]
1195
elif conflict_type == 'duplicate id':
1196
vals = (conflict[4], conflict[1], conflict[2])
1197
yield 'Conflict adding id to %s. %s %s.' % vals
1198
elif conflict_type == 'duplicate':
1199
vals = (conflict[4], conflict[1], conflict[2])
1200
yield 'Conflict adding file %s. %s %s.' % vals
1201
elif conflict_type == 'parent loop':
1202
vals = (conflict[4], conflict[2], conflict[1])
1203
yield 'Conflict moving %s into %s. %s.' % vals
1204
elif conflict_type == 'unversioned parent':
1205
vals = (conflict[2], conflict[1])
1206
yield 'Conflict adding versioned files to %s. %s.' % vals
1207
elif conflict_type == 'missing parent':
1208
vals = (conflict[2], conflict[1])
1209
yield 'Conflict adding files to %s. %s.' % vals