Encoding problem and bug running hookscript ?
Matt Mackall
mpm at selenic.com
Wed Nov 28 20:44:01 UTC 2012
On Wed, 2012-11-28 at 20:52 +0100, Yannick CHARLES wrote:
> Good evening everybody,
>
> I have the following setup:
>
> A repository "test-syst", and a versionned patch queue located at
> "test-syst/.hg/patches-Yann" (final goal will be to have one patch queue
> for each developer).
> These two are located on a remote server, running Mercurial 2.3.2
> (latest version on release ppa) on Ubuntu 12.04 (precise).
>
> There is a changegroup hook configured for the patches repository that
> calls the following shell script (the script is passed the developer
> name as argument, here Yann):
>
> ------
>
> #/bin/bash
>
> # Getting back to "test-syst/.hg" as the script is run from
> "test-syst/.hg/patches-Yann"
> cd ..
>
> # Config file backup
> cp hgrc hgrc_bak
>
> # Add user name to prevent error when applying patch
> echo "
> [ui]
> username = $1
> " >> hgrc
>
> # Select stack
> hg qqueue $1
> # Select some guard
> hg qselect pub
> # Apply all patches
> hg qpush -a
>
> #
> # Here goes some command that builds the contents of the repository,
> once patched, and export the resulting files to some folder.
> #
>
> # Restore original config file
> mv hgrc_bak hgrc
> # Restore original state
> hg qpop -a
>
> --------
> One of the patches committed in the patches repo has non-ascii accented
> letters (à) in its description.
>
> Provided that I invoke it from the right directory, the script works
> fine from the command line. It also works fine if I push changes from
> another repository created with qclone on the server itself.
>
> However, when I push changes from my machine (also with Mercurial 2.3.2,
> and TortoiseHg 2.4.3, on Ubuntu 11.04) to the patch repository over
> http, the hg qpush -a command in the script fails and I get the
> following output:
>
> searching for changes
> remote: adding changesets
> remote: adding manifests
> remote: adding file changes
> remote: added 1 changesets with 1 changes to 1 files
> remote: 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
> remote: applying 2012-11-28_16-32-05_r0+.diff
> remote: applying 2012-11-28_17-34-08_r1+.diff
> remote: transaction abort!
> remote: rollback completed
> remote: cleaning up working directory...done
> remote: abort: decoding near 'h tant qu'à faire': 'ascii' codec can't
> decode byte 0xc3 in position 17: ordinal not in range(128)!
My guess is that this is happening in qpush. The patch description is
probably in UTF-8, but Mercurial on the server ("remote:") is expecting
ASCII. Adding "--encoding utf-8" to the qpush call will probably fix it.
You can find out what encoding Mercurial thinks it's using like this:
$ hg help -v | grep encoding
--encoding ENCODE set the charset encoding (default: UTF-8)
--encodingmode MODE set the charset encoding mode (default: strict)
Your webserver/hook is probably running with no locale variables. Add
this to your script to see your locale encoding:
$ locale | grep CTYPE
LC_CTYPE=en_US.UTF-8
> Also, would it help somehow to update to Mercurial 2.4 ?
Nope.
--
Mathematics is the supreme nostalgia of our time.
More information about the Mercurial
mailing list