~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/add.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2007-06-12 02:17:42 UTC
  • mfrom: (2521.1.1 56322)
  • Revision ID: pqm@pqm.ubuntu.com-20070612021742-uetsy3g747iq3xkk
mergeĀ initĀ --create-prefix

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
from os.path import dirname
20
20
import sys
21
21
 
 
22
import bzrlib.bzrdir
22
23
import bzrlib.errors as errors
23
24
from bzrlib.inventory import InventoryEntry
24
25
from bzrlib.trace import mutter, note, warning
168
169
 
169
170
 
170
171
def smart_add_tree(tree, file_list, recurse=True, action=None, save=True):
 
172
    tree.lock_tree_write()
 
173
    try:
 
174
        return _smart_add_tree(tree=tree, file_list=file_list, recurse=recurse,
 
175
                               action=action, save=save)
 
176
    finally:
 
177
        tree.unlock()
 
178
 
 
179
def _smart_add_tree(tree, file_list, recurse=True, action=None, save=True):
171
180
    """Add files to version, optionally recursing into directories.
172
181
 
173
182
    This is designed more towards DWIM for humans than API simplicity.
203
212
        # validate user parameters. Our recursive code avoids adding new files
204
213
        # that need such validation 
205
214
        if tree.is_control_filename(rf.raw_path):
206
 
            raise errors.ForbiddenControlFileError(filename=rf)
 
215
            raise errors.ForbiddenControlFileError(filename=rf.raw_path)
207
216
        
208
217
        abspath = tree.abspath(rf.raw_path)
209
218
        kind = bzrlib.osutils.file_kind(abspath)
278
287
            pass
279
288
            # mutter("%r is already versioned", abspath)
280
289
        elif sub_tree:
 
290
            # XXX: This is wrong; people *might* reasonably be trying to add
 
291
            # subtrees as subtrees.  This should probably only be done in formats 
 
292
            # which can represent subtrees, and even then perhaps only when
 
293
            # the user asked to add subtrees.  At the moment you can add them
 
294
            # specially through 'join --reference', which is perhaps
 
295
            # reasonable: adding a new reference is a special operation and
 
296
            # can have a special behaviour.  mbp 20070306
281
297
            mutter("%r is a nested bzr tree", abspath)
282
298
        else:
283
299
            __add_one(tree, inv, parent_ie, directory, kind, action)