231
231
ERROR_DIRECTORY = 267
234
# compile the struct compiler we need, so as to only do it once
235
from _struct import Struct
236
_compiled_pack = Struct('>LLLLLL').pack
237
def pack_stat(st, _encode=binascii.b2a_base64, _pack=_compiled_pack):
238
"""Convert stat values into a packed representation."""
239
# jam 20060614 it isn't really worth removing more entries if we
240
# are going to leave it in packed form.
241
# With only st_mtime and st_mode filesize is 5.5M and read time is 275ms
242
# With all entries, filesize is 5.9M and read time is maybe 280ms
243
# well within the noise margin
234
if not getattr(struct, '_compile', None):
235
# Cannot pre-compile the dirstate pack_stat
236
def pack_stat(st, _encode=binascii.b2a_base64, _pack=struct.pack):
237
"""Convert stat values into a packed representation."""
238
return _encode(_pack('>LLLLLL', st.st_size, int(st.st_mtime),
239
int(st.st_ctime), st.st_dev, st.st_ino & 0xFFFFFFFF,
242
# compile the struct compiler we need, so as to only do it once
243
from _struct import Struct
244
_compiled_pack = Struct('>LLLLLL').pack
245
def pack_stat(st, _encode=binascii.b2a_base64, _pack=_compiled_pack):
246
"""Convert stat values into a packed representation."""
247
# jam 20060614 it isn't really worth removing more entries if we
248
# are going to leave it in packed form.
249
# With only st_mtime and st_mode filesize is 5.5M and read time is 275ms
250
# With all entries, filesize is 5.9M and read time is maybe 280ms
251
# well within the noise margin
245
# base64 encoding always adds a final newline, so strip it off
246
# The current version
247
return _encode(_pack(st.st_size, int(st.st_mtime), int(st.st_ctime)
248
, st.st_dev, st.st_ino & 0xFFFFFFFF, st.st_mode))[:-1]
249
# This is 0.060s / 1.520s faster by not encoding as much information
250
# return _encode(_pack('>LL', int(st.st_mtime), st.st_mode))[:-1]
251
# This is not strictly faster than _encode(_pack())[:-1]
252
# return '%X.%X.%X.%X.%X.%X' % (
253
# st.st_size, int(st.st_mtime), int(st.st_ctime),
254
# st.st_dev, st.st_ino, st.st_mode)
255
# Similar to the _encode(_pack('>LL'))
256
# return '%X.%X' % (int(st.st_mtime), st.st_mode)
253
# base64 encoding always adds a final newline, so strip it off
254
# The current version
255
return _encode(_pack(st.st_size, int(st.st_mtime), int(st.st_ctime),
256
st.st_dev, st.st_ino & 0xFFFFFFFF, st.st_mode))[:-1]
257
# This is 0.060s / 1.520s faster by not encoding as much information
258
# return _encode(_pack('>LL', int(st.st_mtime), st.st_mode))[:-1]
259
# This is not strictly faster than _encode(_pack())[:-1]
260
# return '%X.%X.%X.%X.%X.%X' % (
261
# st.st_size, int(st.st_mtime), int(st.st_ctime),
262
# st.st_dev, st.st_ino, st.st_mode)
263
# Similar to the _encode(_pack('>LL'))
264
# return '%X.%X' % (int(st.st_mtime), st.st_mode)
259
267
class DirState(object):