29
29
from bzrlib.commands import register_command
30
30
from bzrlib.errors import BzrCommandError, NotConflicted
31
31
from bzrlib.option import Option
32
from bzrlib.osutils import rename
33
from bzrlib.rio import Stanza
32
34
from bzrlib.workingtree import CONFLICT_SUFFIXES, WorkingTree
33
from bzrlib.osutils import rename
35
36
class cmd_conflicts(bzrlib.commands.Command):
36
37
"""List files with conflicts.
122
123
if not conflicted:
123
124
raise NotConflicted(filename)
127
def conflict_stanzas(conflicts):
128
for conflict in conflicts:
129
if conflict[0] in ('text conflict', 'path conflict',
130
'contents conflict'):
131
s = Stanza(type=conflict[0], path=conflict[2])
132
if conflict[1] is not None:
133
s.add('file_id', conflict[1])
136
mydict = {'type': conflict[0], 'action': conflict[1],
138
if conflict[3] is not None:
139
mydict['file_id'] = conflict[3]
140
if len(conflict) > 4:
141
mydict['conflict_path'] = conflict[4]
142
if conflict[5] is not None:
143
mydict['conflict_file_id'] = conflict[5]
144
yield Stanza(**mydict)
146
def stanza_conflicts(stanzas):
147
for stanza in stanzas:
149
file_id = stanza['file_id']
153
conflict_file_id = stanza['conflict_file_id']
155
conflict_file_id = None
156
if stanza.get('type') in ('text conflict', 'path conflict',
157
'contents conflict'):
158
yield (stanza['type'], file_id, stanza['path'])
160
my_list = [stanza['type'], stanza['action'],
161
stanza['path'], file_id]
163
my_list.extend((stanza['conflict_path'], conflict_file_id))