~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/add.py

  • Committer: Martin Pool
  • Date: 2005-07-04 11:57:18 UTC
  • Revision ID: mbp@sourcefrog.net-20050704115718-b532986c0714e7a7
- don't write precursor field in new revision xml
- make parents more primary; remove more precursor code
- test commit of revision with parents

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
 
20
20
from trace import mutter, note
21
21
 
 
22
def glob_expand_for_win32(file_list):
 
23
    import glob
 
24
    
 
25
    expanded_file_list = []
 
26
    for possible_glob in file_list:
 
27
        glob_files = glob.glob(possible_glob)
 
28
       
 
29
        if glob_files == []:
 
30
            # special case to let the normal code path handle
 
31
            # files that do not exists
 
32
            expanded_file_list.append(possible_glob)
 
33
        else:
 
34
            expanded_file_list += glob_files
 
35
    return expanded_file_list
 
36
 
22
37
def smart_add(file_list, verbose=True, recurse=True):
23
38
    """Add files to version, optionally recursing into directories.
24
39
 
29
44
    from bzrlib.errors import BadFileKindError, ForbiddenFileError
30
45
 
31
46
    assert file_list
 
47
    
 
48
    if sys.platform == 'win32':
 
49
        file_list = glob_expand_for_win32(file_list)
 
50
    
32
51
    user_list = file_list[:]
33
52
    assert not isinstance(file_list, basestring)
34
53
    b = bzrlib.branch.Branch(file_list[0], find_root=True)
49
68
                print "skipping %s (can't add file of kind '%s')" % (f, kind)
50
69
                continue
51
70
 
52
 
        bzrlib.mutter("smart add of %r, abs=%r" % (f, af))
 
71
        mutter("smart add of %r, abs=%r" % (f, af))
53
72
        
54
73
        if bzrlib.branch.is_control_file(af):
55
74
            raise ForbiddenFileError('cannot add control file %s' % f)
63
82
        else:
64
83
            file_id = bzrlib.branch.gen_file_id(rf)
65
84
            inv.add_path(rf, kind=kind, file_id=file_id)
66
 
            bzrlib.mutter("added %r kind %r file_id={%s}" % (rf, kind, file_id))
 
85
            mutter("added %r kind %r file_id={%s}" % (rf, kind, file_id))
67
86
            count += 1 
68
87
 
69
88
            print 'added', quotefn(f)