~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/merge.py

  • Committer: Martin Pool
  • Date: 2005-06-06 11:53:29 UTC
  • Revision ID: mbp@sourcefrog.net-20050606115329-1596352add25bffd
- merge aaron's updated merge/pull code

Show diffs side-by-side

added added

removed removed

Lines of Context:
155
155
                self.cached[id] = path
156
156
            return self.cached[id]
157
157
 
158
 
def merge(other_revision, base_revision, no_changes=True, ignore_zero=False):
 
158
 
 
159
 
 
160
def merge(other_revision, base_revision,
 
161
          check_clean=True, ignore_zero=False,
 
162
          this_dir=None):
 
163
    """Merge changes into a tree.
 
164
 
 
165
    base_revision
 
166
        Base for three-way merge.
 
167
    other_revision
 
168
        Other revision for three-way merge.
 
169
    this_dir
 
170
        Directory to merge changes into; '.' by default.
 
171
    check_clean
 
172
        If true, this_dir must have no uncommitted changes before the
 
173
        merge begins.
 
174
    """
159
175
    tempdir = tempfile.mkdtemp(prefix="bzr-")
160
176
    try:
161
 
        this_branch = find_branch('.') 
162
 
        if no_changes:
 
177
        if this_dir is None:
 
178
            this_dir = '.'
 
179
        this_branch = find_branch(this_dir)
 
180
        if check_clean:
163
181
            changes = compare_trees(this_branch.working_tree(), 
164
182
                                    this_branch.basis_tree(), False)
165
183
            if changes.has_changed():
208
226
 
209
227
def merge_inner(this_branch, other_tree, base_tree, tempdir, 
210
228
                ignore_zero=False):
211
 
    this_tree = get_tree(('.', None), tempdir, "this")[1]
 
229
    this_tree = get_tree((this_branch.base, None), tempdir, "this")[1]
212
230
 
213
231
    def get_inventory(tree):
214
232
        return tree.inventory