~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/conflicts.py

Merge from bzr.ab.integration

Show diffs side-by-side

added added

removed removed

Lines of Context:
26
26
import errno
27
27
 
28
28
import bzrlib.status
29
 
from bzrlib.branch import Branch
 
29
from bzrlib.commands import register_command
30
30
from bzrlib.errors import BzrCommandError, NotConflicted
31
 
from bzrlib.commands import register_command
32
 
from bzrlib.workingtree import CONFLICT_SUFFIXES
 
31
from bzrlib.option import Option
 
32
from bzrlib.workingtree import CONFLICT_SUFFIXES, WorkingTree
33
33
from bzrlib.osutils import rename
34
34
 
35
35
class cmd_conflicts(bzrlib.commands.Command):
36
36
    """List files with conflicts.
 
37
 
 
38
    Merge will do its best to combine the changes in two branches, but there
 
39
    are some kinds of problems only a human can fix.  When it encounters those,
 
40
    it will mark a conflict.  A conflict means that you need to fix something,
 
41
    before you should commit.
 
42
 
 
43
    Use bzr resolve when you have fixed a problem.
 
44
 
37
45
    (conflicts are determined by the presence of .BASE .TREE, and .OTHER 
38
46
    files.)
 
47
 
 
48
    See also bzr resolve.
39
49
    """
40
50
    def run(self):
41
 
        for path in Branch.open_containing(u'.')[0].working_tree().iter_conflicts():
 
51
        for path in WorkingTree.open_containing(u'.')[0].iter_conflicts():
42
52
            print path
43
53
 
44
54
class cmd_resolve(bzrlib.commands.Command):
45
55
    """Mark a conflict as resolved.
 
56
 
 
57
    Merge will do its best to combine the changes in two branches, but there
 
58
    are some kinds of problems only a human can fix.  When it encounters those,
 
59
    it will mark a conflict.  A conflict means that you need to fix something,
 
60
    before you should commit.
 
61
 
 
62
    Once you have fixed a problem, use "bzr resolve FILE.." to mark
 
63
    individual files as fixed, or "bzr resolve --all" to mark all conflicts as
 
64
    resolved.
 
65
 
 
66
    See also bzr conflicts.
46
67
    """
47
68
    aliases = ['resolved']
48
69
    takes_args = ['file*']
49
 
    takes_options = ['all']
 
70
    takes_options = [Option('all', help='Resolve all conflicts in this tree')]
50
71
    def run(self, file_list=None, all=False):
51
72
        if file_list is None:
52
73
            if not all:
53
74
                raise BzrCommandError(
54
75
                    "command 'resolve' needs one or more FILE, or --all")
55
 
            tree = Branch.open_containing(u'.')[0].working_tree()
 
76
            tree = WorkingTree.open_containing(u'.')[0]
56
77
            file_list = list(tree.abspath(f) for f in tree.iter_conflicts())
57
78
        else:
58
79
            if all: