~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/merge.py

  • Committer: aaron.bentley at utoronto
  • Date: 2005-08-21 02:20:35 UTC
  • mto: (1092.1.41) (1185.3.4)
  • mto: This revision was merged to the branch mainline in revision 1110.
  • Revision ID: aaron.bentley@utoronto.ca-20050821022035-f960c20a39d16e79
Made merge do greedy fetching.

Show diffs side-by-side

added added

removed removed

Lines of Context:
10
10
import tempfile
11
11
import shutil
12
12
import errno
 
13
from fetch import greedy_fetch
13
14
 
14
15
 
15
16
# comments from abentley on irc: merge happens in two stages, each
117
118
        if not self.ignore_zero:
118
119
            print "%d conflicts encountered.\n" % self.conflicts
119
120
            
120
 
def get_tree(treespec, temp_root, label):
 
121
def get_tree(treespec, temp_root, label, local_branch=None):
121
122
    location, revno = treespec
122
123
    branch = find_branch(location)
123
124
    if revno is None:
124
125
        base_tree = branch.working_tree()
125
 
    elif revno == -1:
126
 
        base_tree = branch.basis_tree()
127
126
    else:
128
 
        base_tree = branch.revision_tree(branch.lookup_revision(revno))
 
127
        if revno == -1:
 
128
            revision = branch.last_patch()
 
129
        else:
 
130
            revision = branch.lookup_revision(revno)
 
131
        if local_branch is not None:
 
132
            if revision is not None:
 
133
                greedy_fetch(local_branch, branch, revision)
 
134
            base_tree = local_branch.revision_tree(revision)
 
135
        else:
 
136
            base_tree = branch.revision_tree(revision)
129
137
    temp_path = os.path.join(temp_root, label)
130
138
    os.mkdir(temp_path)
131
139
    return branch, MergeTree(base_tree, temp_path)
198
206
    check_clean
199
207
        If true, this_dir must have no uncommitted changes before the
200
208
        merge begins.
 
209
    all available ancestors of other_revision and base_revision are
 
210
    automatically pulled into the branch.
201
211
    """
202
212
    tempdir = tempfile.mkdtemp(prefix="bzr-")
203
213
    try:
209
219
                                    this_branch.basis_tree(), False)
210
220
            if changes.has_changed():
211
221
                raise BzrCommandError("Working tree has uncommitted changes.")
212
 
        other_branch, other_tree = get_tree(other_revision, tempdir, "other")
 
222
        other_branch, other_tree = get_tree(other_revision, tempdir, "other",
 
223
                                            this_branch)
213
224
        if base_revision == [None, None]:
214
225
            if other_revision[1] == -1:
215
226
                o_revno = None
220
231
            if base_revno is None:
221
232
                raise UnrelatedBranches()
222
233
            base_revision = ['.', base_revno]
223
 
        base_branch, base_tree = get_tree(base_revision, tempdir, "base")
 
234
        base_branch, base_tree = get_tree(base_revision, tempdir, "base",
 
235
                                          this_branch)
224
236
        if file_list is None:
225
237
            interesting_ids = None
226
238
        else: