~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/conflicts.py

  • Committer: Jelmer Vernooij
  • Date: 2011-05-16 13:39:39 UTC
  • mto: (5923.1.1 trunk)
  • mto: This revision was merged to the branch mainline in revision 5925.
  • Revision ID: jelmer@samba.org-20110516133939-8u1pc9utas3uw1lt
Require a unicode prompt to be passed into all methods that prompt.

Show diffs side-by-side

added added

removed removed

Lines of Context:
25
25
 
26
26
from bzrlib import (
27
27
    cleanup,
 
28
    commands,
28
29
    errors,
29
30
    osutils,
30
31
    rio,
34
35
    )
35
36
""")
36
37
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(unicode(conflict) + '\n')
 
75
                self.outf.write(str(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(unicode(conflict))
 
151
                        trace.note(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 unicode(conflict)
 
294
            yield str(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 __unicode__(self):
 
393
    def __str__(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, 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)
511
512
            tt.version_file(file_id, tid)
512
 
        else:
513
 
            tid = tt.trans_id_file_id(file_id)
 
513
 
514
514
        # Adjust the path for the retained file id
 
515
        tid = tt.trans_id_file_id(file_id)
515
516
        parent_tid = tt.get_tree_parent(tid)
516
517
        tt.adjust_path(osutils.basename(path), parent_tid, tid)
517
518
        tt.apply()
582
583
        :param tt: The TreeTransform where the conflict is resolved.
583
584
        :param suffix_to_remove: Either 'THIS' or 'OTHER'
584
585
 
585
 
        The resolution is symmetric: when taking THIS, OTHER is deleted and
 
586
        The resolution is symmetric, when taking THIS, OTHER is deleted and
586
587
        item.THIS is renamed into item and vice-versa.
587
588
        """
588
589
        try:
595
596
            # never existed or was already deleted (including the case
596
597
            # where the user deleted it)
597
598
            pass
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()
 
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()
615
605
 
616
606
    def action_take_this(self, tree):
617
607
        self._resolve_with_cleanups(tree, 'OTHER')