/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to tools/capture_tree.py

  • Committer: John Arbash Meinel
  • Date: 2006-04-25 15:05:42 UTC
  • mfrom: (1185.85.85 bzr-encoding)
  • mto: This revision was merged to the branch mainline in revision 1752.
  • Revision ID: john@arbash-meinel.com-20060425150542-c7b518dca9928691
[merge] the old bzr-encoding changes, reparenting them on bzr.dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#! /usr/bin/env python
 
1
#! /usr/bin/env python2.4
2
2
 
3
3
# Copyright (C) 2005 Canonical Ltd
4
4
 
5
 
"""Print to stdout a description of the current directory,
 
5
"""Print to stdout a description of the current directory, 
6
6
formatted as a Python data structure.
7
7
 
8
8
This can be useful in tests that need to recreate directory
9
9
contents."""
10
10
 
11
 
from __future__ import print_function
12
 
 
 
11
import sys
13
12
import os
14
 
import sys
15
13
 
16
 
from breezy.trace import enable_default_logging
 
14
from bzrlib.trace import enable_default_logging
17
15
enable_default_logging()
18
 
from breezy.selftest.treeshape import capture_tree_contents
 
16
from bzrlib.selftest.treeshape import capture_tree_contents
19
17
 
20
18
def main(argv):
21
19
    # a lame reimplementation of pformat that splits multi-line
22
20
    # strings into concatenated string literals.
23
 
    print('[')
 
21
    print '['
24
22
    for tt in capture_tree_contents('.'):
25
23
        assert isinstance(tt, tuple)
26
 
        print('    (', repr(tt[0]) + ',', end=' ')
 
24
        print '    (', repr(tt[0]) + ',',
27
25
        if len(tt) == 1:
28
 
            print('),')
 
26
            print '),'
29
27
        else:
30
28
            assert len(tt) == 2
31
29
            val = tt[1]
32
 
            print()
 
30
            print
33
31
            if val == '':
34
 
                print("        ''")
 
32
                print "        ''"
35
33
            else:
36
34
                for valline in val.splitlines(True):
37
 
                    print('       ', repr(valline))
38
 
            print('    ),')
39
 
    print(']')
 
35
                    print '       ', repr(valline)
 
36
            print '    ),'
 
37
    print ']'
40
38
 
41
39
if __name__ == '__main__':
42
40
    sys.exit(main(sys.argv))