changeset 44:85fcac4e2291

Fix an encoding bug that would occur if the local encoding was not utf-8.
author Augie Fackler <durin42@gmail.com>
date Tue, 28 Oct 2008 11:39:36 -0500
parents af7ac6c03452
children ce00e6ffaa90
files fetch_command.py push_cmd.py
diffstat 2 files changed, 6 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/fetch_command.py
+++ b/fetch_command.py
@@ -29,6 +29,8 @@ def fetch_revisions(ui, svn_url, hg_repo
                     **opts):
     """Pull new revisions from Subversion.
     """
+    old_encoding = merc_util._encoding
+    merc_util._encoding = 'UTF-8'
     skipto_rev=int(skipto_rev)
     have_replay = not stupid
     if have_replay and not callable(delta.svn_txdelta_apply(None, None,
@@ -101,6 +103,7 @@ def fetch_revisions(ui, svn_url, hg_repo
                         ui.status('Got a 502, retrying (%s)\n' % tries)
                     else:
                         raise
+    merc_util._encoding = old_encoding
 
 
 def cleanup_file_handles(svn, count):
--- a/push_cmd.py
+++ b/push_cmd.py
@@ -14,6 +14,8 @@ import utility_commands
 def push_revisions_to_subversion(ui, repo, hg_repo_path, svn_url, **opts):
     """Push revisions starting at a specified head back to Subversion.
     """
+    oldencoding = merc_util._encoding
+    merc_util._encoding = 'UTF-8'
     hge = hg_delta_editor.HgChangeReceiver(hg_repo_path,
                                            ui_=ui)
     svn_commit_hashes = dict(zip(hge.revmap.itervalues(),
@@ -63,6 +65,7 @@ def push_revisions_to_subversion(ui, rep
                                              hge.revmap.iterkeys()))
                 outgoing = utility_commands.outgoing_revisions(ui, repo, hge,
                                                               svn_commit_hashes)
+    merc_util._encoding = oldencoding
     return 0