From 3e3f9078c0947cc2f05388226385f0995ae8b5f3 Mon Sep 17 00:00:00 2001 From: Han-Wen Nienhuys Date: Mon, 5 Nov 2007 19:46:22 -0200 Subject: [PATCH] Add utf8 testcase --- Makefile | 2 +- authors.test | 1 + darcs2git.py | 12 +++-- tests/utf-8/_darcs/inventory | 2 + ...928-98a498d065338b68ab4806c10c2fcaa48bf6b52a.gz | Bin 0 -> 92 bytes tests/utf-8/_darcs/patches/pending | 2 + tests/utf-8/_darcs/prefs/binaries | 55 +++++++++++++++++++++ tests/utf-8/_darcs/prefs/boring | 35 +++++++++++++ tests/utf-8/_darcs/prefs/motd | 0 tests/utf-8/_darcs/pristine/test.utf-8 | 2 + tests/utf-8/test.utf-8 | 2 + tests/utf-8/test.utf-8~ | 2 + 12 files changed, 110 insertions(+), 5 deletions(-) create mode 100644 authors.test create mode 100644 tests/utf-8/_darcs/inventory create mode 100644 tests/utf-8/_darcs/patches/20071105212808-11928-98a498d065338b68ab4806c10c2fcaa48bf6b52a.gz create mode 100644 tests/utf-8/_darcs/patches/pending create mode 100644 tests/utf-8/_darcs/prefs/binaries create mode 100644 tests/utf-8/_darcs/prefs/boring create mode 100644 tests/utf-8/_darcs/prefs/motd create mode 100644 tests/utf-8/_darcs/pristine/test.utf-8 create mode 100644 tests/utf-8/test.utf-8 create mode 100644 tests/utf-8/test.utf-8~ diff --git a/Makefile b/Makefile index 41bd283..ab3625d 100644 --- a/Makefile +++ b/Makefile @@ -7,7 +7,7 @@ test-results: rm -rf $@ mkdir $@ $(foreach t,$(TESTS),\ - python darcs2git.py --debug -d $@/$(t).git tests/$(t) \ + python darcs2git.py --author authors.test --debug -d $@/$(t).git tests/$(t) \ && ) true show: diff --git a/authors.test b/authors.test new file mode 100644 index 0000000..4e21297 --- /dev/null +++ b/authors.test @@ -0,0 +1 @@ +ed@bar.com=Féd Bla Bla diff --git a/darcs2git.py b/darcs2git.py index 5d7c84d..82fd90e 100644 --- a/darcs2git.py +++ b/darcs2git.py @@ -576,7 +576,9 @@ class DarcsPatch: name = mail.split ('@')[0] self.author_name = name - self.author_mail = mail + + # mail addresses should be plain strings. + self.author_mail = mail.encode('utf-8') def extract_time (self): self.date = darcs_date_to_git (self.attributes['date']) + ' ' + darcs_timezone (self.attributes['local_date']) @@ -687,7 +689,9 @@ def export_tree (tree, gfi): def export_commit (repo, patch, last_patch, gfi): gfi.write ('commit refs/heads/darcstmp%d\n' % patch.number) gfi.write ('mark :%d\n' % (patch.number + 1)) - gfi.write ('committer %s <%s> %s\n' % (patch.author_name, + + raw_name = patch.author_name + gfi.write ('committer %s <%s> %s\n' % (raw_name, patch.author_mail, patch.date)) @@ -753,8 +757,8 @@ def export_tag (patch, gfi): gfi.write ('tag %s\n' % patch.tag_name ()) gfi.write ('from :%d\n' % (patch.number + 1)) gfi.write ('tagger %s <%s> %s\n' % (patch.author_name, - patch.author_mail, - patch.date)) + patch.author_mail, + patch.date)) raw_message = patch.message.encode('utf-8') gfi.write ('data %d\n%s\n' % (len (raw_message), diff --git a/tests/utf-8/_darcs/inventory b/tests/utf-8/_darcs/inventory new file mode 100644 index 0000000..21c3d89 --- /dev/null +++ b/tests/utf-8/_darcs/inventory @@ -0,0 +1,2 @@ +[éd +ed@bar.com**20071105212808] diff --git a/tests/utf-8/_darcs/patches/20071105212808-11928-98a498d065338b68ab4806c10c2fcaa48bf6b52a.gz b/tests/utf-8/_darcs/patches/20071105212808-11928-98a498d065338b68ab4806c10c2fcaa48bf6b52a.gz new file mode 100644 index 0000000000000000000000000000000000000000..806a6339b46c533e4e3fd89fd3f107585bbe9d8a GIT binary patch literal 92 zcwUq5=3oE==5D(^My=YWM-??Udgxo)hkKtsap1t63l|PtIdS2{p#w@`3ukE?s;cT5 utA{%J?^oHn!)5&z72oSk+KWx}rCnVPPVkma5u35%DHDUkwZJ_QKqCQMyCc>B literal 0 HcwPel00001 diff --git a/tests/utf-8/_darcs/patches/pending b/tests/utf-8/_darcs/patches/pending new file mode 100644 index 0000000..2c63c08 --- /dev/null +++ b/tests/utf-8/_darcs/patches/pending @@ -0,0 +1,2 @@ +{ +} diff --git a/tests/utf-8/_darcs/prefs/binaries b/tests/utf-8/_darcs/prefs/binaries new file mode 100644 index 0000000..1ec9654 --- /dev/null +++ b/tests/utf-8/_darcs/prefs/binaries @@ -0,0 +1,55 @@ +# Binary file regexps: +\.png$ +\.PNG$ +\.gz$ +\.GZ$ +\.pdf$ +\.PDF$ +\.jpg$ +\.JPG$ +\.jpeg$ +\.JPEG$ +\.gif$ +\.GIF$ +\.tif$ +\.TIF$ +\.tiff$ +\.TIFF$ +\.pnm$ +\.PNM$ +\.pbm$ +\.PBM$ +\.pgm$ +\.PGM$ +\.ppm$ +\.PPM$ +\.bmp$ +\.BMP$ +\.mng$ +\.MNG$ +\.tar$ +\.TAR$ +\.bz2$ +\.BZ2$ +\.z$ +\.Z$ +\.zip$ +\.ZIP$ +\.jar$ +\.JAR$ +\.so$ +\.SO$ +\.a$ +\.A$ +\.tgz$ +\.TGZ$ +\.mpg$ +\.MPG$ +\.mpeg$ +\.MPEG$ +\.iso$ +\.ISO$ +\.exe$ +\.EXE$ +\.doc$ +\.DOC$ diff --git a/tests/utf-8/_darcs/prefs/boring b/tests/utf-8/_darcs/prefs/boring new file mode 100644 index 0000000..9a448f8 --- /dev/null +++ b/tests/utf-8/_darcs/prefs/boring @@ -0,0 +1,35 @@ +# Boring file regexps: +\.hi$ +\.o$ +\.o\.cmd$ +# *.ko files aren't boring by default because they might +# be Korean translations rather than kernel modules. +# \.ko$ +\.ko\.cmd$ +\.mod\.c$ +(^|/)\.tmp_versions($|/) +(^|/)CVS($|/) +(^|/)RCS($|/) +~$ +#(^|/)\.[^/] +(^|/)_darcs($|/) +\.bak$ +\.BAK$ +\.orig$ +(^|/)vssver\.scc$ +\.swp$ +(^|/)MT($|/) +(^|/)\{arch\}($|/) +(^|/).arch-ids($|/) +(^|/), +\.class$ +\.prof$ +(^|/)\.DS_Store$ +(^|/)BitKeeper($|/) +(^|/)ChangeSet($|/) +(^|/)\.svn($|/) +\.py[co]$ +\# +\.cvsignore$ +(^|/)Thumbs\.db$ +(^|/)autom4te\.cache($|/) diff --git a/tests/utf-8/_darcs/prefs/motd b/tests/utf-8/_darcs/prefs/motd new file mode 100644 index 0000000..e69de29 diff --git a/tests/utf-8/_darcs/pristine/test.utf-8 b/tests/utf-8/_darcs/pristine/test.utf-8 new file mode 100644 index 0000000..a983c41 --- /dev/null +++ b/tests/utf-8/_darcs/pristine/test.utf-8 @@ -0,0 +1,2 @@ +éd +éd diff --git a/tests/utf-8/test.utf-8 b/tests/utf-8/test.utf-8 new file mode 100644 index 0000000..a983c41 --- /dev/null +++ b/tests/utf-8/test.utf-8 @@ -0,0 +1,2 @@ +éd +éd diff --git a/tests/utf-8/test.utf-8~ b/tests/utf-8/test.utf-8~ new file mode 100644 index 0000000..f76ac6d --- /dev/null +++ b/tests/utf-8/test.utf-8~ @@ -0,0 +1,2 @@ + +éd -- 2.11.4.GIT