~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/branch.py

  • Committer: Martin Pool
  • Date: 2005-05-05 06:59:12 UTC
  • Revision ID: mbp@sourcefrog.net-20050505065912-87c25dafda4579ed
- Split out log printing into new show_log function
  not as a method of Branch.

Show diffs side-by-side

added added

removed removed

Lines of Context:
773
773
 
774
774
 
775
775
 
776
 
    def write_log(self, show_timezone='original', verbose=False,
777
 
                  show_ids=False):
778
 
        """Write out human-readable log of commits to this branch.
779
 
 
780
 
        show_timezone
781
 
            'original' (committer's timezone),
782
 
            'utc' (universal time), or
783
 
            'local' (local user's timezone)
784
 
 
785
 
        verbose
786
 
            If true show added/changed/deleted/renamed files.
787
 
 
788
 
        show_ids
789
 
            If true, show revision and file ids.
790
 
        """
791
 
        
792
 
        self._need_readlock()
793
 
        revno = 1
794
 
        precursor = None
795
 
        for p in self.revision_history():
796
 
            print '-' * 40
797
 
            print 'revno:', revno
798
 
            rev = self.get_revision(p)
799
 
            if show_ids:
800
 
                print 'revision-id:', rev.revision_id
801
 
            print 'committer:', rev.committer
802
 
            print 'timestamp: %s' % (format_date(rev.timestamp, rev.timezone or 0,
803
 
                                                 show_timezone))
804
 
 
805
 
            ## opportunistic consistency check, same as check_patch_chaining
806
 
            if rev.precursor != precursor:
807
 
                raise BzrCheckError("mismatched precursor!")
808
 
 
809
 
            print 'message:'
810
 
            if not rev.message:
811
 
                print '  (no message)'
812
 
            else:
813
 
                for l in rev.message.split('\n'):
814
 
                    print '  ' + l
815
 
 
816
 
            if verbose == True and precursor != None:
817
 
                # TODO: Group as added/deleted/renamed instead
818
 
                # TODO: Show file ids
819
 
                print 'changed files:'
820
 
                tree = self.revision_tree(p)
821
 
                prevtree = self.revision_tree(precursor)
822
 
                
823
 
                for file_state, fid, old_name, new_name, kind in \
824
 
                                        diff_trees(prevtree, tree, ):
825
 
                    if file_state == 'A' or file_state == 'M':
826
 
                        show_status(file_state, kind, new_name)
827
 
                    elif file_state == 'D':
828
 
                        show_status(file_state, kind, old_name)
829
 
                    elif file_state == 'R':
830
 
                        show_status(file_state, kind,
831
 
                            old_name + ' => ' + new_name)
832
 
                
833
 
            revno += 1
834
 
            precursor = p
835
 
 
836
 
 
837
776
    def rename_one(self, from_rel, to_rel):
838
777
        """Rename one file.
839
778