~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/inventory.py

  • Committer: John Arbash Meinel
  • Date: 2006-07-02 05:45:50 UTC
  • mto: This revision was merged to the branch mainline in revision 1851.
  • Revision ID: john@arbash-meinel.com-20060702054550-e535f24da694acb7
make_entry refuses to create non-normalized entries.

Show diffs side-by-side

added added

removed removed

Lines of Context:
36
36
import types
37
37
 
38
38
import bzrlib
 
39
from bzrlib import errors, osutils
39
40
from bzrlib.osutils import (pumpfile, quotefn, splitpath, joinpath,
40
41
                            pathjoin, sha_strings)
41
42
from bzrlib.errors import (NotVersionedError, InvalidEntryName,
1061
1062
 
1062
1063
        Returns the new entry object."""
1063
1064
        
1064
 
        parts = bzrlib.osutils.splitpath(relpath)
 
1065
        parts = osutils.splitpath(relpath)
1065
1066
 
1066
1067
        if len(parts) == 0:
1067
1068
            if file_id is None:
1237
1238
    """
1238
1239
    if file_id is None:
1239
1240
        file_id = bzrlib.workingtree.gen_file_id(name)
 
1241
 
 
1242
    norm_name, can_access = osutils.normalized_filename(name)
 
1243
    if norm_name != name:
 
1244
        if can_access:
 
1245
            name = norm_name
 
1246
        else:
 
1247
            # TODO: jam 20060701 This would probably be more useful
 
1248
            #       if the error was raised with the full path
 
1249
            raise errors.InvalidNormalization(name)
 
1250
 
1240
1251
    if kind == 'directory':
1241
1252
        return InventoryDirectory(file_id, name, parent_id)
1242
1253
    elif kind == 'file':
1247
1258
        raise BzrError("unknown kind %r" % kind)
1248
1259
 
1249
1260
 
1250
 
 
1251
1261
_NAME_RE = None
1252
1262
 
1253
1263
def is_valid_name(name):