@matheusbsbs / matheus-bagliano / commits / 9291ccfd27
Fork 0

cvsimport: add test illustrating a bug in cvsps

Some cvs repositories may have time deviations in their recorded commits. This is a test for one of such cases. These kind of repositories can happen if the system time of cvs clients is not fully synchronised. Consider the following sequence of events: * client A commits file a r1.1 * client A commits file a r1.2, b r1.1 * client B commits file b r1.2 using the same timestamp as a r1.1 This can be resolved but due to cvsps ordering its patchsets solely based on the timestamp. It only takes revision odering into account if there is no difference in the timestamp. I hit this bug when importing from a real repository which was originally converted from another rcs based scm. Other import tools can handle this correctly, e.g. parsecvs. Signed-off-by: Heiko Voigt <hvoigt@hvoigt.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Heiko Voigt committed Mar 18, 2009 at 18:33 UTC 9291ccfd27e1e1958b50df7f408996ac22c0776a
4 files changed +115
t/t9603-cvsimport-patchsets.sh new
+33
@@ -0,0 +1,33 @@
1 +#!/bin/sh
2 +
3 +# Structure of the test cvs repository
4 +#
5 +# Message File:Content Commit Time
6 +# Rev 1 a: 1.1 2009-02-21 19:11:43 +0100
7 +# Rev 2 a: 1.2 b: 1.1 2009-02-21 19:11:14 +0100
8 +# Rev 3 b: 1.2 2009-02-21 19:11:43 +0100
9 +#
10 +# As you can see the commit of Rev 3 has the same time as
11 +# Rev 1 this leads to a broken import because of a cvsps
12 +# bug.
13 +
14 +test_description='git cvsimport testing for correct patchset estimation'
15 +. ./lib-cvs.sh
16 +
17 +CVSROOT="$TEST_DIRECTORY"/t9603/cvsroot
18 +export CVSROOT
19 +
20 +test_expect_failure 'import with criss cross times on revisions' '
21 +
22 + git cvsimport -p"-x" -C module-git module &&
23 + cd module-git &&
24 + git log --pretty=format:%s > ../actual &&
25 + echo "" >> ../actual &&
26 + cd .. &&
27 + echo "Rev 3
28 +Rev 2
29 +Rev 1" > expect &&
30 + test_cmp actual expect
31 +'
32 +
33 +test_done
t/t9603/cvsroot/CVSROOT/.gitignore new
+2
@@ -0,0 +1,2 @@
1 +history
2 +val-tags
t/t9603/cvsroot/module/a,v new
+40
@@ -0,0 +1,40 @@
1 +head 1.2;
2 +access;
3 +symbols;
4 +locks; strict;
5 +comment @# @;
6 +
7 +
8 +1.2
9 +date 2009.02.21.18.11.14; author tester; state Exp;
10 +branches;
11 +next 1.1;
12 +
13 +1.1
14 +date 2009.02.21.18.11.43; author tester; state Exp;
15 +branches;
16 +next ;
17 +
18 +
19 +desc
20 +@@
21 +
22 +
23 +1.2
24 +log
25 +@Rev 2
26 +@
27 +text
28 +@1.2
29 +@
30 +
31 +
32 +1.1
33 +log
34 +@Rev 1
35 +@
36 +text
37 +@d1 1
38 +a1 1
39 +1.1
40 +@
t/t9603/cvsroot/module/b,v new
+40
@@ -0,0 +1,40 @@
1 +head 1.2;
2 +access;
3 +symbols;
4 +locks; strict;
5 +comment @# @;
6 +
7 +
8 +1.2
9 +date 2009.02.21.18.11.43; author tester; state Exp;
10 +branches;
11 +next 1.1;
12 +
13 +1.1
14 +date 2009.02.21.18.11.14; author tester; state Exp;
15 +branches;
16 +next ;
17 +
18 +
19 +desc
20 +@@
21 +
22 +
23 +1.2
24 +log
25 +@Rev 3
26 +@
27 +text
28 +@1.2
29 +@
30 +
31 +
32 +1.1
33 +log
34 +@Rev 2
35 +@
36 +text
37 +@d1 1
38 +a1 1
39 +1.1
40 +@