##// END OF EJS Templates
transactions: change backupfiles format to use newlines...
Durham Goode -
r23065:963f311e stable
parent child Browse files
Show More
@@ -128,7 +128,7 b' class transaction(object):'
128 self.file.write(d)
128 self.file.write(d)
129 self.file.flush()
129 self.file.flush()
130
130
131 d = ''.join(['%s\0%s\0' % (f, b) for f, b in backups])
131 d = ''.join(['%s\0%s\n' % (f, b) for f, b in backups])
132 self.backupsfile.write(d)
132 self.backupsfile.write(d)
133 self.backupsfile.flush()
133 self.backupsfile.flush()
134
134
@@ -177,7 +177,7 b' class transaction(object):'
177
177
178 self.backupentries.append((file, backupfile, None))
178 self.backupentries.append((file, backupfile, None))
179 self.backupmap[file] = len(self.backupentries) - 1
179 self.backupmap[file] = len(self.backupentries) - 1
180 self.backupsfile.write("%s\0%s\0" % (file, backupfile))
180 self.backupsfile.write("%s\0%s\n" % (file, backupfile))
181 self.backupsfile.flush()
181 self.backupsfile.flush()
182
182
183 @active
183 @active
@@ -349,20 +349,16 b' def rollback(opener, file, report):'
349 backupjournal = "%s.backupfiles" % file
349 backupjournal = "%s.backupfiles" % file
350 if opener.exists(backupjournal):
350 if opener.exists(backupjournal):
351 fp = opener.open(backupjournal)
351 fp = opener.open(backupjournal)
352 data = fp.read()
352 lines = fp.readlines()
353 if len(data) > 0:
353 if lines:
354 ver = version
354 ver = lines[0][:-1]
355 versionend = data.find('\n')
356 if versionend != -1:
357 ver = data[:versionend]
358 data = data[versionend + 1:]
359
360 if ver == str(version):
355 if ver == str(version):
361 parts = data.split('\0')
356 for line in lines[1:]:
362 # Skip the final part, since it's just a trailing empty space
357 if line:
363 for i in xrange(0, len(parts) - 1, 2):
358 # Shave off the trailing newline
364 f, b = parts[i:i + 2]
359 line = line[:-1]
365 backupentries.append((f, b, None))
360 f, b = line.split('\0')
361 backupentries.append((f, b, None))
366 else:
362 else:
367 report(_("journal was created by a newer version of "
363 report(_("journal was created by a newer version of "
368 "Mercurial"))
364 "Mercurial"))
General Comments 0
You need to be logged in to leave comments. Login now