Show More
@@ -15,6 +15,7 b' import silenttestrunner' | |||
|
15 | 15 | |
|
16 | 16 | from mercurial.node import nullid |
|
17 | 17 | from mercurial import ( |
|
18 | pycompat, | |
|
18 | 19 | ui as uimod, |
|
19 | 20 | ) |
|
20 | 21 | # Load the local remotefilelog, not the system one |
@@ -35,13 +36,14 b' class histpacktests(unittest.TestCase):' | |||
|
35 | 36 | def makeTempDir(self): |
|
36 | 37 | tempdir = tempfile.mkdtemp() |
|
37 | 38 | self.tempdirs.append(tempdir) |
|
38 | return tempdir | |
|
39 | return pycompat.fsencode(tempdir) | |
|
39 | 40 | |
|
40 | 41 | def getHash(self, content): |
|
41 | 42 | return hashlib.sha1(content).digest() |
|
42 | 43 | |
|
43 | 44 | def getFakeHash(self): |
|
44 |
return ''.join(chr(random.randint(0, 255)) |
|
|
45 | return b''.join(pycompat.bytechr(random.randint(0, 255)) | |
|
46 | for _ in range(20)) | |
|
45 | 47 | |
|
46 | 48 | def createPack(self, revisions=None): |
|
47 | 49 | """Creates and returns a historypack containing the specified revisions. |
@@ -53,7 +55,7 b' class histpacktests(unittest.TestCase):' | |||
|
53 | 55 | revisions = [("filename", self.getFakeHash(), nullid, nullid, |
|
54 | 56 | self.getFakeHash(), None)] |
|
55 | 57 | |
|
56 | packdir = self.makeTempDir() | |
|
58 | packdir = pycompat.fsencode(self.makeTempDir()) | |
|
57 | 59 | packer = historypack.mutablehistorypack(uimod.ui(), packdir, |
|
58 | 60 | version=2) |
|
59 | 61 | |
@@ -107,7 +109,7 b' class histpacktests(unittest.TestCase):' | |||
|
107 | 109 | chain. |
|
108 | 110 | """ |
|
109 | 111 | revisions = [] |
|
110 | filename = "foo" | |
|
112 | filename = b"foo" | |
|
111 | 113 | lastnode = nullid |
|
112 | 114 | for i in range(10): |
|
113 | 115 | node = self.getFakeHash() |
@@ -136,7 +138,7 b' class histpacktests(unittest.TestCase):' | |||
|
136 | 138 | revisions = [] |
|
137 | 139 | random.seed(0) |
|
138 | 140 | for i in range(100): |
|
139 |
filename = "filename-% |
|
|
141 | filename = b"filename-%d" % i | |
|
140 | 142 | entries = [] |
|
141 | 143 | p2 = nullid |
|
142 | 144 | linknode = nullid |
@@ -172,7 +174,7 b' class histpacktests(unittest.TestCase):' | |||
|
172 | 174 | |
|
173 | 175 | def testGetNodeInfo(self): |
|
174 | 176 | revisions = [] |
|
175 | filename = "foo" | |
|
177 | filename = b"foo" | |
|
176 | 178 | lastnode = nullid |
|
177 | 179 | for i in range(10): |
|
178 | 180 | node = self.getFakeHash() |
@@ -193,7 +195,7 b' class histpacktests(unittest.TestCase):' | |||
|
193 | 195 | """Test the getmissing() api. |
|
194 | 196 | """ |
|
195 | 197 | revisions = [] |
|
196 | filename = "foo" | |
|
198 | filename = b"foo" | |
|
197 | 199 | for i in range(10): |
|
198 | 200 | node = self.getFakeHash() |
|
199 | 201 | p1 = self.getFakeHash() |
@@ -223,7 +225,7 b' class histpacktests(unittest.TestCase):' | |||
|
223 | 225 | pack = self.createPack() |
|
224 | 226 | |
|
225 | 227 | try: |
|
226 | pack.add('filename', nullid, nullid, nullid, nullid, None) | |
|
228 | pack.add(b'filename', nullid, nullid, nullid, nullid, None) | |
|
227 | 229 | self.assertTrue(False, "historypack.add should throw") |
|
228 | 230 | except RuntimeError: |
|
229 | 231 | pass |
@@ -250,7 +252,7 b' class histpacktests(unittest.TestCase):' | |||
|
250 | 252 | total = basepack.SMALLFANOUTCUTOFF + 1 |
|
251 | 253 | revisions = [] |
|
252 | 254 | for i in xrange(total): |
|
253 |
filename = "foo-% |
|
|
255 | filename = b"foo-%d" % i | |
|
254 | 256 | node = self.getFakeHash() |
|
255 | 257 | p1 = self.getFakeHash() |
|
256 | 258 | p2 = self.getFakeHash() |
General Comments 0
You need to be logged in to leave comments.
Login now