Skip to content

Commit 9291ccf

Browse files
Heiko Voigtgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 0dc0621 commit 9291ccf

File tree

4 files changed

+115
-0
lines changed

4 files changed

+115
-0
lines changed

t/t9603-cvsimport-patchsets.sh

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
history
2+
val-tags

t/t9603/cvsroot/module/a,v

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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+
@

0 commit comments

Comments
 (0)