/b-gtk/fix-viz

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/b-gtk/fix-viz

« back to all changes in this revision

Viewing changes to olive/backend/fileops.py

  • Committer: Jelmer Vernooij
  • Date: 2006-09-05 01:08:34 UTC
  • mto: (0.8.83 merge)
  • mto: This revision was merged to the branch mainline in revision 83.
  • Revision ID: jelmer@samba.org-20060905010834-93a42bcfcbe57d6c
Remove mkdir, add, rename

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
                           PermissionDenied)
23
23
 
24
24
 
25
 
class DirectoryAlreadyExists(BzrError):
26
 
    """ The specified directory already exists
27
 
    
28
 
    May occur in:
29
 
        fileops.mkdir()
30
 
    """
31
 
 
32
 
 
33
25
class MultipleMoveError(BzrError):
34
26
    """ Occurs when moving/renaming more than 2 files, but the last argument is not a directory
35
27
    
46
38
    """
47
39
 
48
40
 
49
 
def add(file_list, recursive=False):
50
 
    """ Add listed files to the branch. 
51
 
    
52
 
    :param file_list - list of files to be added (using full paths)
53
 
    
54
 
    :param recursive - if True, all unknown files will be added
55
 
    
56
 
    :return: count of ignored files
57
 
    """
58
 
    import bzrlib.add
59
 
    
60
 
    added, ignored = bzrlib.add.smart_add(file_list, recursive)
61
 
    
62
 
    match_len = 0
63
 
    for glob, paths in ignored.items():
64
 
        match_len += len(paths)
65
 
    
66
 
    return match_len
67
 
 
68
 
def mkdir(directory):
69
 
    """ Create new versioned directory.
70
 
    
71
 
    :param directory: the full path to the directory to be created
72
 
    """
73
 
    from bzrlib.workingtree import WorkingTree
74
 
    
75
 
    try:
76
 
        os.mkdir(directory)
77
 
    except OSError, e:
78
 
        if e.errno == 17:
79
 
            raise DirectoryAlreadyExists(directory)
80
 
    else:
81
 
        wt, dd = WorkingTree.open_containing(directory)
82
 
        wt.add([dd])
83
 
 
84
41
def move(names_list):
85
42
    """ Move or rename given files.
86
43
    
127
84
    tree.remove(file_list)
128
85
 
129
86
 
130
 
def rename(source, target):
131
 
    """ Rename a versioned file
132
 
    
133
 
    :param source: full path to the original file
134
 
    
135
 
    :param target: full path to the new file
136
 
    """
137
 
    move([source, target])
138
 
 
139
87
def status(filename):
140
88
    """ Get the status of a file.
141
89