~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/conflicts.py

  • Committer: Martin von Gagern
  • Date: 2011-06-01 12:53:56 UTC
  • mto: This revision was merged to the branch mainline in revision 6009.
  • Revision ID: martin.vgagern@gmx.net-20110601125356-lwozv2vecea6hxfz
Change from no_decorate to classify as name for the argument.

The command line switch remains as --no-classify, to keep backwards
compatibility.  Users are free to include --no-classify in an alias, and
still use --classify to change back.

Show diffs side-by-side

added added

removed removed

Lines of Context:
32
32
    transform,
33
33
    workingtree,
34
34
    )
35
 
from bzrlib.i18n import gettext, ngettext
36
35
""")
37
36
from bzrlib import (
38
37
    commands,
121
120
    def run(self, file_list=None, all=False, action=None, directory=None):
122
121
        if all:
123
122
            if file_list:
124
 
                raise errors.BzrCommandError(gettext("If --all is specified,"
125
 
                                             " no FILE may be provided"))
 
123
                raise errors.BzrCommandError("If --all is specified,"
 
124
                                             " no FILE may be provided")
126
125
            if directory is None:
127
126
                directory = u'.'
128
127
            tree = workingtree.WorkingTree.open_containing(directory)[0]
146
145
            if file_list is None:
147
146
                un_resolved, resolved = tree.auto_resolve()
148
147
                if len(un_resolved) > 0:
149
 
                    trace.note(ngettext('%d conflict auto-resolved.',
150
 
                        '%d conflicts auto-resolved.', len(resolved)),
151
 
                        len(resolved))
152
 
                    trace.note(gettext('Remaining conflicts:'))
 
148
                    trace.note('%d conflict(s) auto-resolved.', len(resolved))
 
149
                    trace.note('Remaining conflicts:')
153
150
                    for conflict in un_resolved:
154
151
                        trace.note(unicode(conflict))
155
152
                    return 1
156
153
                else:
157
 
                    trace.note(gettext('All conflicts resolved.'))
 
154
                    trace.note('All conflicts resolved.')
158
155
                    return 0
159
156
            else:
160
157
                # FIXME: This can never occur but the block above needs some
163
160
                pass
164
161
        else:
165
162
            before, after = resolve(tree, file_list, action=action)
166
 
            trace.note(ngettext('{0} conflict resolved, {1} remaining',
167
 
                                '{0} conflicts resolved, {1} remaining',
168
 
                                before-after).format(before - after, after))
 
163
            trace.note('%d conflict(s) resolved, %d remaining'
 
164
                       % (before - after, after))
169
165
 
170
166
 
171
167
def resolve(tree, paths=None, ignore_misses=False, recursive=False,
511
507
        if path_to_create is not None:
512
508
            tid = tt.trans_id_tree_path(path_to_create)
513
509
            transform.create_from_tree(
514
 
                tt, tid, self._revision_tree(tt._tree, revid), file_id)
 
510
                tt, tt.trans_id_tree_path(path_to_create),
 
511
                self._revision_tree(tt._tree, revid), file_id)
515
512
            tt.version_file(file_id, tid)
516
 
        else:
517
 
            tid = tt.trans_id_file_id(file_id)
 
513
 
518
514
        # Adjust the path for the retained file id
 
515
        tid = tt.trans_id_file_id(file_id)
519
516
        parent_tid = tt.get_tree_parent(tid)
520
517
        tt.adjust_path(osutils.basename(path), parent_tid, tid)
521
518
        tt.apply()
586
583
        :param tt: The TreeTransform where the conflict is resolved.
587
584
        :param suffix_to_remove: Either 'THIS' or 'OTHER'
588
585
 
589
 
        The resolution is symmetric: when taking THIS, OTHER is deleted and
 
586
        The resolution is symmetric, when taking THIS, OTHER is deleted and
590
587
        item.THIS is renamed into item and vice-versa.
591
588
        """
592
589
        try:
599
596
            # never existed or was already deleted (including the case
600
597
            # where the user deleted it)
601
598
            pass
602
 
        try:
603
 
            this_path = tt._tree.id2path(self.file_id)
604
 
        except errors.NoSuchId:
605
 
            # The file is not present anymore. This may happen if the user
606
 
            # deleted the file either manually or when resolving a conflict on
607
 
            # the parent.  We may raise some exception to indicate that the
608
 
            # conflict doesn't exist anymore and as such doesn't need to be
609
 
            # resolved ? -- vila 20110615 
610
 
            this_tid = None
611
 
        else:
612
 
            this_tid = tt.trans_id_tree_path(this_path)
613
 
        if this_tid is not None:
614
 
            # Rename 'item.suffix_to_remove' (note that if
615
 
            # 'item.suffix_to_remove' has been deleted, this is a no-op)
616
 
            parent_tid = tt.get_tree_parent(this_tid)
617
 
            tt.adjust_path(osutils.basename(self.path), parent_tid, this_tid)
618
 
            tt.apply()
 
599
        # Rename 'item.suffix_to_remove' (note that if
 
600
        # 'item.suffix_to_remove' has been deleted, this is a no-op)
 
601
        this_tid = tt.trans_id_file_id(self.file_id)
 
602
        parent_tid = tt.get_tree_parent(this_tid)
 
603
        tt.adjust_path(osutils.basename(self.path), parent_tid, this_tid)
 
604
        tt.apply()
619
605
 
620
606
    def action_take_this(self, tree):
621
607
        self._resolve_with_cleanups(tree, 'OTHER')