~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/transport/local.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:
1
 
# Copyright (C) 2005 Canonical Ltd
 
1
# Copyright (C) 2005, 2006 Canonical Ltd
2
2
 
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
151
151
            # TODO: What about path_to?
152
152
            self._translate_error(e, path_from)
153
153
 
 
154
    def rename(self, rel_from, rel_to):
 
155
        path_from = self.abspath(rel_from)
 
156
        try:
 
157
            # *don't* call bzrlib.osutils.rename, because we want to 
 
158
            # detect errors on rename
 
159
            os.rename(path_from, self.abspath(rel_to))
 
160
        except (IOError, OSError),e:
 
161
            # TODO: What about path_to?
 
162
            self._translate_error(e, path_from)
 
163
 
154
164
    def move(self, rel_from, rel_to):
155
165
        """Move the item at rel_from to the location at rel_to"""
156
166
        path_from = self.abspath(rel_from)
157
167
        path_to = self.abspath(rel_to)
158
168
 
159
169
        try:
 
170
            # this version will delete the destination if necessary
160
171
            rename(path_from, path_to)
161
172
        except (IOError, OSError),e:
162
173
            # TODO: What about path_to?