~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/add.py

  • Committer: Martin Pool
  • Date: 2005-07-29 12:29:27 UTC
  • Revision ID: mbp@sourcefrog.net-20050729122927-d51c2cedc14dd5d5
doc

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
18
 
import bzrlib
19
 
 
20
17
from trace import mutter, note
21
18
 
22
19
def glob_expand_for_win32(file_list):
40
37
    This is designed more towards DWIM for humans than API simplicity.
41
38
    For the specific behaviour see the help for cmd_add().
42
39
    """
 
40
    import os
 
41
    import sys
43
42
    from bzrlib.osutils import quotefn, kind_marker
44
43
    from bzrlib.errors import BadFileKindError, ForbiddenFileError
 
44
    import bzrlib.branch
 
45
    import bzrlib.osutils
45
46
 
46
 
    assert file_list
47
 
    
48
47
    if sys.platform == 'win32':
49
48
        file_list = glob_expand_for_win32(file_list)
 
49
        
 
50
    if not file_list:
 
51
        file_list = ['.']
50
52
    
51
53
    user_list = file_list[:]
52
54
    assert not isinstance(file_list, basestring)
68
70
                print "skipping %s (can't add file of kind '%s')" % (f, kind)
69
71
                continue
70
72
 
71
 
        bzrlib.mutter("smart add of %r, abs=%r" % (f, af))
 
73
        mutter("smart add of %r, abs=%r" % (f, af))
72
74
        
73
75
        if bzrlib.branch.is_control_file(af):
74
76
            raise ForbiddenFileError('cannot add control file %s' % f)
82
84
        else:
83
85
            file_id = bzrlib.branch.gen_file_id(rf)
84
86
            inv.add_path(rf, kind=kind, file_id=file_id)
85
 
            bzrlib.mutter("added %r kind %r file_id={%s}" % (rf, kind, file_id))
 
87
            mutter("added %r kind %r file_id={%s}" % (rf, kind, file_id))
86
88
            count += 1 
87
89
 
88
90
            print 'added', quotefn(f)
102
104
        if verbose:
103
105
            note('added %d' % count)
104
106
        b._write_inventory(inv)
 
107
    else:
 
108
        print "nothing new to add"
 
109
        # should this return 1 to the shell?