~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/builtins.py

Merge bzr.dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
1055
1055
 
1056
1056
 
1057
1057
class cmd_log(Command):
1058
 
    """Show log of this branch.
 
1058
    """Show log of a branch, file, or directory.
 
1059
 
 
1060
    By default show the log of the branch containing the working directory.
1059
1061
 
1060
1062
    To request a range of logs, you can use the command -r begin..end
1061
1063
    -r revision requests a specific revision, -r ..end or -r begin.. are
1062
1064
    also valid.
 
1065
 
 
1066
    examples:
 
1067
        bzr log
 
1068
        bzr log foo.c
 
1069
        bzr log -r -10.. http://server/branch
1063
1070
    """
1064
1071
 
1065
1072
    # TODO: Make --revision support uuid: and hash: [future tag:] notation.
1066
1073
 
1067
 
    takes_args = ['filename?']
 
1074
    takes_args = ['location?']
1068
1075
    takes_options = [Option('forward', 
1069
1076
                            help='show from oldest to newest'),
1070
 
                     'timezone', 'verbose', 
 
1077
                     'timezone', 
 
1078
                     Option('verbose', 
 
1079
                             help='show files changed in each revision'),
1071
1080
                     'show-ids', 'revision',
1072
1081
                     'log-format',
1073
1082
                     'line', 'long', 
1077
1086
                     'short',
1078
1087
                     ]
1079
1088
    @display_command
1080
 
    def run(self, filename=None, timezone='original',
 
1089
    def run(self, location=None, timezone='original',
1081
1090
            verbose=False,
1082
1091
            show_ids=False,
1083
1092
            forward=False,
1095
1104
        
1096
1105
        # log everything
1097
1106
        file_id = None
1098
 
        if filename:
 
1107
        if location:
1099
1108
            # find the file id to log:
1100
1109
 
1101
 
            dir, fp = bzrdir.BzrDir.open_containing(filename)
 
1110
            dir, fp = bzrdir.BzrDir.open_containing(location)
1102
1111
            b = dir.open_branch()
1103
1112
            if fp != '':
1104
1113
                try:
1849
1858
        if revision is None or len(revision) < 1:
1850
1859
            base = [None, None]
1851
1860
            other = [branch, -1]
 
1861
            other_branch, path = Branch.open_containing(branch)
1852
1862
        else:
1853
1863
            if len(revision) == 1:
1854
1864
                base = [None, None]
1855
 
                other_branch = Branch.open_containing(branch)[0]
 
1865
                other_branch, path = Branch.open_containing(branch)
1856
1866
                revno = revision[0].in_history(other_branch).revno
1857
1867
                other = [branch, revno]
1858
1868
            else:
1860
1870
                if None in revision:
1861
1871
                    raise BzrCommandError(
1862
1872
                        "Merge doesn't permit that revision specifier.")
1863
 
                b = Branch.open_containing(branch)[0]
 
1873
                b, path = Branch.open_containing(branch)
1864
1874
 
1865
1875
                base = [branch, revision[0].in_history(b).revno]
1866
1876
                other = [branch, revision[1].in_history(b).revno]
 
1877
        if path != "":
 
1878
            interesting_files = [path]
 
1879
        else:
 
1880
            interesting_files = None
1867
1881
        pb = bzrlib.ui.ui_factory.nested_progress_bar()
1868
1882
        try:
1869
1883
            try:
1871
1885
                                       merge_type=merge_type, 
1872
1886
                                       reprocess=reprocess,
1873
1887
                                       show_base=show_base, 
1874
 
                                       pb=pb)
 
1888
                                       pb=pb, file_list=interesting_files)
1875
1889
            finally:
1876
1890
                pb.finished()
1877
1891
            if conflict_count != 0:
2420
2434
        merger.show_base = show_base 
2421
2435
        merger.reprocess = reprocess
2422
2436
        conflicts = merger.do_merge()
2423
 
        merger.set_pending()
 
2437
        if file_list is None:
 
2438
            merger.set_pending()
2424
2439
    finally:
2425
2440
        pb.clear()
2426
2441
    return conflicts