~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/merge.py

  • Committer: Aaron Bentley
  • Date: 2005-09-29 21:07:17 UTC
  • mfrom: (1393.1.6)
  • mto: (1185.25.1)
  • mto: This revision was merged to the branch mainline in revision 1419.
  • Revision ID: abentley@panoramicfeedback.com-20050929210717-cd73981590f17017
Merged the weave changes

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
import tempfile
20
20
import shutil
21
21
import errno
22
 
from fetch import greedy_fetch
23
22
 
24
23
import bzrlib.osutils
25
24
import bzrlib.revision
31
30
from bzrlib.errors import NoCommits
32
31
from bzrlib.delta import compare_trees
33
32
from bzrlib.trace import mutter, warning
34
 
from bzrlib.fetch import greedy_fetch
 
33
from bzrlib.fetch import greedy_fetch, fetch
35
34
from bzrlib.revision import is_ancestor
 
35
from bzrlib.osutils import rename
 
36
from bzrlib.revision import common_ancestor, MultipleRevisionSources
 
37
from bzrlib.errors import NoSuchRevision
 
38
 
36
39
 
37
40
# comments from abentley on irc: merge happens in two stages, each
38
41
# of which generates a changeset object
84
87
            last_new_name = name
85
88
        new_name = last_new_name+suffix
86
89
        try:
87
 
            os.rename(name, new_name)
 
90
            rename(name, new_name)
88
91
            return new_name
89
92
        except OSError, e:
90
93
            if e.errno != errno.EEXIST and e.errno != errno.ENOTEMPTY:
108
111
        self.add_suffix(this_path, ".THIS")
109
112
        self.dump(base_lines, this_path+".BASE")
110
113
        self.dump(other_lines, this_path+".OTHER")
111
 
        os.rename(new_file, this_path)
 
114
        rename(new_file, this_path)
112
115
        self.conflict("Diff3 conflict encountered in %s" % this_path)
113
116
 
114
117
    def new_contents_conflict(self, filename, other_contents):
143
146
    if revno is None:
144
147
        revision = None
145
148
    elif revno == -1:
146
 
        revision = branch.last_patch()
 
149
        revision = branch.last_revision()
147
150
    else:
148
151
        revision = branch.get_rev_id(revno)
149
152
    return branch, get_revid_tree(branch, revision, temp_root, label,
240
243
    check_clean
241
244
        If true, this_dir must have no uncommitted changes before the
242
245
        merge begins.
243
 
    all available ancestors of other_revision and base_revision are
 
246
 
 
247
    All available ancestors of other_revision and base_revision are
244
248
    automatically pulled into the branch.
245
249
    """
246
 
    from bzrlib.revision import common_ancestor, MultipleRevisionSources
247
 
    from bzrlib.errors import NoSuchRevision
248
250
    tempdir = tempfile.mkdtemp(prefix="bzr-")
249
251
    try:
250
252
        if this_dir is None:
251
253
            this_dir = '.'
252
254
        this_branch = Branch.open_containing(this_dir)
253
 
        this_rev_id = this_branch.last_patch()
 
255
        this_rev_id = this_branch.last_revision()
254
256
        if this_rev_id is None:
255
257
            raise BzrCommandError("This branch has no commits")
256
258
        if check_clean:
261
263
        other_branch, other_tree = get_tree(other_revision, tempdir, "other",
262
264
                                            this_branch)
263
265
        if other_revision[1] == -1:
264
 
            other_rev_id = other_branch.last_patch()
 
266
            other_rev_id = other_branch.last_revision()
265
267
            if other_rev_id is None:
266
268
                raise NoCommits(other_branch)
267
269
            other_basis = other_rev_id
270
272
            other_basis = other_rev_id
271
273
        else:
272
274
            other_rev_id = None
273
 
            other_basis = other_branch.last_patch()
 
275
            other_basis = other_branch.last_revision()
274
276
            if other_basis is None:
275
277
                raise NoCommits(other_branch)
276
278
        if base_revision == [None, None]:
285
287
        else:
286
288
            base_branch, base_tree = get_tree(base_revision, tempdir, "base")
287
289
            if base_revision[1] == -1:
288
 
                base_rev_id = base_branch.last_patch()
 
290
                base_rev_id = base_branch.last_revision()
289
291
            elif base_revision[1] is None:
290
292
                base_rev_id = None
291
293
            else:
292
294
                base_rev_id = base_branch.get_rev_id(base_revision[1])
293
 
            multi_source = MultipleRevisionSources(this_branch, base_branch)
 
295
            fetch(from_branch=base_branch, to_branch=this_branch)
294
296
            base_is_ancestor = is_ancestor(this_rev_id, base_rev_id,
295
 
                                           multi_source)
 
297
                                           this_branch)
296
298
        if file_list is None:
297
299
            interesting_ids = None
298
300
        else: