Rev 3020: Return error instead of a traceback when bzr is unable to create in file:///home/pqm/archives/thelove/bzr/%2Btrunk/
Canonical.com Patch Queue Manager
pqm at pqm.ubuntu.com
Fri Nov 23 18:44:17 GMT 2007
At file:///home/pqm/archives/thelove/bzr/%2Btrunk/
------------------------------------------------------------
revno: 3020
revision-id:pqm at pqm.ubuntu.com-20071123184413-m5uanmtvxcllbjee
parent: pqm at pqm.ubuntu.com-20071123180904-3kz353cj0hjvht0t
parent: bialix at ukr.net-20071123175537-wke5mt9hxkh92xc2
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Fri 2007-11-23 18:44:13 +0000
message:
Return error instead of a traceback when bzr is unable to create
symlink on some platforms (e.g. on Windows). (workaround for #81689)
modified:
NEWS NEWS-20050323055033-4e00b5db738777ff
bzrlib/errors.py errors.py-20050309040759-20512168c4e14fbd
bzrlib/tests/test_errors.py test_errors.py-20060210110251-41aba2deddf936a8
bzrlib/tests/test_transform.py test_transaction.py-20060105172520-b3ffb3946550e6c4
bzrlib/transform.py transform.py-20060105172343-dd99e54394d91687
------------------------------------------------------------
revno: 3006.2.5
revision-id:bialix at ukr.net-20071123175537-wke5mt9hxkh92xc2
parent: bialix at ukr.net-20071123090127-vkjuovtxi4f7doqt
parent: pqm at pqm.ubuntu.com-20071123165103-6t1a4k7ylgipy76m
committer: Alexander Belchenko <bialix at ukr.net>
branch nick: win32.symlink.workaround
timestamp: Fri 2007-11-23 19:55:37 +0200
message:
merge bzr.dev
added:
bzrlib/switch.py switch.py-20071116011000-v5lnw7d2wkng9eux-1
bzrlib/tests/blackbox/test_switch.py test_switch.py-20071122111948-0c5en6uz92bwl76h-1
bzrlib/tests/repository_implementations/test__generate_text_key_index.py test__generate_text_-20071114232121-00h9fd8qg8kjfa5k-1
bzrlib/tests/repository_implementations/test_find_text_key_references.py test_find_text_key_r-20071114033605-v73bakal8x77qlfi-1
bzrlib/tests/test_switch.py test_switch.py-20071116011000-v5lnw7d2wkng9eux-2
modified:
NEWS NEWS-20050323055033-4e00b5db738777ff
bzrlib/annotate.py annotate.py-20050922133147-7c60541d2614f022
bzrlib/builtins.py builtins.py-20050830033751-fc01482b9ca23183
bzrlib/bzrdir.py bzrdir.py-20060131065624-156dfea39c4387cb
bzrlib/check.py check.py-20050309040759-f3a679400c06bcc1
bzrlib/config.py config.py-20051011043216-070c74f4e9e338e8
bzrlib/graph.py graph_walker.py-20070525030359-y852guab65d4wtn0-1
bzrlib/msgeditor.py msgeditor.py-20050901111708-ef6d8de98f5d8f2f
bzrlib/reconcile.py reweave_inventory.py-20051108164726-1e5e0934febac06e
bzrlib/remote.py remote.py-20060720103555-yeeg2x51vn0rbtdp-1
bzrlib/repofmt/knitrepo.py knitrepo.py-20070206081537-pyy4a00xdas0j4pf-1
bzrlib/repofmt/pack_repo.py pack_repo.py-20070813041115-gjv5ma7ktfqwsjgn-1
bzrlib/repository.py rev_storage.py-20051111201905-119e9401e46257e3
bzrlib/revision.py revision.py-20050309040759-e77802c08f3999d5
bzrlib/revisionspec.py revisionspec.py-20050907152633-17567659fd5c0ddb
bzrlib/sign_my_commits.py sign_my_commits.py-20060215152201-5a6363365180e671
bzrlib/tests/__init__.py selftest.py-20050531073622-8d0e3c8845c97a64
bzrlib/tests/blackbox/__init__.py __init__.py-20051128053524-eba30d8255e08dc3
bzrlib/tests/blackbox/test_info.py test_info.py-20060215045507-bbdd2d34efab9e0a
bzrlib/tests/blackbox/test_reconcile.py test_fix.py-20060223013051-9a188e15a5ee9451
bzrlib/tests/blackbox/test_versioning.py versioning.py-20050622071821-3ddf5e2e5e93c602
bzrlib/tests/interrepository_implementations/test_interrepository.py test_interrepository.py-20060220061411-1ec13fa99e5e3eee
bzrlib/tests/repository_implementations/__init__.py __init__.py-20060131092037-9564957a7d4a841b
bzrlib/tests/repository_implementations/test_check.py test_check.py-20070824124512-38g4d135gcqxo4zb-1
bzrlib/tests/repository_implementations/test_check_reconcile.py test_broken.py-20070928125406-62236394w0jpbpd6-2
bzrlib/tests/repository_implementations/test_repository.py test_repository.py-20060131092128-ad07f494f5c9d26c
bzrlib/tests/test_annotate.py test_annotate.py-20061213215015-sttc9agsxomls7q0-1
bzrlib/tests/test_commit.py test_commit.py-20050914060732-279f057f8c295434
bzrlib/tests/test_config.py testconfig.py-20051011041908-742d0c15d8d8c8eb
bzrlib/tests/test_dirstate.py test_dirstate.py-20060728012006-d6mvoihjb3je9peu-2
bzrlib/tests/test_fetch.py testfetch.py-20050825090644-f73e07e7dfb1765a
bzrlib/tests/test_graph.py test_graph_walker.py-20070525030405-enq4r60hhi9xrujc-1
bzrlib/tests/test_info.py test_info.py-20070320150933-m0xxm1g7xi9v6noe-1
bzrlib/tests/test_memorytree.py test_memorytree.py-20060906023413-4wlkalbdpsxi2r4y-3
bzrlib/tests/test_merge_core.py test_merge_core.py-20050824132511-eb99b23a0eec641b
bzrlib/tests/test_merge_directive.py test_merge_directive-20070228184838-ja62280spt1g7f4x-2
bzrlib/tests/test_msgeditor.py test_msgeditor.py-20051202041359-920315ec6011ee51
bzrlib/tests/test_transport_implementations.py test_transport_implementations.py-20051227111451-f97c5c7d5c49fce7
bzrlib/transform.py transform.py-20060105172343-dd99e54394d91687
bzrlib/transport/local.py local_transport.py-20050711165921-9b1f142bfe480c24
bzrlib/transport/memory.py memory.py-20051016101338-cd008dbdf69f04fc
bzrlib/util/configobj/configobj.py configobj.py-20051018184548-06992a2246425e3e
bzrlib/util/configobj/docs/BSD-LICENSE.txt BSDLICENSE.txt-20051018184548-29b89ff3102657f5
bzrlib/util/configobj/docs/configobj.txt configobj.txt-20051018184548-4949b5f17e6a19c7
bzrlib/util/configobj/docs/validate.txt validate.txt-20051018184548-9e0e5ad913e258f5
------------------------------------------------------------
revno: 3006.2.4
revision-id:bialix at ukr.net-20071123090127-vkjuovtxi4f7doqt
parent: bialix at ukr.net-20071123085557-73537k0owfjrwzir
committer: Alexander Belchenko <bialix at ukr.net>
branch nick: win32.symlink.workaround
timestamp: Fri 2007-11-23 11:01:27 +0200
message:
NEWS
modified:
NEWS NEWS-20050323055033-4e00b5db738777ff
------------------------------------------------------------
revno: 3006.2.3
revision-id:bialix at ukr.net-20071123085557-73537k0owfjrwzir
parent: bialix at ukr.net-20071123083124-qwnpye1f4149z9b5
parent: pqm at pqm.ubuntu.com-20071121045727-gqycrul94d0ssir1
committer: Alexander Belchenko <bialix at ukr.net>
branch nick: win32.symlink.workaround
timestamp: Fri 2007-11-23 10:55:57 +0200
message:
merge bzr.dev
modified:
NEWS NEWS-20050323055033-4e00b5db738777ff
bzrlib/builtins.py builtins.py-20050830033751-fc01482b9ca23183
bzrlib/fetch.py fetch.py-20050818234941-26fea6105696365d
bzrlib/osutils.py osutils.py-20050309040759-eeaff12fbf77ac86
bzrlib/tests/blackbox/test_mv.py test_mv.py-20060705114902-33tkxz0o9cdshemo-1
bzrlib/tests/test_osutils.py test_osutils.py-20051201224856-e48ee24c12182989
bzrlib/workingtree.py workingtree.py-20050511021032-29b6ec0a681e02e3
------------------------------------------------------------
revno: 3006.2.2
revision-id:bialix at ukr.net-20071123083124-qwnpye1f4149z9b5
parent: bialix at ukr.net-20071122092346-qsfs9z0yqvhzm9pa
committer: Alexander Belchenko <bialix at ukr.net>
branch nick: win32.symlink.workaround
timestamp: Fri 2007-11-23 10:31:24 +0200
message:
tests added.
modified:
bzrlib/errors.py errors.py-20050309040759-20512168c4e14fbd
bzrlib/tests/test_errors.py test_errors.py-20060210110251-41aba2deddf936a8
bzrlib/tests/test_transform.py test_transaction.py-20060105172520-b3ffb3946550e6c4
bzrlib/transform.py transform.py-20060105172343-dd99e54394d91687
------------------------------------------------------------
revno: 3006.2.1
revision-id:bialix at ukr.net-20071122092346-qsfs9z0yqvhzm9pa
parent: pqm at pqm.ubuntu.com-20071117180742-59zhz30s7839y41j
committer: Alexander Belchenko <bialix at ukr.net>
branch nick: win32.symlink.workaround
timestamp: Thu 2007-11-22 11:23:46 +0200
message:
workaround for bug #81689: give a proper error message instead of traceback when symlink cannot be created (e.g. on Windows)
modified:
bzrlib/errors.py errors.py-20050309040759-20512168c4e14fbd
bzrlib/transform.py transform.py-20060105172343-dd99e54394d91687
=== modified file 'NEWS'
--- a/NEWS 2007-11-23 17:33:38 +0000
+++ b/NEWS 2007-11-23 18:44:13 +0000
@@ -70,6 +70,12 @@
retrying an http request or some programming errors may be masked.
(Vincent Ladeuil, #160012)
+ * Fix exception when revisionspec contains merge revisons but log
+ formatter doesn't support merge revisions. (Kent Gibson, #148908)
+
+ * Fix exception when ScopeReplacer is assigned to before any members have
+ been retrieved. (Aaron Bentley)
+
* Fix multiple connections during checkout --lightweight.
(Vincent Ladeuil, #159150)
@@ -100,6 +106,13 @@
* Rename on Windows is able to change filename case.
(Alexander Belchenko, #77740)
+ * Return error instead of a traceback for ``bzr log -r0``.
+ (Kent Gibson, #133751)
+
+ * Return error instead of a traceback when bzr is unable to create
+ symlink on some platforms (e.g. on Windows).
+ (Alexander Belchenko, workaround for #81689)
+
* Stderr output via logging mechanism now goes through encoded wrapper
and no more uses utf-8, but terminal encoding instead. So all unicode
strings now should be readable in non-utf-8 terminal.
@@ -112,24 +125,15 @@
using the terminal encoding and unrepresentable characters will be
replaced by '?'. (Lukáš Lalinský, #151844)
+ * Working trees are no longer created when pushing into a local no-trees
+ repo. (Daniel Watkins, #50582)
+
+ * Upgrade util/configobj to version 4.4.0.
+ (Vincent Ladeuil, #151208).
+
* Wrap medusa ftp test server as an FTPServer feature.
(Vincent Ladeuil, #157752)
- * Fix exception when ScopeReplacer is assigned to before any members have
- been retrieved. (Aaron Bentley)
-
- * Fix exception when revisionspec contains merge revisons but log
- formatter doesn't support merge revisions. (Kent Gibson, #148908)
-
- * Return error instead of a traceback for ``bzr log -r0``.
- (Kent Gibson, #133751)
-
- * Upgrade util/configobj to version 4.4.0.
- (Vincent Ladeuil, #151208).
-
- * Working trees are no longer created when pushing into a local no-trees
- repo. (Daniel Watkins, #50582)
-
API BREAKS:
* ``osutils.backup_file`` is deprecated. Actually it's not used in bzrlib
=== modified file 'bzrlib/errors.py'
--- a/bzrlib/errors.py 2007-11-13 21:26:46 +0000
+++ b/bzrlib/errors.py 2007-11-23 08:31:24 +0000
@@ -252,6 +252,7 @@
self.revision_id = revision_id
self.branch = branch
+
class ReservedId(BzrError):
_fmt = "Reserved revision-id {%(revision_id)s}"
@@ -2447,3 +2448,18 @@
display_url = urlutils.unescape_for_display(
tree.bzrdir.root_transport.base, 'ascii')
BzrError.__init__(self, tree=tree, display_url=display_url)
+
+
+class UnableCreateSymlink(BzrError):
+
+ _fmt = 'Unable to create symlink %(path_str)son this platform'
+
+ def __init__(self, path=None):
+ path_str = ''
+ if path:
+ try:
+ path_str = repr(str(path))
+ except UnicodeEncodeError:
+ path_str = repr(path)
+ path_str += ' '
+ self.path_str = path_str
=== modified file 'bzrlib/tests/test_errors.py'
--- a/bzrlib/tests/test_errors.py 2007-11-13 21:01:26 +0000
+++ b/bzrlib/tests/test_errors.py 2007-11-23 08:31:24 +0000
@@ -26,7 +26,6 @@
from bzrlib.tests import TestCase, TestCaseWithTransport
-
class TestErrors(TestCaseWithTransport):
def test_disabled_method(self):
@@ -390,6 +389,20 @@
"you wish to keep, and delete it when you are done.",
str(err))
+ def test_unable_create_symlink(self):
+ err = errors.UnableCreateSymlink()
+ self.assertEquals(
+ "Unable to create symlink on this platform",
+ str(err))
+ err = errors.UnableCreateSymlink(path=u'foo')
+ self.assertEquals(
+ "Unable to create symlink 'foo' on this platform",
+ str(err))
+ err = errors.UnableCreateSymlink(path=u'\xb5')
+ self.assertEquals(
+ "Unable to create symlink u'\\xb5' on this platform",
+ str(err))
+
class PassThroughError(errors.BzrError):
=== modified file 'bzrlib/tests/test_transform.py'
--- a/bzrlib/tests/test_transform.py 2007-11-01 09:52:45 +0000
+++ b/bzrlib/tests/test_transform.py 2007-11-23 08:31:24 +0000
@@ -410,6 +410,26 @@
self.assertEqual(os.readlink(self.wt.abspath('oz/wizard')),
'wizard-target')
+ def test_unable_create_symlink(self):
+ def tt_helper():
+ wt = self.make_branch_and_tree('.')
+ tt = TreeTransform(wt) # TreeTransform obtains write lock
+ try:
+ tt.new_symlink('foo', tt.root, 'bar')
+ tt.apply()
+ finally:
+ wt.unlock()
+ os_symlink = getattr(os, 'symlink', None)
+ os.symlink = None
+ try:
+ err = self.assertRaises(errors.UnableCreateSymlink, tt_helper)
+ self.assertEquals(
+ "Unable to create symlink 'foo' on this platform",
+ str(err))
+ finally:
+ if os_symlink:
+ os.symlink = os_symlink
+
def get_conflicted(self):
create,root = self.get_transform()
create.new_file('dorothy', root, 'dorothy', 'dorothy-id')
@@ -1167,7 +1187,7 @@
class TestBuildTree(tests.TestCaseWithTransport):
- def test_build_tree(self):
+ def test_build_tree_with_symlinks(self):
self.requireFeature(SymlinkFeature)
os.mkdir('a')
a = BzrDir.create_standalone_workingtree('a')
=== modified file 'bzrlib/transform.py'
--- a/bzrlib/transform.py 2007-11-21 22:24:44 +0000
+++ b/bzrlib/transform.py 2007-11-23 17:55:37 +0000
@@ -29,10 +29,11 @@
""")
from bzrlib.errors import (DuplicateKey, MalformedTransform, NoSuchFile,
ReusingTransform, NotVersionedError, CantMoveRoot,
- ExistingLimbo, ImmortalLimbo, NoFinalPath)
+ ExistingLimbo, ImmortalLimbo, NoFinalPath,
+ UnableCreateSymlink)
from bzrlib.inventory import InventoryEntry
from bzrlib.osutils import (file_kind, supports_executable, pathjoin, lexists,
- delete_any)
+ delete_any, has_symlinks)
from bzrlib.progress import DummyProgress, ProgressPhase
from bzrlib.symbol_versioning import (
deprecated_function,
@@ -439,8 +440,15 @@
target is a bytestring.
See also new_symlink.
"""
- os.symlink(target, self._limbo_name(trans_id))
- unique_add(self._new_contents, trans_id, 'symlink')
+ if has_symlinks():
+ os.symlink(target, self._limbo_name(trans_id))
+ unique_add(self._new_contents, trans_id, 'symlink')
+ else:
+ try:
+ path = FinalPaths(self).get_path(trans_id)
+ except KeyError:
+ path = None
+ raise UnableCreateSymlink(path=path)
def cancel_creation(self, trans_id):
"""Cancel the creation of new file contents."""
@@ -1289,6 +1297,7 @@
self._known_paths[trans_id] = self._determine_path(trans_id)
return self._known_paths[trans_id]
+
def topology_sorted_ids(tree):
"""Determine the topological order of the ids in a tree"""
file_ids = list(tree)
@@ -1320,6 +1329,7 @@
finally:
wt.unlock()
+
def _build_tree(tree, wt):
"""See build_tree."""
if len(wt.inventory) > 1: # more than just a root
@@ -1490,6 +1500,7 @@
else:
raise errors.BadFileKindError(name, kind)
+
def create_by_entry(tt, entry, tree, trans_id, lines=None, mode_id=None):
"""Create new file contents according to an inventory entry."""
if entry.kind == "file":
@@ -1501,6 +1512,7 @@
elif entry.kind == "directory":
tt.create_directory(trans_id)
+
def create_entry_executability(tt, entry, trans_id):
"""Set the executability of a trans_id according to an inventory entry"""
if entry.kind == "file":
More information about the bazaar-commits
mailing list