[PATCH 2 of 3] issue1578: reproduce crash where synthetic revs break merge detection

Greg Ward greg-hg at gerg.ca
Sat Mar 28 11:28:27 CDT 2009


# HG changeset patch
# User Greg Ward <greg-hg at gerg.ca>
# Date 1238257630 14400
# Node ID 6fb6f7f83d0e2c24fb8dea9fec04fe801f1dcf51
# Parent  34d59e749d891be3a7133bec7a098584c013ef14
issue1578: reproduce crash where synthetic revs break merge detection
(N.B. this breaks the tests: fix coming next).

diff --git a/tests/test-convert-cvs-synthetic b/tests/test-convert-cvs-synthetic
--- a/tests/test-convert-cvs-synthetic
+++ b/tests/test-convert-cvs-synthetic
@@ -7,6 +7,7 @@
 
 echo "[extensions]" >> $HGRCPATH
 echo "convert = " >> $HGRCPATH
+echo "graphlog = " >> $HGRCPATH
 echo "[convert]" >> $HGRCPATH
 echo "cvsps=builtin" >> $HGRCPATH
 
@@ -54,7 +55,7 @@
 cvscall -q up -rv1_0
 touch file2
 cvscall -Q add file2
-cvsci -m"add file2 on branch v1_0" file2
+cvsci -m"add file2" file2
 
 echo % create file3, file4 on branch v1_1
 cvscall -Q up -rv1_1
@@ -65,14 +66,54 @@
 
 echo % merge file2 from v1_0 to v1_1
 cvscall -q up -jv1_0
-cvsci -m"merge file2 from v1_0 to v1_1"
+cvsci -m"MERGE from v1_0: add file2"
+
+# Step things up a notch: now we make the history really hairy, with
+# changes bouncing back and forth between trunk and v1_2 and merges
+# going both ways.  (I.e., try to model the real world.)
+
+echo "% create branch v1_2"
+cvscall -Q up -A
+cvscall -q tag -b v1_2
+
+echo "% create file5 on branch v1_2"
+cvscall -q up -rv1_2
+touch file5
+cvs add file5
+cvsci -m"add file5 on v1_2"
+
+echo "% create file6 on trunk post-v1_2"
+cvscall -q up -A
+touch file6
+cvscall add file6
+cvsci -m"add file6 on trunk post-v1_2"
+
+echo "% merge file5 from v1_2 to trunk"
+cvscall -q up -A
+cvscall -q up -jv1_2 file5
+cvsci -m"MERGE from v1_2: add file5"
+
+echo "% merge file6 from trunk to v1_2"
+cvscall -q up -rv1_2
+cvscall up -jHEAD file6
+cvsci -m"MERGE from HEAD: add file6"
 
 echo % cvs rlog output
 filterpath cvscall -q rlog proj | egrep '^(RCS file|revision)'
 
-echo % convert to hg
+echo "% convert to hg (#1)"
 cd ..
-filterpath hg convert proj proj.hg
+filterpath hg convert --datesort proj proj.hg
 
-echo % hg log output
-hg -R proj.hg log --template "{rev} {desc}\n"
+echo "% hg glog output (#1)"
+hg -R proj.hg glog --template "{rev} {desc}\n"
+
+echo "% convert to hg (#2: with merge detection)"
+rm -rf proj.hg
+filterpath hg convert \
+  --config convert.cvsps.mergefrom="\"^MERGE from (\S+):\"" \
+  --datesort \
+  proj proj.hg
+
+echo "% hg glog output (#2)"
+hg -R proj.hg glog --template "{rev} {desc}\n"
diff --git a/tests/test-convert-cvs-synthetic.out b/tests/test-convert-cvs-synthetic.out
--- a/tests/test-convert-cvs-synthetic.out
+++ b/tests/test-convert-cvs-synthetic.out
@@ -12,7 +12,7 @@
 % create file2 on branch v1_0
 cvs -f -q up -rv1_0
 cvs -f -Q add file2
-cvs -f ci -madd file2 on branch v1_0 file2
+cvs -f ci -madd file2 file2
 % create file3, file4 on branch v1_1
 cvs -f -Q up -rv1_1
 cvs -f -Q add file3 file4
@@ -20,7 +20,35 @@
 % merge file2 from v1_0 to v1_1
 cvs -f -q up -jv1_0
 U file2
