~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/builtins.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:
923
923
                 "branch.  Local pulls are not applied to "
924
924
                 "the master branch."
925
925
            ),
 
926
        Option('show-base',
 
927
            help="Show base revision text in conflicts.")
926
928
        ]
927
929
    takes_args = ['location?']
928
930
    encoding_type = 'replace'
929
931
 
930
932
    def run(self, location=None, remember=False, overwrite=False,
931
933
            revision=None, verbose=False,
932
 
            directory=None, local=False):
 
934
            directory=None, local=False,
 
935
            show_base=False):
933
936
        # FIXME: too much stuff is in the command class
934
937
        revision_id = None
935
938
        mergeable = None
944
947
            branch_to = Branch.open_containing(directory)[0]
945
948
            self.add_cleanup(branch_to.lock_write().unlock)
946
949
 
 
950
        if tree_to is None and show_base:
 
951
            raise errors.BzrCommandError("Need working tree for --show-base.")
 
952
 
947
953
        if local and not branch_to.get_bound_location():
948
954
            raise errors.LocalRequiresBoundBranch()
949
955
 
994
1000
                view_info=view_info)
995
1001
            result = tree_to.pull(
996
1002
                branch_from, overwrite, revision_id, change_reporter,
997
 
                possible_transports=possible_transports, local=local)
 
1003
                possible_transports=possible_transports, local=local,
 
1004
                show_base=show_base)
998
1005
        else:
999
1006
            result = branch_to.pull(
1000
1007
                branch_from, overwrite, revision_id, local=local)
1363
1370
 
1364
1371
    _see_also = ['pull', 'working-trees', 'status-flags']
1365
1372
    takes_args = ['dir?']
1366
 
    takes_options = ['revision']
 
1373
    takes_options = ['revision',
 
1374
                     Option('show-base',
 
1375
                            help="Show base revision text in conflicts."),
 
1376
                     ]
1367
1377
    aliases = ['up']
1368
1378
 
1369
 
    def run(self, dir='.', revision=None):
 
1379
    def run(self, dir='.', revision=None, show_base=None):
1370
1380
        if revision is not None and len(revision) != 1:
1371
1381
            raise errors.BzrCommandError(
1372
1382
                        "bzr update --revision takes exactly one revision")
1412
1422
                change_reporter,
1413
1423
                possible_transports=possible_transports,
1414
1424
                revision=revision_id,
1415
 
                old_tip=old_tip)
 
1425
                old_tip=old_tip,
 
1426
                show_base=show_base)
1416
1427
        except errors.NoSuchRevision, e:
1417
1428
            raise errors.BzrCommandError(
1418
1429
                                  "branch has no revision %s\n"