~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/conflicts.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2006-04-12 08:29:25 UTC
  • mfrom: (1652.1.3 bzr.mbp.integration)
  • Revision ID: pqm@pqm.ubuntu.com-20060412082925-f1988a4619180117
(olaf) fix resolve command in subdir; python logging shutdown

Show diffs side-by-side

added added

removed removed

Lines of Context:
54
54
        for conflict in wt.conflicts():
55
55
            print conflict
56
56
 
 
57
 
57
58
class cmd_resolve(bzrlib.commands.Command):
58
59
    """Mark a conflict as resolved.
59
60
 
73
74
    takes_options = [Option('all', help='Resolve all conflicts in this tree')]
74
75
    def run(self, file_list=None, all=False):
75
76
        from bzrlib.workingtree import WorkingTree
76
 
        if file_list is None:
77
 
            if not all:
78
 
                raise BzrCommandError(
79
 
                    "command 'resolve' needs one or more FILE, or --all")
 
77
        if all:
 
78
            if file_list:
 
79
                raise BzrCommandError("If --all is specified, no FILE may be provided")
 
80
            tree = WorkingTree.open_containing('.')[0]
 
81
            resolve(tree)
80
82
        else:
81
 
            if all:
82
 
                raise BzrCommandError(
83
 
                    "If --all is specified, no FILE may be provided")
84
 
        tree = WorkingTree.open_containing(u'.')[0]
85
 
        resolve(tree, file_list)
 
83
            if file_list is None:
 
84
                raise BzrCommandError("command 'resolve' needs one or more FILE, or --all")
 
85
            tree = WorkingTree.open_containing(file_list[0])[0]
 
86
            to_resolve = [tree.relpath(p) for p in file_list]
 
87
            resolve(tree, to_resolve)
86
88
 
87
89
 
88
90
def resolve(tree, paths=None, ignore_misses=False):
133
135
 
134
136
 
135
137
class ConflictList(object):
136
 
    """List of conflicts
 
138
    """List of conflicts.
 
139
 
 
140
    Typically obtained from WorkingTree.conflicts()
 
141
 
137
142
    Can be instantiated from stanzas or from Conflict subclasses.
138
143
    """
139
144
 
144
149
        else:
145
150
            self.__list = conflicts
146
151
 
 
152
    def is_empty(self):
 
153
        return len(self.__list) == 0
 
154
 
147
155
    def __len__(self):
148
156
        return len(self.__list)
149
157