~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/conflicts.py

  • Committer: Aaron Bentley
  • Date: 2006-03-10 18:32:58 UTC
  • mto: (2027.1.2 revert-subpath-56549)
  • mto: This revision was merged to the branch mainline in revision 1647.
  • Revision ID: abentley@panoramicfeedback.com-20060310183258-16ab2b131a6fa4d0
Revert does resolve

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
# TODO: 'bzr resolve' should accept a directory name and work from that 
20
20
# point down
21
21
 
22
 
# TODO: bzr revert should resolve; even when reverting the whole tree
23
 
# or particular directories
24
 
 
25
22
import os
26
23
import errno
27
24
 
89
86
        resolve(tree, file_list)
90
87
 
91
88
 
92
 
def resolve(tree, paths=None):
 
89
def resolve(tree, paths=None, ignore_misses=False):
93
90
    tree.lock_write()
94
91
    try:
95
92
        tree_conflicts = list(tree.conflict_lines())
98
95
            selected_conflicts = tree_conflicts
99
96
        else:
100
97
            new_conflicts, selected_conflicts = \
101
 
                select_conflicts(tree, paths, tree_conflicts)
 
98
                select_conflicts(tree, paths, tree_conflicts, ignore_misses)
102
99
        try:
103
100
            tree.set_conflict_lines(new_conflicts)
104
101
        except UnsupportedOperation:
108
105
        tree.unlock()
109
106
 
110
107
 
111
 
def select_conflicts(tree, paths, tree_conflicts):
 
108
def select_conflicts(tree, paths, tree_conflicts, ignore_misses=False):
112
109
    path_set = set(paths)
113
110
    ids = {}
114
111
    selected_paths = set()
145
142
            selected_conflicts.append(conflict)
146
143
        else:
147
144
            new_conflicts.append(conflict)
148
 
    for path in [p for p in paths if p not in selected_paths]:
149
 
        if not os.path.exists(tree.abspath(path)):
150
 
            print "%s does not exist" % path
151
 
        else:
152
 
            print "%s is not conflicted" % path
 
145
    if ignore_misses is not True:
 
146
        for path in [p for p in paths if p not in selected_paths]:
 
147
            if not os.path.exists(tree.abspath(path)):
 
148
                print "%s does not exist" % path
 
149
            else:
 
150
                print "%s is not conflicted" % path
153
151
    return new_conflicts, selected_conflicts
154
152
 
155
153
def remove_conflict_files(tree, conflicts):