From 38eebf458311cbdbace78e07d4a3d2bd2c9f42e4 Mon Sep 17 00:00:00 2001 From: Thomas Schilling Date: Wed, 7 May 2008 16:13:51 +0200 Subject: [PATCH] Decode darcs escape sequences --- darcs-to-git | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/darcs-to-git b/darcs-to-git index 7612339..ff941d1 100755 --- a/darcs-to-git +++ b/darcs-to-git @@ -128,6 +128,15 @@ class DarcsPatch else [author, ''] # Could manufacture or insert email address here end + @author_name = decode_darcs_escapes(@author_name) + # XXX: do the same for names/comments? + end + + def decode_darcs_escapes(str) + # darcs uses '[_\hh_]' to quote non-ascii characters where 'h' is + # a hexadecimal. We translate this to '=hh' and use ruby's unpack + # to do replace this with the proper byte. + str.gsub(/\[\_\\(..)\_\]/) { |x| "=#{$1}" }.unpack("M*")[0] end def pull