Mercurial > hg
comparison tests/generate-working-copy-states.py @ 43076:2372284d9457
formatting: blacken the codebase
This is using my patch to black
(https://github.com/psf/black/pull/826) so we don't un-wrap collection
literals.
Done with:
hg files 'set:**.py - mercurial/thirdparty/** - "contrib/python-zstandard/**"' | xargs black -S
# skip-blame mass-reformatting only
# no-check-commit reformats foo_bar functions
Differential Revision: https://phab.mercurial-scm.org/D6971
author | Augie Fackler <augie@google.com> |
---|---|
date | Sun, 06 Oct 2019 09:45:02 -0400 |
parents | ed46d48453e8 |
children | 6000f5b25c9b |
comparison
equal
deleted
inserted
replaced
43075:57875cf423c9 | 43076:2372284d9457 |
---|---|
41 # revisions, so all of (modified,clean,added,removed) can be tested. | 41 # revisions, so all of (modified,clean,added,removed) can be tested. |
42 def generatestates(maxchangesets, parentcontents): | 42 def generatestates(maxchangesets, parentcontents): |
43 depth = len(parentcontents) | 43 depth = len(parentcontents) |
44 if depth == maxchangesets + 1: | 44 if depth == maxchangesets + 1: |
45 for tracked in (b'untracked', b'tracked'): | 45 for tracked in (b'untracked', b'tracked'): |
46 filename = b"_".join([(content is None and b'missing' or content) | 46 filename = ( |
47 for content in parentcontents]) + b"-" + tracked | 47 b"_".join( |
48 [ | |
49 (content is None and b'missing' or content) | |
50 for content in parentcontents | |
51 ] | |
52 ) | |
53 + b"-" | |
54 + tracked | |
55 ) | |
48 yield (filename, parentcontents) | 56 yield (filename, parentcontents) |
49 else: | 57 else: |
50 for content in ({None, b'content' + (b"%d" % (depth + 1))} | | 58 for content in {None, b'content' + (b"%d" % (depth + 1))} | set( |
51 set(parentcontents)): | 59 parentcontents |
52 for combination in generatestates(maxchangesets, | 60 ): |
53 parentcontents + [content]): | 61 for combination in generatestates( |
62 maxchangesets, parentcontents + [content] | |
63 ): | |
54 yield combination | 64 yield combination |
65 | |
55 | 66 |
56 # retrieve the command line arguments | 67 # retrieve the command line arguments |
57 target = sys.argv[1] | 68 target = sys.argv[1] |
58 maxchangesets = int(sys.argv[2]) | 69 maxchangesets = int(sys.argv[2]) |
59 if target == 'state': | 70 if target == 'state': |