~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/transform.py

  • Committer: Alexander Belchenko
  • Date: 2007-11-22 09:23:46 UTC
  • mto: This revision was merged to the branch mainline in revision 3020.
  • Revision ID: bialix@ukr.net-20071122092346-qsfs9z0yqvhzm9pa
workaround for bug #81689: give a proper error message instead of traceback when symlink cannot be created (e.g. on Windows)

Show diffs side-by-side

added added

removed removed

Lines of Context:
29
29
""")
30
30
from bzrlib.errors import (DuplicateKey, MalformedTransform, NoSuchFile,
31
31
                           ReusingTransform, NotVersionedError, CantMoveRoot,
32
 
                           ExistingLimbo, ImmortalLimbo, NoFinalPath)
 
32
                           ExistingLimbo, ImmortalLimbo, NoFinalPath,
 
33
                           UnableCreateSymlink)
33
34
from bzrlib.inventory import InventoryEntry
34
35
from bzrlib.osutils import (file_kind, supports_executable, pathjoin, lexists,
35
 
                            delete_any)
 
36
                            delete_any, has_symlinks)
36
37
from bzrlib.progress import DummyProgress, ProgressPhase
37
38
from bzrlib.symbol_versioning import (
38
39
        deprecated_function,
387
388
        target is a bytestring.
388
389
        See also new_symlink.
389
390
        """
390
 
        os.symlink(target, self._limbo_name(trans_id))
391
 
        unique_add(self._new_contents, trans_id, 'symlink')
 
391
        if has_symlinks():
 
392
            os.symlink(target, self._limbo_name(trans_id))
 
393
            unique_add(self._new_contents, trans_id, 'symlink')
 
394
        else:
 
395
            raise UnableCreateSymlink
392
396
 
393
397
    def cancel_creation(self, trans_id):
394
398
        """Cancel the creation of new file contents."""