[PATCH] convert: get test-convert-darcs.t passing again with darcs 2.5.2

Greg Ward greg at gerg.ca
Thu Oct 20 19:29:52 CDT 2011


# HG changeset patch
# User Greg Ward <greg at gerg.ca>
# Date 1319156421 14400
# Branch stable
# Node ID 9c25057520aa676bc3f478c453ecec199bb0cbd6
# Parent  1ae824142c0157f350e1e01cf3e23fbf01a1f722
convert: get test-convert-darcs.t passing again with darcs 2.5.2

It appears that darcs 2.5.2 converts all metadata input bytes > 0x7F
to ? -- at least in console output and whatever "hg convert" reads.
Previous versions preserved such input bytes as-is. So instead of
expecting the output to match the input, all we can do is expect one
byte of output for each byte of input. With older versions, the output
byte equals the input byte, but with 2.5.2 the output byte is just ?.

The one oddity is the output of "hg convert" when processing darcs
commit messages with non-ASCII characters encoded in UTF-8. It appears
that convert with old darcs got a single ? from the single character,
and with new darcs it gets two ? from the two bytes that character
encodes to.

Completely untested with darcs pre-2.5.2.

diff --git a/tests/test-convert-darcs.t b/tests/test-convert-darcs.t
--- a/tests/test-convert-darcs.t
+++ b/tests/test-convert-darcs.t
@@ -48,7 +48,7 @@
   $ darcs record -a -l -m p1.2
   Finished recording patch 'p1.2'
 
-  $ darcs pull -a ../darcs-clone
+  $ darcs pull -a ../darcs-clone | egrep -v '^(HINT: |      )'
   Backing up ./a(-darcs-backup0)
   We have conflicts in the following files:
   ./a
@@ -78,10 +78,11 @@
 
   $ echo g > g
 
-darcs is encoding agnostic, so it takes whatever bytes it's given
+darcs is allegedly encoding agnostic, but version 2.5.2 (at least)
+screws up non-ASCII data -- hence the re here
 
   $ darcs record -a -l -m 'p4: desc ñ' -A 'author ñ'
-  Finished recording patch 'p4: desc \xc3\xb1' (esc)
+  Finished recording patch 'p4: desc ..' (re)
 
 Test latin-1 commit message
 
@@ -89,7 +90,7 @@
   $ printf "p5: desc " > ../p5
   $ python -c 'print "".join([chr(i) for i in range(128, 256)])' >> ../p5
   $ darcs record -a -l --logfile ../p5
-  Finished recording patch 'p5: desc \x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7\xa8\xa9\xaa\xab\xac\xad\xae\xaf\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xeb\xec\xed\xee\xef\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff' (esc)
+  Finished recording patch 'p5: desc ................................................................................................................................' (re)
  
   $ glog()
   > {
@@ -106,7 +107,7 @@
   4 p1.1
   3 p2
   2 p3
-  1 p4: desc ?
+  1 p4: desc \?\?? (re)
   0 p5: desc ????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
 
 The converter does not currently handle patch conflicts very well.
@@ -117,10 +118,10 @@
 Just to say that manifest not listing "c" here is a bug.
 
   $ HGENCODING=latin-1 glog -R darcs-repo-hg -r 6
-  o  6 "p5: desc \xc2\x80\xc2\x81\xc2\x82\xc2\x83\xc2\x84\xc2\x85\xc2\x86\xc2\x87\xc2\x88\xc2\x89\xc2\x8a\xc2\x8b\xc2\x8c\xc2\x8d\xc2\x8e\xc2\x8f\xc2\x90\xc2\x91\xc2\x92\xc2\x93\xc2\x94\xc2\x95\xc2\x96\xc2\x97\xc2\x98\xc2\x99\xc2\x9a\xc2\x9b\xc2\x9c\xc2\x9d\xc2\x9e\xc2\x9f\xc2\xa0\xc2\xa1\xc2\xa2\xc2\xa3\xc2\xa4\xc2\xa5\xc2\xa6\xc2\xa7\xc2\xa8\xc2\xa9\xc2\xaa\xc2\xab\xc2\xac\xc2\xad\xc2\xae\xc2\xaf\xc2\xb0\xc2\xb1\xc2\xb2\xc2\xb3\xc2\xb4\xc2\xb5\xc2\xb6\xc2\xb7\xc2\xb8\xc2\xb9\xc2\xba\xc2\xbb\xc2\xbc\xc2\xbd\xc2\xbe\xc2\xbf\xc3\x80\xc3\x81\xc3\x82\xc3\x83\xc3\x84\xc3\x85\xc3\x86\xc3\x87\xc3\x88\xc3\x89\xc3\x8a\xc3\x8b\xc3\x8c\xc3\x8d\xc3\x8e\xc3\x8f\xc3\x90\xc3\x91\xc3\x92\xc3\x93\xc3\x94\xc3\x95\xc3\x96\xc3\x97\xc3\x98\xc3\x99\xc3\x9a\xc3\x9b\xc3\x9c\xc3\x9d\xc3\x9e\xc3\x9f\xc3\xa0\xc3\xa1\xc3\xa2\xc3\xa3\xc3\xa4\xc3\xa5\xc3\xa6\xc3\xa7\xc3\xa8\xc3\xa9\xc3\xaa\xc3\xab\xc3\xac\xc3\xad\xc3\xae\xc3\xaf\xc3\xb0\xc3\xb1\xc3\xb2\xc3\xb3\xc3\xb4\xc3\xb5\xc3\xb6\xc3\xb7\xc3\xb8\xc3\xb9\xc3\xba\xc3\xbb\xc3\xbc\xc3\xbd\xc3\xbe\xc3\xbf" (test at example.org) files: h (esc)
+  o  6 "p5: desc ????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????" (test at example.org) files: h
   |
   $ HGENCODING=utf-8 glog -R darcs-repo-hg -r 0:5
-  o  5 "p4: desc \xc3\xb1" (author \xc3\xb1) files: g (esc)
+  o  5 "p4: desc .." \(author ..\) files: g (re)
   |
   o  4 "p3" (test at example.org) files: dir/d dir/d2 dir2/d f ff
   |


More information about the Mercurial-devel mailing list