~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/add.py

  • Committer: John Arbash Meinel
  • Date: 2006-06-18 02:21:57 UTC
  • mfrom: (1787 +trunk)
  • mto: This revision was merged to the branch mainline in revision 1794.
  • Revision ID: john@arbash-meinel.com-20060618022157-6e33aa9b67c25e4f
[merge] bzr.dev 1787

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2005, 2006 Canonical Ltd
 
1
# Copyright (C) 2005 Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
14
14
# along with this program; if not, write to the Free Software
15
15
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
16
16
 
17
 
import errno
18
 
import os
 
17
import sys
19
18
from os.path import dirname
20
 
import sys
21
19
 
22
20
import bzrlib.errors as errors
23
21
from bzrlib.inventory import InventoryEntry
134
132
    further dry-run tasks to take place. To restore the original inventory
135
133
    call tree.read_working_inventory().
136
134
    """
 
135
    import os, errno
 
136
    from bzrlib.errors import BadFileKindError, ForbiddenFileError
137
137
    assert isinstance(recurse, bool)
138
138
    if action is None:
139
139
        action = AddAction()
154
154
        # validate user parameters. Our recursive code avoids adding new files
155
155
        # that need such validation 
156
156
        if tree.is_control_filename(rf.raw_path):
157
 
            raise errors.ForbiddenControlFileError(filename=rf)
 
157
            raise ForbiddenFileError('cannot add control file %s' % filepath)
158
158
        
159
159
        abspath = tree.abspath(rf.raw_path)
160
160
        kind = bzrlib.osutils.file_kind(abspath)
163
163
            user_dirs.add(rf.raw_path)
164
164
        else:
165
165
            if not InventoryEntry.versionable_kind(kind):
166
 
                raise errors.BadFileKindError(filename=abspath, kind=kind)
 
166
                raise BadFileKindError("cannot add %s of type %s" % (abspath, kind))
167
167
        # ensure the named path is added, so that ignore rules in the later directory
168
168
        # walk dont skip it.
169
169
        # we dont have a parent ie known yet.: use the relatively slower inventory