/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/conflicts.py

comment about the change in the bundled copy of configobj

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2005, 2006, 2007, 2009, 2010 Canonical Ltd
 
1
# Copyright (C) 2005, 2006, 2007, 2009, 2010, 2011 Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
59
59
    Use bzr resolve when you have fixed a problem.
60
60
    """
61
61
    takes_options = [
 
62
            'directory',
62
63
            option.Option('text',
63
64
                          help='List paths of files with text conflicts.'),
64
65
        ]
65
66
    _see_also = ['resolve', 'conflict-types']
66
67
 
67
 
    def run(self, text=False):
68
 
        wt = workingtree.WorkingTree.open_containing(u'.')[0]
 
68
    def run(self, text=False, directory=u'.'):
 
69
        wt = workingtree.WorkingTree.open_containing(directory)[0]
69
70
        for conflict in wt.conflicts():
70
71
            if text:
71
72
                if conflict.typestring != 'text conflict':
112
113
    aliases = ['resolved']
113
114
    takes_args = ['file*']
114
115
    takes_options = [
 
116
            'directory',
115
117
            option.Option('all', help='Resolve all conflicts in this tree.'),
116
118
            ResolveActionOption(),
117
119
            ]
118
120
    _see_also = ['conflicts']
119
 
    def run(self, file_list=None, all=False, action=None):
 
121
    def run(self, file_list=None, all=False, action=None, directory=u'.'):
120
122
        if all:
121
123
            if file_list:
122
124
                raise errors.BzrCommandError("If --all is specified,"
123
125
                                             " no FILE may be provided")
124
 
            tree = workingtree.WorkingTree.open_containing('.')[0]
 
126
            tree = workingtree.WorkingTree.open_containing(directory)[0]
125
127
            if action is None:
126
128
                action = 'done'
127
129
        else:
502
504
        # Adjust the path for the retained file id
503
505
        tid = tt.trans_id_file_id(file_id)
504
506
        parent_tid = tt.get_tree_parent(tid)
505
 
        tt.adjust_path(path, parent_tid, tid)
 
507
        tt.adjust_path(osutils.basename(path), parent_tid, tid)
506
508
        tt.apply()
507
509
 
508
510
    def _revision_tree(self, tree, revid):
588
590
        # 'item.suffix_to_remove' has been deleted, this is a no-op)
589
591
        this_tid = tt.trans_id_file_id(self.file_id)
590
592
        parent_tid = tt.get_tree_parent(this_tid)
591
 
        tt.adjust_path(self.path, parent_tid, this_tid)
 
593
        tt.adjust_path(osutils.basename(self.path), parent_tid, this_tid)
592
594
        tt.apply()
593
595
 
594
596
    def action_take_this(self, tree):
598
600
        self._resolve_with_cleanups(tree, 'THIS')
599
601
 
600
602
 
601
 
# FIXME: TextConflict is about a single file-id, there never is a conflict_path
602
 
# attribute so we shouldn't inherit from PathConflict but simply from Conflict
603
 
 
604
603
# TODO: There should be a base revid attribute to better inform the user about
605
604
# how the conflicts were generated.
606
 
class TextConflict(PathConflict):
 
605
class TextConflict(Conflict):
607
606
    """The merge algorithm could not resolve all differences encountered."""
608
607
 
609
608
    has_files = True
612
611
 
613
612
    format = 'Text conflict in %(path)s'
614
613
 
 
614
    rformat = '%(class)s(%(path)r, %(file_id)r)'
 
615
 
615
616
    def associated_filenames(self):
616
617
        return [self.path + suffix for suffix in CONFLICT_SUFFIXES]
617
618