~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to tools/capture_tree.py

  • Committer: Martin Pool
  • Date: 2005-10-04 10:10:48 UTC
  • mto: (1185.13.3)
  • mto: This revision was merged to the branch mainline in revision 1403.
  • Revision ID: mbp@sourcefrog.net-20051004101047-bd75d2b341134eff
- capture_tree tool to help in preparing test cases

- capture_tree code should cope with directories containing fifos, etc

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#! /usr/bin/env python2.4
 
2
 
 
3
# Copyright (C) 2005 Canonical Ltd
 
4
 
 
5
"""Print to stdout a description of the current directory, 
 
6
formatted as a Python data structure.
 
7
 
 
8
This can be useful in tests that need to recreate directory
 
9
contents."""
 
10
 
 
11
# TODO: It'd be nice if this split long strings across 
 
12
# multiple lines, relying on Python concatenation of consecutive
 
13
# string constants.
 
14
 
 
15
import sys
 
16
import os
 
17
import pprint
 
18
 
 
19
from bzrlib.trace import enable_default_logging
 
20
enable_default_logging()
 
21
from bzrlib.selftest.treeshape import capture_tree_contents
 
22
 
 
23
def main(argv):
 
24
    print '['
 
25
    for tt in capture_tree_contents('.'):
 
26
        print `tt`, ','
 
27
    print ']'
 
28
 
 
29
if __name__ == '__main__':
 
30
    sys.exit(main(sys.argv))