~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/plugins/conflicts.py

  • Committer: Aaron Bentley
  • Date: 2005-10-04 04:32:32 UTC
  • mfrom: (1185.12.6)
  • mto: (1185.12.13)
  • mto: This revision was merged to the branch mainline in revision 1419.
  • Revision ID: aaron.bentley@utoronto.ca-20051004043231-40302a149769263b
merged my own changes

Show diffs side-by-side

added added

removed removed

Lines of Context:
14
14
# along with this program; if not, write to the Free Software
15
15
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
16
16
 
17
 
# TODO: Move this into builtins
18
 
 
19
 
# TODO: 'bzr resolve' should accept a directory name and work from that 
20
 
# point down
21
 
 
22
 
# TODO: bzr revert should resolve; even when reverting the whole tree
23
 
# or particular directories
24
 
 
25
 
import os
26
 
import errno
27
 
 
28
17
import bzrlib.status
29
18
from bzrlib.branch import Branch
30
19
from bzrlib.errors import BzrCommandError
31
20
from bzrlib.commands import register_command
32
21
from bzrlib.workingtree import CONFLICT_SUFFIXES
 
22
import os
 
23
import errno
33
24
 
34
25
class cmd_conflicts(bzrlib.commands.Command):
35
26
    """List files with conflicts.
37
28
    files.)
38
29
    """
39
30
    def run(self):
40
 
        for path in Branch.open_containing('.')[0].working_tree().iter_conflicts():
 
31
        for path in Branch.open_containing('.').working_tree().iter_conflicts():
41
32
            print path
42
33
 
 
34
register_command(cmd_conflicts)
 
35
 
43
36
class cmd_resolve(bzrlib.commands.Command):
44
37
    """Mark a conflict as resolved.
45
38
    """
50
43
            if not all:
51
44
                raise BzrCommandError(
52
45
                    "command 'resolve' needs one or more FILE, or --all")
53
 
            tree = Branch.open_containing('.')[0].working_tree()
 
46
            tree = Branch.open_containing('.').working_tree()
54
47
            file_list = list(tree.abspath(f) for f in tree.iter_conflicts())
55
48
        else:
56
49
            if all:
71
64
                    print "%s does not exist" % filename
72
65
                else:
73
66
                    print "%s is not conflicted" % filename
 
67
                        
 
68
register_command(cmd_resolve)
 
69
 
 
70
# monkey-patch the standard 'status' to give us conflicts, too.
 
71
def _show_status(branch, **kwargs):
 
72
    old_show_status(branch, **kwargs)
 
73
    conflicted = list(branch.working_tree().iter_conflicts())
 
74
    if len(conflicted) > 0:
 
75
        print "conflicts:"
 
76
        for f in conflicted:
 
77
            print " ", f
 
78
 
 
79
old_show_status = bzrlib.status.show_status
 
80
bzrlib.status.show_status = _show_status