/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: Jelmer Vernooij
  • Date: 2020-04-05 19:11:34 UTC
  • mto: (7490.7.16 work)
  • mto: This revision was merged to the branch mainline in revision 7501.
  • Revision ID: jelmer@jelmer.uk-20200405191134-0aebh8ikiwygxma5
Populate the .gitignore file.

Show diffs side-by-side

added added

removed removed

Lines of Context:
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
 
 
13
import os
11
14
import sys
12
 
import os
13
15
 
14
 
from bzrlib.trace import enable_default_logging
 
16
from breezy.trace import enable_default_logging
15
17
enable_default_logging()
16
 
from bzrlib.selftest.treeshape import capture_tree_contents
 
18
from breezy.selftest.treeshape import capture_tree_contents
17
19
 
18
20
def main(argv):
19
21
    # a lame reimplementation of pformat that splits multi-line
20
22
    # strings into concatenated string literals.
21
 
    print '['
 
23
    print('[')
22
24
    for tt in capture_tree_contents('.'):
23
25
        assert isinstance(tt, tuple)
24
 
        print '    (', repr(tt[0]) + ',',
 
26
        print('    (', repr(tt[0]) + ',', end=' ')
25
27
        if len(tt) == 1:
26
 
            print '),'
 
28
            print('),')
27
29
        else:
28
30
            assert len(tt) == 2
29
31
            val = tt[1]
30
 
            print
 
32
            print()
31
33
            if val == '':
32
 
                print "        ''"
 
34
                print("        ''")
33
35
            else:
34
36
                for valline in val.splitlines(True):
35
 
                    print '       ', repr(valline)
36
 
            print '    ),'
37
 
    print ']'
 
37
                    print('       ', repr(valline))
 
38
            print('    ),')
 
39
    print(']')
38
40
 
39
41
if __name__ == '__main__':
40
42
    sys.exit(main(sys.argv))