##// END OF EJS Templates
py3: make sure we use bytes in generate-working-copy-states.py
Pulkit Goyal -
r36396:27ab9264 default
parent child Browse files
Show More
@@ -42,12 +42,12 import sys
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 ('untracked', 'tracked'):
45 for tracked in (b'untracked', b'tracked'):
46 filename = "_".join([(content is None and 'missing' or content) for
46 filename = b"_".join([(content is None and b'missing' or content)
47 content in parentcontents]) + "-" + tracked
47 for content in parentcontents]) + b"-" + tracked
48 yield (filename, parentcontents)
48 yield (filename, parentcontents)
49 else:
49 else:
50 for content in ({None, 'content' + str(depth + 1)} |
50 for content in ({None, b'content' + (b"%d" % (depth + 1))} |
51 set(parentcontents)):
51 set(parentcontents)):
52 for combination in generatestates(maxchangesets,
52 for combination in generatestates(maxchangesets,
53 parentcontents + [content]):
53 parentcontents + [content]):
@@ -71,7 +71,7 for filename, states in combinations:
71 if depth == 'wc':
71 if depth == 'wc':
72 # Make sure there is content so the file gets written and can be
72 # Make sure there is content so the file gets written and can be
73 # tracked. It will be deleted outside of this script.
73 # tracked. It will be deleted outside of this script.
74 content.append((filename, states[maxchangesets] or 'TOBEDELETED'))
74 content.append((filename, states[maxchangesets] or b'TOBEDELETED'))
75 else:
75 else:
76 content.append((filename, states[int(depth) - 1]))
76 content.append((filename, states[int(depth) - 1]))
77 else:
77 else:
@@ -82,7 +82,7 for filename, states in combinations:
82 for filename, data in content:
82 for filename, data in content:
83 if data is not None:
83 if data is not None:
84 f = open(filename, 'wb')
84 f = open(filename, 'wb')
85 f.write(data + '\n')
85 f.write(data + b'\n')
86 f.close()
86 f.close()
87 elif os.path.exists(filename):
87 elif os.path.exists(filename):
88 os.remove(filename)
88 os.remove(filename)
General Comments 0
You need to be logged in to leave comments. Login now