[PATCH v3] parsers: add a C function to pack the dirstate

Adrian Buehlmann adrian at cadifra.com
Fri May 25 08:34:21 CDT 2012


On 2012-05-25 08:48, Adrian Buehlmann wrote:
> But I do not (yet) understand why we get a Python long there on Windows.

It looks like file sizes are Python longs on (1) 32-bit Linux:

  adi at ubuntu1:~/tmp$ python
  Python 2.7.1+ (r271:86832, Apr 11 2011, 18:05:24) 
  [GCC 4.5.2] on linux2
  Type "help", "copyright", "credits" or "license" for more information.
  >>> import sys
  >>> hex(sys.maxint)
  '0x7fffffff'
  >>> import os
  >>> os.lstat('bla').st_size
  4L

and on (2) 64-bit Windows:

  $ python
  Python 2.6.6 (r266:84297, Aug 24 2010, 18:13:38) [MSC v.1500 64 bit (AMD64)] on win32
  Type "help", "copyright", "credits" or "license" for more information.
  >>> import sys
  >>> hex(sys.maxint)
  '0x7fffffff'
  >>> import os
  >>> os.lstat("bla").st_size
  18179L

On 64-bit Linux, file sizes are ints:

  adi at kork-ubuntu64:~/tmp$ python
  Python 2.7.3 (default, Apr 20 2012, 22:39:59) 
  [GCC 4.6.3] on linux2
  Type "help", "copyright", "credits" or "license" for more information.
  >>> import sys
  >>> hex(sys.maxint)
  '0x7fffffffffffffff'
  >>> import os
  >>> os.lstat('bla').st_size
  22

So, when normal() in dirstate.py is called for a file x (for example, when committing x),
we get a Python long for the file size of x in the dirstate self._map entry for x on
32-bit Linux and on Windows (both x64 and x86).




More information about the Mercurial-devel mailing list