/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/transport/__init__.py

  • Committer: Martin Pool
  • Date: 2006-02-21 06:02:01 UTC
  • mto: This revision was merged to the branch mainline in revision 1569.
  • Revision ID: mbp@sourcefrog.net-20060221060201-5f260bfe331bdc42
New Transport.rename that mustn't overwrite
Change LockDir.is_held to be a property

Show diffs side-by-side

added added

removed removed

Lines of Context:
225
225
 
226
226
    def iter_files_recursive(self):
227
227
        """Iter the relative paths of files in the transports sub-tree.
 
228
 
 
229
        *NOTE*: This only lists *files*, not subdirectories!
228
230
        
229
231
        As with other listing functions, only some transports implement this,.
230
232
        you may check via is_listable to determine if it will.
360
362
                    files.append(path)
361
363
        source.copy_to(files, target)
362
364
 
 
365
    def rename(self, rel_from, rel_to):
 
366
        """Rename a file or directory.
 
367
 
 
368
        This *must* fail if the destination is a nonempty directory - it must
 
369
        not automatically remove it.  It should raise DirectoryNotEmpty, or
 
370
        some other PathError if the case can't be specifically detected.
 
371
 
 
372
        If the destination is an empty directory or a file this function may
 
373
        either fail or succeed, depending on the underlying transport.  It
 
374
        should not attempt to remove the destination if overwriting is not the
 
375
        native transport behaviour.  If at all possible the transport should
 
376
        ensure that the rename either completes or not, without leaving the
 
377
        destination deleted and the new file not moved in place.
 
378
 
 
379
        This is intended mainly for use in implementing LockDir.
 
380
        """
 
381
        # transports may need to override this
 
382
        self.move(rel_from, rel_to)
 
383
 
363
384
    def move(self, rel_from, rel_to):
364
385
        """Move the item at rel_from to the location at rel_to.
 
386
 
 
387
        The destination is deleted if possible, even if it's a non-empty
 
388
        directory tree.
365
389
        
366
390
        If a transport can directly implement this it is suggested that
367
391
        it do so for efficiency.