Skip to content

Commit

Permalink
Decode darcs escape sequences
Browse files Browse the repository at this point in the history
  • Loading branch information
nominolo committed May 7, 2008
1 parent c213d24 commit 38eebf4
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions darcs-to-git
Expand Up @@ -128,6 +128,15 @@ class DarcsPatch
else else
[author, ''] # Could manufacture or insert email address here [author, ''] # Could manufacture or insert email address here
end 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 end


def pull def pull
Expand Down

0 comments on commit 38eebf4

Please sign in to comment.