~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/add.py

  • Committer: Martin Pool
  • Date: 2005-05-12 02:14:35 UTC
  • Revision ID: mbp@sourcefrog.net-20050512021435-87fa19f051842647
- new helper function kind_marker()

Show diffs side-by-side

added added

removed removed

Lines of Context:
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 types, os, sys, stat
 
17
import os, sys
18
18
import bzrlib
19
19
 
20
20
from osutils import quotefn, appendpath
28
28
    For the specific behaviour see the help for cmd_add().
29
29
    """
30
30
    assert file_list
 
31
    user_list = file_list[:]
31
32
    assert not isinstance(file_list, basestring)
32
33
    b = bzrlib.branch.Branch(file_list[0], find_root=True)
33
34
    inv = b.read_working_inventory()
35
36
    count = 0
36
37
 
37
38
    for f in file_list:
 
39
        kind = bzrlib.osutils.file_kind(f)
 
40
 
 
41
        if kind != 'file' and kind != 'directory':
 
42
            if f not in user_list:
 
43
                print "Skipping %s (can't add file of kind '%s')" % (f, kind)
 
44
                continue
 
45
            bailout("can't add file of kind %r" % kind)
 
46
 
38
47
        rf = b.relpath(f)
39
48
        af = b.abspath(rf)
40
49
 
48
57
        kind = bzrlib.osutils.file_kind(f)
49
58
 
50
59
        if kind != 'file' and kind != 'directory':
51
 
            bailout("can't add file of kind %r" % kind)
 
60
            bailout("can't add file '%s' of kind %r" % (f, kind))
52
61
            
53
62
        versioned = (inv.path2id(rf) != None)
54
63