Mercurial > hgsubversion
changeset 928:d99ed94f4760
wrappers: do not change encoding when pushing
This causes problems on platforms where the encoding is actually different,
if the manifest contains a path which no longer matches the checkout, a
following bailifchanged() actually fails.
This happens on Windows with a repository containing UTF-8 encoded filenames
checked out on a cp1252 environment.
author | Patrick Mezard <patrick@mezard.eu> |
---|---|
date | Sun, 09 Sep 2012 14:54:43 +0200 |
parents | 3271fa883f34 |
children | 8417be758047 |
files | hgsubversion/wrappers.py tests/test_push_command.py |
diffstat | 2 files changed, 22 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/hgsubversion/wrappers.py +++ b/hgsubversion/wrappers.py @@ -249,8 +249,16 @@ def push(repo, dest, force, revs): return extra['branch'] = ctx.branch() # TODO: can we avoid calling our own rebase wrapper here? - rebase(hgrebase.rebase, ui, repo, svn=True, svnextrafn=extrafn, - svnsourcerev=needs_transplant) + # Tweaking the encoding is fine for internal + # manipulations, but it can lead to various breakage + # when starting to operate with the working directory + # and the dirstate. + util.swap_out_encoding(old_encoding) + try: + rebase(hgrebase.rebase, ui, repo, svn=True, + svnextrafn=extrafn, svnsourcerev=needs_transplant) + finally: + util.swap_out_encoding() # Reload the repo after the rebase. Do not reuse # contexts across this. newtip = newtipctx.node()
--- a/tests/test_push_command.py +++ b/tests/test_push_command.py @@ -491,6 +491,18 @@ class PushTests(test_util.TestBase): self.assertEqual([], os.listdir( os.path.join(self.tmpdir, 'testrepo-1', 'db', 'transactions'))) + def test_push_encoding(self): + self.test_push_two_revs() + # Writing then rebasing UTF-8 filenames in a cp1252 windows console + # used to fail because hg internal encoding was being changed during + # the interactions with subversion, *and during the rebase*, which + # confused the dirstate and made it believe the file was deleted. + fn = 'pi\xc3\xa8ce/test' + changes = [(fn, fn, 'a')] + par = self.repo['tip'].rev() + self.commitchanges(changes, parent=par) + self.pushrevisions() + def suite(): test_classes = [PushTests, ] all_tests = []