2006-07-06 Szilveszter Farkas <Szilveszter.Farkas@gmail.com>
* I'm not dead :) * backend/errors.py: added some exceptions related to fileops.move() * backend/fileops.py: implemented move() * backend/info_helper.py: added diff_helper() * backend/info.py: implemented diff()
:param file_list - list of files to be added (using full paths)
31
32
:return: count of ignored files
33
"""
34
import bzrlib.add
35
36
added, ignored = bzrlib.add.smart_add(file_list)
37
38
match_len = 0
39
for glob, paths in ignored.items():
40
match_len += len(paths)
41
42
return match_len
43
26
44
def mkdir(directory):
27
45
""" Create new versioned directory.
28
46
39
57
wt, dd = WorkingTree.open_containing(directory)
40
58
wt.add([dd])
41
59
42
def add(file_list):
43
""" Add listed files to the branch.
44
45
:param file_list - list of files to be added (using full paths)
46
47
:return: count of ignored files
60
def move(names_list):
61
""" Move or rename given files.
62
63
:param file_list: if two elements, then rename the first to the second, if more elements then move all of them to the directory specified in the last element
48
64
"""
49
import bzrlib.add
50
51
added, ignored = bzrlib.add.smart_add(file_list)
52
53
match_len = 0
54
for glob, paths in ignored.items():
55
match_len += len(paths)
56
57
return match_len
65
from bzrlib.builtins import tree_files
66
67
if len(names_list) < 2:
68
raise MissingArgumentError
69
tree, rel_names = tree_files(names_list)
70
71
if os.path.isdir(names_list[-1]):
72
# move into existing directory
73
for pair in tree.move(rel_names[:-1], rel_names[-1]):