~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/dirstate.py

Merge dirstate and some small cleanups

Show diffs side-by-side

added added

removed removed

Lines of Context:
222
222
    A dirstate is a specialised data structure for managing local working
223
223
    tree state information. Its not yet well defined whether it is platform
224
224
    specific, and if it is how we detect/parameterise that.
 
225
 
 
226
    Dirstates use the usual lock_write, lock_read and unlock mechanisms.
 
227
    Unlike most bzr disk formats, DirStates must be locked for reading, using
 
228
    lock_read.  (This is an os file lock internally.)  This is necessary
 
229
    because the file can be rewritten in place.
 
230
 
 
231
    DirStates must be explicitly written with save() to commit changes; just
 
232
    unlocking them does not write the changes to disk.
225
233
    """
226
234
 
227
235
    _kind_to_minikind = {
228
 
            'absent':'a',
229
 
            'file':'f',
230
 
            'directory':'d',
231
 
            'relocated':'r',
 
236
            'absent': 'a',
 
237
            'file': 'f',
 
238
            'directory': 'd',
 
239
            'relocated': 'r',
232
240
            'symlink': 'l',
233
241
            'tree-reference': 't',
234
242
        }
235
 
    _minikind_to_kind = {'a':'absent', 'f':'file', 'd':'directory', 'l':'symlink',
 
243
    _minikind_to_kind = {
 
244
            'a': 'absent',
 
245
            'f': 'file',
 
246
            'd': 'directory',
 
247
            'l':'symlink',
236
248
            'r': 'relocated',
237
249
            't': 'tree-reference',
238
250
        }
1314
1326
        :param tree_index: The index of the tree we wish to locate this path
1315
1327
            in. If the path is present in that tree, the entry containing its
1316
1328
            details is returned, otherwise (None, None) is returned
 
1329
            0 is the working tree, higher indexes are successive parent
 
1330
            trees.
1317
1331
        :param fileid_utf8: A utf8 file_id to look up.
1318
1332
        :param path_utf8: An utf8 path to be looked up.
1319
1333
        :return: The dirstate entry tuple for path, or (None, None)