comparison mercurial/revlog.py @ 4996:a0d37976cd5b

revlog: avoid some unnecessary seek/tell syscalls
author Matt Mackall <mpm@selenic.com>
date Mon, 23 Jul 2007 20:44:08 -0500
parents d36310dd51d7
children 825516d16b25
comparison
equal deleted inserted replaced
4995:e45fc5d03798 4996:a0d37976cd5b
1027 dfh.write(data[0]) 1027 dfh.write(data[0])
1028 dfh.write(data[1]) 1028 dfh.write(data[1])
1029 dfh.flush() 1029 dfh.flush()
1030 ifh.write(entry) 1030 ifh.write(entry)
1031 else: 1031 else:
1032 ifh.seek(0, 2) 1032 offset += curr * self._io.size
1033 transaction.add(self.indexfile, ifh.tell(), prev) 1033 transaction.add(self.indexfile, offset, prev)
1034 ifh.write(entry) 1034 ifh.write(entry)
1035 ifh.write(data[0]) 1035 ifh.write(data[0])
1036 ifh.write(data[1]) 1036 ifh.write(data[1])
1037 self.checkinlinesize(transaction, ifh) 1037 self.checkinlinesize(transaction, ifh)
1038 1038
1104 start = end = textlen = 0 1104 start = end = textlen = 0
1105 if r: 1105 if r:
1106 end = self.end(t) 1106 end = self.end(t)
1107 1107
1108 ifh = self.opener(self.indexfile, "a+") 1108 ifh = self.opener(self.indexfile, "a+")
1109 ifh.seek(0, 2) 1109 isize = r * self._io.size
1110 transaction.add(self.indexfile, ifh.tell(), self.count())
1111 if self._inline: 1110 if self._inline:
1111 transaction.add(self.indexfile, end + isize, r)
1112 dfh = None 1112 dfh = None
1113 else: 1113 else:
1114 transaction.add(self.indexfile, isize, r)
1114 transaction.add(self.datafile, end) 1115 transaction.add(self.datafile, end)
1115 dfh = self.opener(self.datafile, "a") 1116 dfh = self.opener(self.datafile, "a")
1116 1117
1117 # loop through our set of deltas 1118 # loop through our set of deltas
1118 chain = None 1119 chain = None