~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/add.py

  • Committer: Michael Ellerman
  • Date: 2005-12-10 22:11:46 UTC
  • mto: This revision was merged to the branch mainline in revision 1528.
  • Revision ID: michael@ellerman.id.au-20051210221145-7765347ea4ca0093
Raise NoSuchFile when someone tries to add a non-existant file.

Show diffs side-by-side

added added

removed removed

Lines of Context:
85
85
 
86
86
    Returns the number of files added.
87
87
    """
88
 
    import os
 
88
    import os, errno
89
89
    from bzrlib.errors import BadFileKindError, ForbiddenFileError
90
90
    assert isinstance(recurse, bool)
91
91
 
98
98
        rf = tree.relpath(f)
99
99
        af = tree.abspath(rf)
100
100
 
101
 
        kind = bzrlib.osutils.file_kind(af)
 
101
        try:
 
102
            kind = bzrlib.osutils.file_kind(af)
 
103
        except OSError, e:
 
104
            if hasattr(e, 'errno') and e.errno == errno.ENOENT:
 
105
                raise errors.NoSuchFile(rf)
 
106
            raise
102
107
 
103
108
        if not InventoryEntry.versionable_kind(kind):
104
109
            if f in user_list: