/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: Canonical.com Patch Queue Manager
  • Date: 2011-06-15 14:09:12 UTC
  • mfrom: (5972.1.2 788000-take-other)
  • Revision ID: pqm@pqm.ubuntu.com-20110615140912-gt861n592ieglfe9
(vila) Make ContentConflict resolution more robust (Vincent Ladeuil)

Show diffs side-by-side

added added

removed removed

Lines of Context:
583
583
        :param tt: The TreeTransform where the conflict is resolved.
584
584
        :param suffix_to_remove: Either 'THIS' or 'OTHER'
585
585
 
586
 
        The resolution is symmetric, when taking THIS, OTHER is deleted and
 
586
        The resolution is symmetric: when taking THIS, OTHER is deleted and
587
587
        item.THIS is renamed into item and vice-versa.
588
588
        """
589
589
        try:
596
596
            # never existed or was already deleted (including the case
597
597
            # where the user deleted it)
598
598
            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()
 
599
        try:
 
600
            this_path = tt._tree.id2path(self.file_id)
 
601
        except errors.NoSuchId:
 
602
            # The file is not present anymore. This may happen if the user
 
603
            # deleted the file either manually or when resolving a conflict on
 
604
            # the parent.  We may raise some exception to indicate that the
 
605
            # conflict doesn't exist anymore and as such doesn't need to be
 
606
            # resolved ? -- vila 20110615 
 
607
            this_tid = None
 
608
        else:
 
609
            this_tid = tt.trans_id_tree_path(this_path)
 
610
        if this_tid is not None:
 
611
            # Rename 'item.suffix_to_remove' (note that if
 
612
            # 'item.suffix_to_remove' has been deleted, this is a no-op)
 
613
            parent_tid = tt.get_tree_parent(this_tid)
 
614
            tt.adjust_path(osutils.basename(self.path), parent_tid, this_tid)
 
615
            tt.apply()
605
616
 
606
617
    def action_take_this(self, tree):
607
618
        self._resolve_with_cleanups(tree, 'OTHER')