~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/add.py

  • Committer: mbp at sourcefrog
  • Date: 2005-03-28 02:24:18 UTC
  • Revision ID: mbp@sourcefrog.net-20050328022418-9d37f56361aa18e9
doc: more on ignore patterns

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 os, sys
 
17
import types, os, sys, stat
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[:]
32
31
    assert not isinstance(file_list, basestring)
33
32
    b = bzrlib.branch.Branch(file_list[0], find_root=True)
34
33
    inv = b.read_working_inventory()
39
38
        rf = b.relpath(f)
40
39
        af = b.abspath(rf)
41
40
 
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))
 
41
        ## TODO: It's OK to add root but only in recursive mode
 
42
 
 
43
        bzrlib.mutter("smart add of %r" % f)
51
44
        
52
45
        if bzrlib.branch.is_control_file(af):
53
46
            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)
54
52
            
55
53
        versioned = (inv.path2id(rf) != None)
56
54
 
74
72
                elif tree.is_ignored(subp):
75
73
                    mutter("skip ignored sub-file %r" % subp)
76
74
                else:
77
 
                    mutter("queue to add sub-file %r" % subp)
78
 
                    file_list.append(b.abspath(subp))
 
75
                    mutter("queue to add sub-file %r" % (subp))
 
76
                    file_list.append(subp)
79
77
 
80
78
    if count > 0:
81
79
        if verbose: