~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/conflicts.py

  • Committer: Vincent Ladeuil
  • Date: 2010-11-07 16:09:43 UTC
  • mto: (4597.14.1 638451-malformed)
  • mto: This revision was merged to the branch mainline in revision 5537.
  • Revision ID: v.ladeuil+lp@free.fr-20101107160943-qkz45h4pb748117i
resolve now reports conflicts resolved/remaining.

Show diffs side-by-side

added added

removed removed

Lines of Context:
159
159
                # conflict.auto(tree) --vila 091242
160
160
                pass
161
161
        else:
162
 
            resolve(tree, file_list, action=action)
 
162
            before, after = resolve(tree, file_list, action=action)
 
163
            trace.note('%d conflict(s) resolved, %d remaining'
 
164
                       % (before - after, after))
163
165
 
164
166
 
165
167
def resolve(tree, paths=None, ignore_misses=False, recursive=False,
178
180
    :param action: How the conflict should be resolved,
179
181
    """
180
182
    tree.lock_tree_write()
 
183
    nb_conflicts_after = None
181
184
    try:
182
185
        tree_conflicts = tree.conflicts()
 
186
        nb_conflicts_before = len(tree_conflicts)
183
187
        if paths is None:
184
188
            new_conflicts = ConflictList()
185
189
            to_process = tree_conflicts
193
197
            except NotImplementedError:
194
198
                new_conflicts.append(conflict)
195
199
        try:
 
200
            nb_conflicts_after = len(new_conflicts)
196
201
            tree.set_conflicts(new_conflicts)
197
202
        except errors.UnsupportedOperation:
198
203
            pass
199
204
    finally:
200
205
        tree.unlock()
 
206
    if nb_conflicts_after is None:
 
207
        nb_conflicts_after = nb_conflicts_before
 
208
    return nb_conflicts_before, nb_conflicts_after
201
209
 
202
210
 
203
211
def restore(filename):