~abentley/bzrtools/bzrtools.dev

« back to all changes in this revision

Viewing changes to conflicts.py

  • Committer: aaron.bentley at utoronto
  • Date: 2005-08-27 05:06:27 UTC
  • Revision ID: aaron.bentley@utoronto.ca-20050827050627-b1d857fa4d986f91
Added resolve command

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
 
17
17
import bzrlib.status
18
18
from bzrlib.branch import Branch
 
19
import os
 
20
import errno
19
21
 
20
22
SUFFIXES = ('.THIS', '.BASE', '.OTHER')
21
23
def get_conflicted_stem(path):
42
44
        for path in iter_conflicts(Branch('.').working_tree()):
43
45
            print path
44
46
 
 
47
class cmd_resolve(bzrlib.commands.Command):
 
48
    """Mark a conflict as resolved.
 
49
    """
 
50
    takes_args = ['file+']
 
51
    def run(self, file_list):
 
52
        for file in file_list:
 
53
            failures = 0
 
54
            for suffix in SUFFIXES:
 
55
                try:
 
56
                    os.unlink(file+suffix)
 
57
                except OSError, e:
 
58
                    if e.errno != errno.ENOENT:
 
59
                        raise
 
60
                    else:
 
61
                        failures += 1
 
62
            if failures == len(SUFFIXES):
 
63
                print "%s is not conflicted" % file
 
64
                        
 
65
            
 
66
 
45
67
# monkey-patch the standard 'status' to give us conflicts, too.
46
68
def _show_status(branch, **kwargs):
47
69
    old_show_status(branch, **kwargs)