~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/merge.py

  • Committer: Aaron Bentley
  • Date: 2005-10-24 17:42:46 UTC
  • mto: (1185.25.1)
  • mto: This revision was merged to the branch mainline in revision 1488.
  • Revision ID: abentley@panoramicfeedback.com-20051024174246-7b1be2b168413272
Handled conflicts with versioned files better

Show diffs side-by-side

added added

removed removed

Lines of Context:
28
28
from bzrlib.changeset import Inventory, Diff3Merge, ReplaceContents
29
29
from bzrlib.branch import Branch
30
30
from bzrlib.errors import BzrCommandError, UnrelatedBranches, NoCommonAncestor
31
 
from bzrlib.errors import NoCommits, WorkingTreeNotRevision
 
31
from bzrlib.errors import NoCommits, WorkingTreeNotRevision, NotBranchError
32
32
from bzrlib.delta import compare_trees
33
33
from bzrlib.trace import mutter, warning, note
34
34
from bzrlib.fetch import greedy_fetch, fetch
99
99
        new_name = last_new_name+suffix
100
100
        try:
101
101
            rename(name, new_name)
102
 
            return new_name
 
102
            try:
 
103
                relpath = self.this_tree.relpath(name)
 
104
            except NotBranchError:
 
105
                relpath = None
 
106
            if relpath is not None:
 
107
                file_id = self.this_tree.path2id(relpath)
 
108
                if file_id is not None:
 
109
                    new_path = self.this_tree.relpath(new_name)
 
110
                    rename(new_name, name)
 
111
                    self.this_tree.branch.rename_one(relpath, new_path)
 
112
                    assert self.this_tree.id2path(file_id) == relpath
 
113
                    self.this_tree._inventory = self.this_tree.branch.inventory
 
114
                    assert self.this_tree.id2path(file_id) == new_path
103
115
        except OSError, e:
104
116
            if e.errno != errno.EEXIST and e.errno != errno.ENOTEMPTY:
105
117
                raise
106
118
            return self.add_suffix(name, suffix, last_new_name=new_name)
 
119
        return new_name
107
120
 
108
121
    def conflict(self, text):
109
122
        warning(text)