~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/builtins.py

[merge] bzr.log.plugins: add --log-format to 'bzr log', allow a default to be set in config

Show diffs side-by-side

added added

removed removed

Lines of Context:
971
971
                            help='show from oldest to newest'),
972
972
                     'timezone', 'verbose', 
973
973
                     'show-ids', 'revision',
 
974
                     'log-format',
974
975
                     'line', 'long', 
975
976
                     Option('message',
976
977
                            help='show revisions whose message matches this regexp',
983
984
            show_ids=False,
984
985
            forward=False,
985
986
            revision=None,
 
987
            log_format=None,
986
988
            message=None,
987
989
            long=False,
988
990
            short=False,
1041
1043
        # in e.g. the default C locale.
1042
1044
        outf = codecs.getwriter(bzrlib.user_encoding)(sys.stdout, errors='replace')
1043
1045
 
1044
 
        log_format = get_log_format(long=long, short=short, line=line)
 
1046
        if (log_format == None):
 
1047
            default = bzrlib.config.BranchConfig(b).log_format()
 
1048
            log_format = get_log_format(long=long, short=short, line=line, default=default)
 
1049
 
1045
1050
        lf = log_formatter(log_format,
1046
1051
                           show_ids=show_ids,
1047
1052
                           to_file=outf,
1893
1898
                            'Display changes in the local branch only'),
1894
1899
                     Option('theirs-only', 
1895
1900
                            'Display changes in the remote branch only'), 
 
1901
                     'log-format',
1896
1902
                     'line',
1897
1903
                     'long', 
1898
1904
                     'short',
1901
1907
                     ]
1902
1908
 
1903
1909
    def run(self, other_branch=None, reverse=False, mine_only=False,
1904
 
            theirs_only=False, long=True, short=False, line=False, 
 
1910
            theirs_only=False, log_format=None, long=False, short=False, line=False, 
1905
1911
            show_ids=False, verbose=False):
1906
1912
        from bzrlib.missing import find_unmerged, iter_log_data
1907
1913
        from bzrlib.log import log_formatter
1914
1920
            print "Using last location: " + local_branch.get_parent()
1915
1921
        remote_branch = bzrlib.branch.Branch.open(other_branch)
1916
1922
        local_extra, remote_extra = find_unmerged(local_branch, remote_branch)
1917
 
        log_format = get_log_format(long=long, short=short, line=line)
 
1923
        if (log_format == None):
 
1924
            default = bzrlib.config.BranchConfig(local_branch).log_format()
 
1925
            log_format = get_log_format(long=long, short=short, line=line, default=default)
1918
1926
        lf = log_formatter(log_format, sys.stdout,
1919
1927
                           show_ids=show_ids,
1920
1928
                           show_timezone='original')