Add utf8 testcase
authorHan-Wen Nienhuys <hanwen@lilypond.org>
Mon, 5 Nov 2007 21:46:22 +0000 (5 19:46 -0200)
committerHan-Wen Nienhuys <hanwen@lilypond.org>
Mon, 5 Nov 2007 21:46:22 +0000 (5 19:46 -0200)
12 files changed:
Makefile
authors.test [new file with mode: 0644]
darcs2git.py
tests/utf-8/_darcs/inventory [new file with mode: 0644]
tests/utf-8/_darcs/patches/20071105212808-11928-98a498d065338b68ab4806c10c2fcaa48bf6b52a.gz [new file with mode: 0644]
tests/utf-8/_darcs/patches/pending [new file with mode: 0644]
tests/utf-8/_darcs/prefs/binaries [new file with mode: 0644]
tests/utf-8/_darcs/prefs/boring [new file with mode: 0644]
tests/utf-8/_darcs/prefs/motd [new file with mode: 0644]
tests/utf-8/_darcs/pristine/test.utf-8 [new file with mode: 0644]
tests/utf-8/test.utf-8 [new file with mode: 0644]
tests/utf-8/test.utf-8~ [new file with mode: 0644]

index 41bd283..ab3625d 100644 (file)
--- 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 (file)
index 0000000..4e21297
--- /dev/null
@@ -0,0 +1 @@
+ed@bar.com=Féd Bla Bla
index 5d7c84d..82fd90e 100644 (file)
@@ -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 (file)
index 0000000..21c3d89
--- /dev/null
@@ -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 (file)
index 0000000..806a633
Binary files /dev/null and b/tests/utf-8/_darcs/patches/20071105212808-11928-98a498d065338b68ab4806c10c2fcaa48bf6b52a.gz differ
diff --git a/tests/utf-8/_darcs/patches/pending b/tests/utf-8/_darcs/patches/pending
new file mode 100644 (file)
index 0000000..2c63c08
--- /dev/null
@@ -0,0 +1,2 @@
+{
+}
diff --git a/tests/utf-8/_darcs/prefs/binaries b/tests/utf-8/_darcs/prefs/binaries
new file mode 100644 (file)
index 0000000..1ec9654
--- /dev/null
@@ -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 (file)
index 0000000..9a448f8
--- /dev/null
@@ -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 (file)
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 (file)
index 0000000..a983c41
--- /dev/null
@@ -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 (file)
index 0000000..a983c41
--- /dev/null
@@ -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 (file)
index 0000000..f76ac6d
--- /dev/null
@@ -0,0 +1,2 @@
+
+éd