/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/add.py

  • Committer: Robert Collins
  • Date: 2010-05-06 11:08:10 UTC
  • mto: This revision was merged to the branch mainline in revision 5223.
  • Revision ID: robertc@robertcollins.net-20100506110810-h3j07fh5gmw54s25
Cleaner matcher matching revised unlocking protocol.

Show diffs side-by-side

added added

removed removed

Lines of Context:
12
12
#
13
13
# You should have received a copy of the GNU General Public License
14
14
# along with this program; if not, write to the Free Software
15
 
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
15
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
16
 
17
17
"""Helper functions for adding files to working trees."""
18
18
 
19
 
import errno
20
 
import os
21
19
import sys
22
20
 
23
21
import bzrlib.bzrdir
24
 
import bzrlib.errors as errors
25
22
import bzrlib.osutils
26
23
from bzrlib.symbol_versioning import *
27
 
from bzrlib.workingtree import WorkingTree
28
24
 
29
25
 
30
26
class AddAction(object):
35
31
 
36
32
        :param to_file: The stream to write into. This is expected to take
37
33
            Unicode paths. If not supplied, it will default to ``sys.stdout``.
38
 
        :param should_print: If False, printing will be supressed.
 
34
        :param should_print: If False, printing will be suppressed.
39
35
        """
40
36
        self._to_file = to_file
41
37
        if to_file is None:
54
50
        :param kind: The kind of the object being added.
55
51
        """
56
52
        if self.should_print:
57
 
            self._to_file.write('added %s\n' % _quote(path.raw_path))
 
53
            self._to_file.write('adding %s\n' % _quote(path.raw_path))
58
54
        return None
59
55
 
60
56
 
73
69
        file_id, base_path = self._get_base_file_id(path, parent_ie)
74
70
        if file_id is not None:
75
71
            if self.should_print:
76
 
                self._to_file.write('added %s w/ file id from %s\n'
 
72
                self._to_file.write('adding %s w/ file id from %s\n'
77
73
                                    % (path.raw_path, base_path))
78
74
        else:
79
75
            # we aren't doing anything special, so let the default
110
106
add_action_null = add_action_add
111
107
add_action_add_and_print = AddAction(should_print=True)
112
108
add_action_print = add_action_add_and_print
113
 
 
114
 
 
115
 
@deprecated_function(zero_eighteen)
116
 
def smart_add(file_list, recurse=True, action=None, save=True):
117
 
    """Add files to version, optionally recursing into directories.
118
 
 
119
 
    This is designed more towards DWIM for humans than API simplicity.
120
 
    For the specific behaviour see the help for cmd_add().
121
 
 
122
 
    Returns the number of files added.
123
 
    Deprecated in 0.18. Please use MutableTree.smart_add.
124
 
    """
125
 
    tree = WorkingTree.open_containing(file_list[0])[0]
126
 
    return smart_add_tree(tree, file_list, recurse, action=action, save=save)
127
 
 
128
 
 
129
 
@deprecated_function(zero_eighteen)
130
 
def smart_add_tree(tree, file_list, recurse=True, action=None, save=True):
131
 
    """Deprecated in 0.18. Please use MutableTree.smart_add."""
132
 
    return tree.smart_add(file_list, recurse, action, save)
133