~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/_dirstate_helpers_pyx.pyx

  • Committer: Jonathan Riddell
  • Date: 2011-09-14 15:21:36 UTC
  • mto: This revision was merged to the branch mainline in revision 6143.
  • Revision ID: jriddell@canonical.com-20110914152136-q2pclqcjwx95dfbu
gettext-ify bzrlib/commit.py

Show diffs side-by-side

added added

removed removed

Lines of Context:
97
97
    object PyTuple_GetItem_void_object "PyTuple_GET_ITEM" (void* tpl, int index)
98
98
    object PyTuple_GET_ITEM(object tpl, Py_ssize_t index)
99
99
 
100
 
    unsigned long PyInt_AsUnsignedLongMask(object number) except? -1
101
100
 
102
101
    char *PyString_AsString(object p)
103
102
    char *PyString_AsString_obj "PyString_AsString" (PyObject *string)
812
811
_encode = binascii.b2a_base64
813
812
 
814
813
 
 
814
from struct import pack
815
815
cdef _pack_stat(stat_value):
816
816
    """return a string representing the stat value's key fields.
817
817
 
821
821
    cdef char result[6*4] # 6 long ints
822
822
    cdef int *aliased
823
823
    aliased = <int *>result
824
 
    aliased[0] = htonl(PyInt_AsUnsignedLongMask(stat_value.st_size))
825
 
    # mtime and ctime will often be floats but get converted to PyInt within
826
 
    aliased[1] = htonl(PyInt_AsUnsignedLongMask(stat_value.st_mtime))
827
 
    aliased[2] = htonl(PyInt_AsUnsignedLongMask(stat_value.st_ctime))
828
 
    aliased[3] = htonl(PyInt_AsUnsignedLongMask(stat_value.st_dev))
829
 
    aliased[4] = htonl(PyInt_AsUnsignedLongMask(stat_value.st_ino))
830
 
    aliased[5] = htonl(PyInt_AsUnsignedLongMask(stat_value.st_mode))
 
824
    aliased[0] = htonl(stat_value.st_size)
 
825
    aliased[1] = htonl(int(stat_value.st_mtime))
 
826
    aliased[2] = htonl(int(stat_value.st_ctime))
 
827
    aliased[3] = htonl(stat_value.st_dev)
 
828
    aliased[4] = htonl(stat_value.st_ino & 0xFFFFFFFF)
 
829
    aliased[5] = htonl(stat_value.st_mode)
831
830
    packed = PyString_FromStringAndSize(result, 6*4)
832
831
    return _encode(packed)[:-1]
833
832
 
834
833
 
835
 
def pack_stat(stat_value):
836
 
    """Convert stat value into a packed representation quickly with pyrex"""
837
 
    return _pack_stat(stat_value)
838
 
 
839
 
 
840
834
def update_entry(self, entry, abspath, stat_value):
841
835
    """Update the entry based on what is actually on disk.
842
836