/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: Gustav Hartvigsson
  • Date: 2021-01-09 21:36:27 UTC
  • Revision ID: gustav.hartvigsson@gmail.com-20210109213627-h1xwcutzy9m7a99b
Added 'Case Preserving Working Tree Use Cases' from Canonical Wiki

* Addod a page from the Canonical Bazaar wiki
  with information on the scmeatics of case
  perserving filesystems an a case insensitive
  filesystem works.
  
  * Needs re-work, but this will do as it is the
    same inforamoton as what was on the linked
    page in the currint documentation.

Show diffs side-by-side

added added

removed removed

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