##// END OF EJS Templates
generate-working-copy-states: generalize for depth...
Martin von Zweigbergk -
r23446:e51027c8 default
parent child Browse files
Show More
@@ -2,29 +2,34 b''
2 2 import sys
3 3 import os
4 4
5 # build the combination of possible states
6 combination = []
7 for base in [None, 'content1']:
8 for parent in set([None, 'content2']) | set([base]):
9 for wcc in set([None, 'content3']) | set([base, parent]):
5 # Generates pairs of (filename, contents), where 'contents' is a list
6 # describing the file's content at each revision (or in the working copy).
7 # At each revision, it is either None or the file's actual content. When not
8 # None, it may be either new content or the same content as an earlier
9 # revisions, so all of (modified,clean,added,removed) can be tested.
10 def generatestates(maxchangesets, parentcontents):
11 depth = len(parentcontents)
12 if depth == maxchangesets + 1:
10 13 for tracked in ('untracked', 'tracked'):
11 def statestring(content):
12 return content is None and 'missing' or content
13 filename = "%s_%s_%s-%s" % (statestring(base),
14 statestring(parent),
15 statestring(wcc),
16 tracked)
17 combination.append((filename, base, parent, wcc))
14 filename = "_".join([(content is None and 'missing' or content) for
15 content in parentcontents]) + "-" + tracked
16 yield (filename, parentcontents)
17 else:
18 for content in (set([None, 'content' + str(depth + 1)]) |
19 set(parentcontents)):
20 for combination in generatestates(maxchangesets,
21 parentcontents + [content]):
22 yield combination
18 23
19 # make sure we have stable output
20 combination.sort()
24 # sort to make sure we have stable output
25 combinations = sorted(generatestates(2, []))
21 26
22 27 # retrieve the state we must generate
23 28 target = sys.argv[1]
24 29
25 30 # compute file content
26 31 content = []
27 for filename, base, parent, wcc in combination:
32 for filename, [base, parent, wcc] in combinations:
28 33 if target == 'filelist':
29 34 print filename
30 35 elif target == 'base':
General Comments 0
You need to be logged in to leave comments. Login now