Rev 843: Fix opening unicode names during fetch. in file:///data/jelmer/bzr-svn/0.4/
Jelmer Vernooij
jelmer at samba.org
Fri Jan 18 04:05:55 GMT 2008
At file:///data/jelmer/bzr-svn/0.4/
------------------------------------------------------------
revno: 843
revision-id:jelmer at samba.org-20080118034930-eyyjndgbru0rcl30
parent: jelmer at samba.org-20080118033541-ppue6qsddp6sxm8s
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: 0.4
timestamp: Fri 2008-01-18 04:49:30 +0100
message:
Fix opening unicode names during fetch.
modified:
AUTHORS AUTHORS-20060508114718-4c90c0062645106d
NEWS news-20061231030336-h9fhq245ie0de8bs-1
fetch.py fetch.py-20060625004942-x2lfaib8ra707a8p-1
tests/test_fetch.py test_fetch.py-20070624210302-luvgwjmlfysk5qeq-1
=== modified file 'AUTHORS'
--- a/AUTHORS 2007-12-21 23:01:58 +0000
+++ b/AUTHORS 2008-01-18 03:49:30 +0000
@@ -1,10 +1,10 @@
Jelmer Vernooij <jelmer at samba.org>
Thanks to David Allouche, Erik Bågfors, Andrew Bennetts, Aaron Bentley,
-Max Bowser, Jerry Carter, Robert Collins, Wouter van Heyst, Michael Hudson,
-David James, Jan Kneschke, Luká¿ Lalinský, Matthias Klose, Roland Mas,
-John Arbash Meinel, Stefan Metzmacher, Andrew Mitchell, Gustavo Niemeyer,
-Martin Pool, Garrett Rooney, Johan Rydberg, Peter Samuelson, Mark Shuttleworth,
-Adeodato Simó, Mikhail Sobolev and Reinhard Tartler for comments, code reviews,
-funding, bug reports, testing, committing patches/bundles and generally keeping
-up while I was asking annoying questions.
+Max Bowser, Jerry Carter, Robert Collins, David Foerster, Wouter van Heyst,
+Michael Hudson, David James, Jan Kneschke, Luká¿ Lalinský, Matthias Klose,
+Roland Mas, John Arbash Meinel, Stefan Metzmacher, Andrew Mitchell,
+Gustavo Niemeyer, Martin Pool, Garrett Rooney, Johan Rydberg, Peter Samuelson,
+Mark Shuttleworth, Adeodato Simó, Mikhail Sobolev and Reinhard Tartler for
+comments, code reviews, funding, bug reports, testing, committing
+patches/bundles and generally keeping up while I was asking annoying questions.
=== modified file 'NEWS'
--- a/NEWS 2008-01-18 03:35:41 +0000
+++ b/NEWS 2008-01-18 03:49:30 +0000
@@ -2,6 +2,8 @@
BUGS
+ * Fix opening unicode file names during fetch. (#162368)
+
* Consistently handle unicode characters. (#129334, #164381)
* Handle unicode strings appropriately when reading working tree
=== modified file 'fetch.py'
--- a/fetch.py 2008-01-17 23:42:21 +0000
+++ b/fetch.py 2008-01-18 03:49:30 +0000
@@ -168,19 +168,27 @@
return file_id
def _get_existing_id(self, parent_id, path):
+ assert isinstance(path, unicode)
+ assert isinstance(parent_id, str)
if self.id_map.has_key(path):
return self.id_map[path]
return self._get_old_id(parent_id, path)
def _get_old_id(self, parent_id, old_path):
+ assert isinstance(old_path, unicode)
+ assert isinstance(parent_id, str)
return self.old_inventory[parent_id].children[urlutils.basename(old_path)].file_id
def _get_new_id(self, parent_id, new_path):
+ assert isinstance(new_path, unicode)
+ assert isinstance(parent_id, str)
if self.id_map.has_key(new_path):
return self.id_map[new_path]
return generate_file_id(self.source, self.revid, new_path)
def _rename(self, file_id, parent_id, path):
+ assert isinstance(path, unicode)
+ assert isinstance(parent_id, str)
# Only rename if not right yet
if (self.inventory[file_id].parent_id == parent_id and
self.inventory[file_id].name == urlutils.basename(path)):
@@ -188,6 +196,7 @@
self.inventory.rename(file_id, parent_id, urlutils.basename(path))
def delete_entry(self, path, revnum, parent_id, pool):
+ assert isinstance(path, str)
path = path.decode("utf-8")
if path in self._premature_deletes:
# Delete recursively
@@ -206,6 +215,7 @@
def add_directory(self, path, parent_id, copyfrom_path, copyfrom_revnum,
pool):
+ assert isinstance(path, str)
path = path.decode("utf-8")
check_filename(path)
file_id = self._get_new_id(parent_id, path)
@@ -230,6 +240,8 @@
return file_id
def open_directory(self, path, parent_id, base_revnum, pool):
+ assert isinstance(path, str)
+ path = path.decode("utf-8")
assert base_revnum >= 0
base_file_id = self._get_old_id(parent_id, path)
base_revid = self.old_inventory[base_file_id].revision
@@ -312,6 +324,7 @@
mutter('unsupported file property %r' % name)
def add_file(self, path, parent_id, copyfrom_path, copyfrom_revnum, baton):
+ assert isinstance(path, str)
path = path.decode("utf-8")
check_filename(path)
self.is_symlink = False
@@ -335,6 +348,8 @@
return path
def open_file(self, path, parent_id, base_revnum, pool):
+ assert isinstance(path, str)
+ path = path.decode("utf-8")
base_file_id = self._get_old_id(parent_id, path)
base_revid = self.old_inventory[base_file_id].revision
self.file_id = self._get_existing_id(parent_id, path)
@@ -351,6 +366,7 @@
return path
def close_file(self, path, checksum):
+ assert isinstance(path, unicode)
if self.file_stream is not None:
self.file_stream.seek(0)
lines = osutils.split_lines(self.file_stream.read())
=== modified file 'tests/test_fetch.py'
--- a/tests/test_fetch.py 2008-01-17 23:42:21 +0000
+++ b/tests/test_fetch.py 2008-01-18 03:49:30 +0000
@@ -136,7 +136,22 @@
self.client_add("dc/trunk")
self.client_commit("dc", "My Message")
oldrepos = Repository.open(repos_url)
- oldrepos.set_branching_scheme(TrunkBranchingScheme(1))
+ oldrepos.set_branching_scheme(TrunkBranchingScheme(0))
+ dir = BzrDir.create("f",format.get_rich_root_format())
+ newrepos = dir.create_repository()
+ oldrepos.copy_content_into(newrepos)
+
+ def test_fetch_special_char_edit(self):
+ repos_url = self.make_client('d', 'dc')
+ self.build_tree({u'dc/trunk/IöC': None})
+ self.client_add("dc/trunk")
+ self.client_commit("dc", "My Message")
+ self.client_update("dc")
+ self.build_tree({u'dc/trunk/IöC/bar': "more data"})
+ self.client_add(u"dc/trunk/IöC/bar".encode("utf-8"))
+ self.client_commit("dc", "My Message")
+ oldrepos = Repository.open(repos_url)
+ oldrepos.set_branching_scheme(TrunkBranchingScheme(0))
dir = BzrDir.create("f",format.get_rich_root_format())
newrepos = dir.create_repository()
oldrepos.copy_content_into(newrepos)
@@ -147,7 +162,7 @@
self.client_add("dc/trunk")
self.client_commit("dc", "My Message")
oldrepos = Repository.open(repos_url)
- oldrepos.set_branching_scheme(TrunkBranchingScheme(1))
+ oldrepos.set_branching_scheme(TrunkBranchingScheme(0))
dir = BzrDir.create("f",format.get_rich_root_format())
newrepos = dir.create_repository()
oldrepos.copy_content_into(newrepos)
@@ -161,7 +176,7 @@
self.build_tree({u"dc/trunk/â¬\x2c": "bar"})
revno = self.client_commit("dc", "My Message2")[0]
oldrepos = Repository.open(repos_url)
- oldrepos.set_branching_scheme(TrunkBranchingScheme(1))
+ oldrepos.set_branching_scheme(TrunkBranchingScheme(0))
dir = BzrDir.create("f",format.get_rich_root_format())
newrepos = dir.create_repository()
oldrepos.copy_content_into(newrepos)
More information about the bazaar-commits
mailing list