~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/compiled/dirstate_helpers.pyx

  • Committer: John Arbash Meinel
  • Date: 2007-05-04 20:00:15 UTC
  • mto: This revision was merged to the branch mainline in revision 2643.
  • Revision ID: john@arbash-meinel.com-20070504200015-yli1te8jfhk3xpjc
Ask the field converter to determine the current directory
rather than parsing it out of the returned entry.

Show diffs side-by-side

added added

removed removed

Lines of Context:
191
191
    return cur
192
192
 
193
193
 
194
 
cdef object _fields_to_entry_0_parents(PyListObject *fields, int offset):
 
194
cdef object _fields_to_entry_0_parents(PyListObject *fields, int offset,
 
195
                                       void **dirname, char **dirname_str):
195
196
    cdef object path_name_file_id_key
196
197
    cdef char *size_str
197
198
    cdef unsigned long int size
199
200
    cdef int is_executable
200
201
    cdef PyObject **base
201
202
    base = fields.ob_item + offset
 
203
    dirname[0] = base[0]
 
204
    dirname_str[0] = PyString_AS_STRING_void(base[0])
202
205
    path_name_file_id_key = (<object>(base[0]),
203
206
                             <object>(base[1]),
204
207
                             <object>(base[2]),
228
231
    cdef object entry
229
232
    cdef void* dirname
230
233
    cdef char* dirname_str
231
 
    cdef int dirname_size
232
234
    cdef char* current_dirname_str
233
 
    cdef int current_dirname_size
234
235
 
235
236
    if not PyList_CheckExact(fields):
236
237
        raise TypeError('fields must be a list')
238
239
    state._dirblocks = [('', []), ('', [])]
239
240
    current_block = state._dirblocks[0][1]
240
241
    current_dirname_str = ''
241
 
    current_dirname_size = 0
242
242
 
243
243
    while pos < field_count:
244
 
        entry = _fields_to_entry_0_parents(<PyListObject *>fields, pos)
 
244
        entry = _fields_to_entry_0_parents(<PyListObject *>fields, pos,
 
245
                                           &dirname, &dirname_str)
245
246
        pos = pos + entry_size
246
 
        dirname = PyTuple_GetItem_void_void(
247
 
                    PyTuple_GetItem_void_void(<void*>entry, 0), 0)
248
 
        dirname_str = PyString_AS_STRING_void(dirname)
249
 
        dirname_size = PyString_GET_SIZE_void(dirname)
250
247
        if (strcmp(dirname_str, current_dirname_str) != 0):
251
248
            # new block - different dirname
252
249
            current_block = []
253
250
            current_dirname_str = dirname_str
254
 
            current_dirname_size = dirname_size
255
251
            PyList_Append(state._dirblocks,
256
252
                          (<object>dirname, current_block))
257
253
        PyList_Append(current_block, entry)