~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/weave.py

  • Committer: Martin Pool
  • Date: 2005-09-29 09:07:09 UTC
  • mto: (1185.12.2) (1393.1.12)
  • mto: This revision was merged to the branch mainline in revision 1396.
  • Revision ID: mbp@sourcefrog.net-20050929090709-36eebfb3ba67d0a5
- weave tool now finds bzrlib if it's not on the default path

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:
784
784
 
785
785
 
786
786
 
787
 
def weave_stats(weave_file):
788
 
    from bzrlib.progress import ProgressBar
 
787
def weave_stats(weave_file, pb):
789
788
    from bzrlib.weavefile import read_weave
790
789
 
791
 
    pb = ProgressBar()
792
 
 
793
790
    wf = file(weave_file, 'rb')
794
791
    w = read_weave(wf)
795
792
    # FIXME: doesn't work on pipes
868
865
def main(argv):
869
866
    import sys
870
867
    import os
 
868
    try:
 
869
        import bzrlib
 
870
    except ImportError:
 
871
        # in case we're run directly from the subdirectory
 
872
        sys.path.append('..')
 
873
        import bzrlib
871
874
    from bzrlib.weavefile import write_weave, read_weave
872
875
    from bzrlib.progress import ProgressBar
873
876
 
940
943
        weave_toc(readit())
941
944
 
942
945
    elif cmd == 'stats':
943
 
        weave_stats(argv[2])
 
946
        weave_stats(argv[2], ProgressBar())
944
947
        
945
948
    elif cmd == 'check':
946
949
        w = readit()