[Pkg-bazaar-commits] ./bzr/unstable r171: better error message when working file rename fails

mbp at sourcefrog.net mbp at sourcefrog.net
Fri Apr 10 07:44:06 UTC 2009


------------------------------------------------------------
revno: 171
committer: mbp at sourcefrog.net
timestamp: Tue 2005-04-05 18:34:04 +1000
message:
  better error message when working file rename fails
modified:
  bzrlib/branch.py
  test.sh
-------------- next part --------------
=== modified file 'bzrlib/branch.py'
--- a/bzrlib/branch.py	2005-04-05 06:49:02 +0000
+++ b/bzrlib/branch.py	2005-04-05 08:34:04 +0000
@@ -730,7 +730,15 @@
         mutter("  to_dir_id  {%s}" % to_dir_id)
             
         inv.rename(file_id, to_dir_id, to_tail)
-        os.rename(self.abspath(from_rel), self.abspath(to_rel))
+        
+        from_abs = self.abspath(from_rel)
+        to_abs = self.abspath(to_rel)
+        try:
+            os.rename(from_abs, to_abs)
+        except OSError, e:
+            bailout("failed to rename %r to %r: %s"
+                    % (from_abs, to_abs, e[1]),
+                    ["rename rolled back"])
 
         self._write_inventory(inv)
             

=== modified file 'test.sh'
--- a/test.sh	2005-04-05 08:20:03 +0000
+++ b/test.sh	2005-04-05 08:34:04 +0000
@@ -78,6 +78,8 @@
 
 bzr commit -m "more renames"
 
+! bzr rename sub1 sub1/knotted-up
+
 
 
 



More information about the Pkg-bazaar-commits mailing list