/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

  • Committer: Vincent Ladeuil
  • Date: 2011-07-06 09:22:00 UTC
  • mfrom: (6008 +trunk)
  • mto: (6012.1.1 trunk)
  • mto: This revision was merged to the branch mainline in revision 6013.
  • Revision ID: v.ladeuil+lp@free.fr-20110706092200-7iai2mwzc0sqdsvf
MergingĀ inĀ trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
25
25
 
26
26
from bzrlib import (
27
27
    cleanup,
28
 
    commands,
29
28
    errors,
30
29
    osutils,
31
30
    rio,
35
34
    )
36
35
""")
37
36
from bzrlib import (
 
37
    commands,
38
38
    option,
39
39
    registry,
40
40
    )
72
72
                    continue
73
73
                self.outf.write(conflict.path + '\n')
74
74
            else:
75
 
                self.outf.write(str(conflict) + '\n')
 
75
                self.outf.write(unicode(conflict) + '\n')
76
76
 
77
77
 
78
78
resolve_action_registry = registry.Registry()
148
148
                    trace.note('%d conflict(s) auto-resolved.', len(resolved))
149
149
                    trace.note('Remaining conflicts:')
150
150
                    for conflict in un_resolved:
151
 
                        trace.note(conflict)
 
151
                        trace.note(unicode(conflict))
152
152
                    return 1
153
153
                else:
154
154
                    trace.note('All conflicts resolved.')
291
291
    def to_strings(self):
292
292
        """Generate strings for the provided conflicts"""
293
293
        for conflict in self:
294
 
            yield str(conflict)
 
294
            yield unicode(conflict)
295
295
 
296
296
    def remove_files(self, tree):
297
297
        """Remove the THIS, BASE and OTHER files for listed conflicts"""
390
390
    def __ne__(self, other):
391
391
        return not self.__eq__(other)
392
392
 
393
 
    def __str__(self):
 
393
    def __unicode__(self):
394
394
        return self.format % self.__dict__
395
395
 
396
396
    def __repr__(self):
507
507
        if path_to_create is not None:
508
508
            tid = tt.trans_id_tree_path(path_to_create)
509
509
            transform.create_from_tree(
510
 
                tt, tt.trans_id_tree_path(path_to_create),
511
 
                self._revision_tree(tt._tree, revid), file_id)
 
510
                tt, tid, self._revision_tree(tt._tree, revid), file_id)
512
511
            tt.version_file(file_id, tid)
513
 
 
 
512
        else:
 
513
            tid = tt.trans_id_file_id(file_id)
514
514
        # Adjust the path for the retained file id
515
 
        tid = tt.trans_id_file_id(file_id)
516
515
        parent_tid = tt.get_tree_parent(tid)
517
516
        tt.adjust_path(osutils.basename(path), parent_tid, tid)
518
517
        tt.apply()
583
582
        :param tt: The TreeTransform where the conflict is resolved.
584
583
        :param suffix_to_remove: Either 'THIS' or 'OTHER'
585
584
 
586
 
        The resolution is symmetric, when taking THIS, OTHER is deleted and
 
585
        The resolution is symmetric: when taking THIS, OTHER is deleted and
587
586
        item.THIS is renamed into item and vice-versa.
588
587
        """
589
588
        try:
596
595
            # never existed or was already deleted (including the case
597
596
            # where the user deleted it)
598
597
            pass
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()
 
598
        try:
 
599
            this_path = tt._tree.id2path(self.file_id)
 
600
        except errors.NoSuchId:
 
601
            # The file is not present anymore. This may happen if the user
 
602
            # deleted the file either manually or when resolving a conflict on
 
603
            # the parent.  We may raise some exception to indicate that the
 
604
            # conflict doesn't exist anymore and as such doesn't need to be
 
605
            # resolved ? -- vila 20110615 
 
606
            this_tid = None
 
607
        else:
 
608
            this_tid = tt.trans_id_tree_path(this_path)
 
609
        if this_tid is not None:
 
610
            # Rename 'item.suffix_to_remove' (note that if
 
611
            # 'item.suffix_to_remove' has been deleted, this is a no-op)
 
612
            parent_tid = tt.get_tree_parent(this_tid)
 
613
            tt.adjust_path(osutils.basename(self.path), parent_tid, this_tid)
 
614
            tt.apply()
605
615
 
606
616
    def action_take_this(self, tree):
607
617
        self._resolve_with_cleanups(tree, 'OTHER')