~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/workingtree.py

(gz) Enable use of 3-way conflict markers in pull and update by adding
 --show-base option (Rory Yorke)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1663
1663
 
1664
1664
    @needs_write_lock
1665
1665
    def pull(self, source, overwrite=False, stop_revision=None,
1666
 
             change_reporter=None, possible_transports=None, local=False):
 
1666
             change_reporter=None, possible_transports=None, local=False,
 
1667
             show_base=False):
1667
1668
        source.lock_read()
1668
1669
        try:
1669
1670
            old_revision_info = self.branch.last_revision_info()
1683
1684
                                basis_tree,
1684
1685
                                this_tree=self,
1685
1686
                                pb=None,
1686
 
                                change_reporter=change_reporter)
 
1687
                                change_reporter=change_reporter,
 
1688
                                show_base=show_base)
1687
1689
                    basis_root_id = basis_tree.get_root_id()
1688
1690
                    new_root_id = new_basis_tree.get_root_id()
1689
1691
                    if basis_root_id != new_root_id:
2261
2263
    _marker = object()
2262
2264
 
2263
2265
    def update(self, change_reporter=None, possible_transports=None,
2264
 
               revision=None, old_tip=_marker):
 
2266
               revision=None, old_tip=_marker, show_base=False):
2265
2267
        """Update a working tree along its branch.
2266
2268
 
2267
2269
        This will update the branch if its bound too, which means we have
2304
2306
            else:
2305
2307
                if old_tip is self._marker:
2306
2308
                    old_tip = None
2307
 
            return self._update_tree(old_tip, change_reporter, revision)
 
2309
            return self._update_tree(old_tip, change_reporter, revision, show_base)
2308
2310
        finally:
2309
2311
            self.unlock()
2310
2312
 
2311
2313
    @needs_tree_write_lock
2312
 
    def _update_tree(self, old_tip=None, change_reporter=None, revision=None):
 
2314
    def _update_tree(self, old_tip=None, change_reporter=None, revision=None,
 
2315
                     show_base=False):
2313
2316
        """Update a tree to the master branch.
2314
2317
 
2315
2318
        :param old_tip: if supplied, the previous tip revision the branch,
2342
2345
            other_tree = self.branch.repository.revision_tree(old_tip)
2343
2346
            nb_conflicts = merge.merge_inner(self.branch, other_tree,
2344
2347
                                             base_tree, this_tree=self,
2345
 
                                             change_reporter=change_reporter)
 
2348
                                             change_reporter=change_reporter,
 
2349
                                             show_base=show_base)
2346
2350
            if nb_conflicts:
2347
2351
                self.add_parent_tree((old_tip, other_tree))
2348
2352
                trace.note('Rerun update after fixing the conflicts.')
2372
2376
 
2373
2377
            nb_conflicts = merge.merge_inner(self.branch, to_tree, base_tree,
2374
2378
                                             this_tree=self,
2375
 
                                             change_reporter=change_reporter)
 
2379
                                             change_reporter=change_reporter,
 
2380
                                             show_base=show_base)
2376
2381
            self.set_last_revision(revision)
2377
2382
            # TODO - dedup parents list with things merged by pull ?
2378
2383
            # reuse the tree we've updated to to set the basis: