~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/weave.py

  • Committer: Robert Collins
  • Date: 2005-10-02 21:51:29 UTC
  • mfrom: (1396)
  • mto: This revision was merged to the branch mainline in revision 1397.
  • Revision ID: robertc@robertcollins.net-20051002215128-5686c7d24bf9bdb9
merge from martins newformat branch - brings in transport abstraction

Show diffs side-by-side

added added

removed removed

Lines of Context:
94
94
from difflib import SequenceMatcher
95
95
 
96
96
 
97
 
from bzrlib.osutils import sha_strings
98
97
 
99
98
 
100
99
class WeaveError(Exception):
273
272
        sha -- SHA-1 of the file, if known.  This is trusted to be
274
273
            correct if supplied.
275
274
        """
 
275
        from bzrlib.osutils import sha_strings
276
276
 
277
277
        assert isinstance(name, basestring)
278
278
        if sha1 is None:
788
788
 
789
789
 
790
790
 
791
 
def weave_stats(weave_file):
792
 
    from bzrlib.progress import ProgressBar
 
791
def weave_stats(weave_file, pb):
793
792
    from bzrlib.weavefile import read_weave
794
793
 
795
 
    pb = ProgressBar()
796
 
 
797
794
    wf = file(weave_file, 'rb')
798
795
    w = read_weave(wf)
799
796
    # FIXME: doesn't work on pipes
872
869
def main(argv):
873
870
    import sys
874
871
    import os
 
872
    try:
 
873
        import bzrlib
 
874
    except ImportError:
 
875
        # in case we're run directly from the subdirectory
 
876
        sys.path.append('..')
 
877
        import bzrlib
875
878
    from bzrlib.weavefile import write_weave, read_weave
876
879
    from bzrlib.progress import ProgressBar
877
880
 
944
947
        weave_toc(readit())
945
948
 
946
949
    elif cmd == 'stats':
947
 
        weave_stats(argv[2])
 
950
        weave_stats(argv[2], ProgressBar())
948
951
        
949
952
    elif cmd == 'check':
950
953
        w = readit()