-cvs -f ci -mmerge file2 from v1_0 to v1_1
+cvs -f ci -mMERGE from v1_0: add file2
+% create branch v1_2
+cvs -f -Q up -A
+cvs -f -q tag -b v1_2
+T file1
+% create file5 on branch v1_2
+cvs -f -q up -rv1_2
+cvs add: scheduling file `file5' for addition on branch `v1_2'
+cvs add: use 'cvs commit' to add this file permanently
+cvs -f ci -madd file5 on v1_2
+% create file6 on trunk post-v1_2
+cvs -f -q up -A
+cvs update: file5 is no longer in the repository
+cvs -f add file6
+cvs add: scheduling file `file6' for addition
+cvs add: use 'cvs commit' to add this file permanently
+cvs -f ci -madd file6 on trunk post-v1_2
+% merge file5 from v1_2 to trunk
+cvs -f -q up -A
+cvs -f -q up -jv1_2 file5
+U file5
+cvs -f ci -mMERGE from v1_2: add file5
+% merge file6 from trunk to v1_2
+cvs -f -q up -rv1_2
+U file5
+cvs update: file6 is no longer in the repository
+cvs -f up -jHEAD file6
+U file6
+cvs -f ci -mMERGE from HEAD: add file6
 % cvs rlog output
 RCS file: *REPO*/proj/file1,v
 revision 1.1
@@ -35,23 +63,83 @@
 RCS file: *REPO*/proj/Attic/file4,v
 revision 1.1
 revision 1.1.2.1
-% convert to hg
+RCS file: *REPO*/proj/file5,v
+revision 1.2
+revision 1.1
+revision 1.1.2.1
+RCS file: *REPO*/proj/file6,v
+revision 1.1
+revision 1.1.2.2
+revision 1.1.2.1
+% convert to hg (#1)
 initializing destination proj.hg repository
 using builtin cvsps
 collecting CVS rlog
-9 log entries
+15 log entries
 creating changesets
-4 changeset entries
+8 changeset entries
 connecting to *REPO*
 scanning source...
 sorting...
 converting...
-3 add file1 on trunk
-2 add file2 on branch v1_0
-1 add file3, file4 on branch v1_1
-0 merge file2 from v1_0 to v1_1
-% hg log output
-3 merge file2 from v1_0 to v1_1
-2 add file3, file4 on branch v1_1
-1 add file2 on branch v1_0
-0 add file1 on trunk
+7 add file1 on trunk
+6 add file2
+5 add file3, file4 on branch v1_1
+4 MERGE from v1_0: add file2
+3 add file5 on v1_2
+2 add file6 on trunk post-v1_2
+1 MERGE from v1_2: add file5
+0 MERGE from HEAD: add file6
+% hg glog output (#1)
+o  7 MERGE from HEAD: add file6
+|
+| o  6 MERGE from v1_2: add file5
+| |
+| o  5 add file6 on trunk post-v1_2
+| |
+o |  4 add file5 on v1_2
+|/
+| o  3 MERGE from v1_0: add file2
+| |
+| o  2 add file3, file4 on branch v1_1
+|/
+| o  1 add file2
+|/
+o  0 add file1 on trunk
+
+% convert to hg (#2: with merge detection)
+initializing destination proj.hg repository
+using builtin cvsps
+collecting CVS rlog
+15 log entries
+creating changesets
+8 changeset entries
+connecting to *REPO*
+scanning source...
+sorting...
+converting...
+7 add file1 on trunk
+6 add file2
+5 add file3, file4 on branch v1_1
+4 MERGE from v1_0: add file2
+3 add file5 on v1_2
+2 add file6 on trunk post-v1_2
+1 MERGE from v1_2: add file5
+0 MERGE from HEAD: add file6
+% hg glog output (#2)
+o    7 MERGE from HEAD: add file6
+|\
+| o  6 MERGE from v1_2: add file5
+| |
+| o  5 add file6 on trunk post-v1_2
+| |
+o |  4 add file5 on v1_2
+|/
+| o    3 MERGE from v1_0: add file2
+| |\
++---o  2 add file3, file4 on branch v1_1
+| |
+| o  1 add file2
+|/
+o  0 add file1 on trunk
+


More information about the Mercurial-devel mailing list