~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/add.py

  • Committer: Martin Pool
  • Date: 2005-05-30 03:05:03 UTC
  • Revision ID: mbp@sourcefrog.net-20050530030503-8fd9959e40c31eeb
todo

Show diffs side-by-side

added added

removed removed

Lines of Context:
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()
38
39
        rf = b.relpath(f)
39
40
        af = b.abspath(rf)
40
41
 
41
 
        ## TODO: It's OK to add root but only in recursive mode
42
 
 
43
 
        bzrlib.mutter("smart add of %r" % f)
 
42
        kind = bzrlib.osutils.file_kind(af)
 
43
 
 
44
        if kind != 'file' and kind != 'directory':
 
45
            if f not in user_list:
 
46
                print "Skipping %s (can't add file of kind '%s')" % (f, kind)
 
47
                continue
 
48
            bailout("can't add file of kind %r" % kind)
 
49
 
 
50
        bzrlib.mutter("smart add of %r, abs=%r" % (f, af))
44
51
        
45
52
        if bzrlib.branch.is_control_file(af):
46
53
            bailout("cannot add control file %r" % af)
47
 
 
48
 
        kind = bzrlib.osutils.file_kind(f)
49
 
 
50
 
        if kind != 'file' and kind != 'directory':
51
 
            bailout("can't add file of kind %r" % kind)
52
54
            
53
55
        versioned = (inv.path2id(rf) != None)
54
56
 
72
74
                elif tree.is_ignored(subp):
73
75
                    mutter("skip ignored sub-file %r" % subp)
74
76
                else:
75
 
                    mutter("queue to add sub-file %r" % (subp))
76
 
                    file_list.append(subp)
 
77
                    mutter("queue to add sub-file %r" % subp)
 
78
                    file_list.append(b.abspath(subp))
77
79
 
78
80
    if count > 0:
79
81
        if verbose: