Fix another visiblename() glitch in determining the foldername to be created

Commit b0e88622c4 changed dst_hash[folder.visiblename] to
dst_hash[folder.name] but we did not adapt all places where it is needed
to use visiblename again. This led to attempting to create a name on
REMOTE ignoring the nametrans setting on the LOCAL repository.

Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
This commit is contained in:
Sebastian Spaeth 2011-09-20 22:25:45 +02:00
parent 1c58ebe348
commit db28cb77e7

View File

@ -172,7 +172,7 @@ class BaseRepository(object, CustomConfig.ConfigHelperMixin):
if dst_folder.sync_this and not dst_name in src_hash: if dst_folder.sync_this and not dst_name in src_hash:
# nametrans sanity check! # nametrans sanity check!
# Does nametrans back&forth lead to identical names? # Does nametrans back&forth lead to identical names?
#src_name is the unmodified full src_name #src_name is the unmodified full src_name that would be created
newsrc_name = dst_folder.getvisiblename().replace( newsrc_name = dst_folder.getvisiblename().replace(
dst_repo.getsep(), dst_repo.getsep(),
src_repo.getsep()) src_repo.getsep())
@ -184,6 +184,7 @@ class BaseRepository(object, CustomConfig.ConfigHelperMixin):
"') as it would be filtered out on that repository." % "') as it would be filtered out on that repository." %
(newsrc_name, self)) (newsrc_name, self))
continue continue
# apply reverse nametrans to see if we end up with the same name
newdst_name = folder.getvisiblename().replace( newdst_name = folder.getvisiblename().replace(
src_repo.getsep(), dst_repo.getsep()) src_repo.getsep(), dst_repo.getsep())
if dst_name != newdst_name: if dst_name != newdst_name:
@ -201,15 +202,14 @@ class BaseRepository(object, CustomConfig.ConfigHelperMixin):
# end sanity check, actually create the folder # end sanity check, actually create the folder
try: try:
src_repo.makefolder(dst_name.replace( src_repo.makefolder(newsrc_name)
dst_repo.getsep(), src_repo.getsep()))
except OfflineImapError, e: except OfflineImapError, e:
self.ui.error(e, exc_info()[2], self.ui.error(e, exc_info()[2],
"Creating folder %s on repository %s" %\ "Creating folder %s on repository %s" %\
(src_name, dst_repo)) (src_name, dst_repo))
raise raise
status_repo.makefolder(dst_name.replace( status_repo.makefolder(newsrc_name.replace(
dst_repo.getsep(), status_repo.getsep())) src_repo.getsep(), status_repo.getsep()))
# Find deleted folders. # Find deleted folders.
# We don't delete folders right now. # We don't delete folders right now.