Debian Codegraph @

tests/postbranch.tst

raw
1 #!/usr/bin/env python3
2 ## Ilya Basin's test, failed by cvsps-3.x
3 """
4 Date: Sat, 20 Apr 2013 14:38:55 +0400
5 From: Ilya Basin <[email protected]>
6 Message-ID: <[email protected]>
7 Subject: cvsps --fast-export: a branch has no common ancestor with trunk
8
9 Hi Eric.
10 I think I found a bug: with option '--fast-export' cvsps produces a
11 stream in which the branch has no common ancestor with trunk. When
12 importing this with 'git fast-import', 2 branches are unrelated.
13
14 Please see the CVS repo here: https://github.com/basinilya/testcvsps
15 (cvs repo is inside the git repo)
16 Here I did:
17
18 1) create file "f"
19 2) commit
20 3) create branch "br":
21 # name the branch's point of attachment
22 cvs tag br_0
23 # actually create the branch
24 cvs tag -r br_0 -b br
25
26 4) modify f, commit in trunk
27 5)
28 # switch to new branch
29 cvs update -r br -kk
30
31 6) modify f, commit in br
32 7)
33 # switch back to trunk
34 cvs -q up -CAd -kk
35 8) modify f, commit in trunk
36
37 (To have both cvsps versions, I created: /usr/local/bin/cvsps -> /usr/bin/cvsps2)
38
39 The correct graph, imported with: git cvsimport -C proj2 -r cvs -k proj
40
41 * commit 6351661c6711ebb6295c473cb1110fbb9d0513ab
42 | Author: il <il>
43 | Date: Sat Apr 20 09:23:01 2013 +0000
44 |
45 | second commit in trunk
46 |
47 | * commit d047058d60d57f90d404129321c809e7c91253d5
48 |/ Author: il <il>
49 | Date: Sat Apr 20 09:16:37 2013 +0000
50 |
51 | commit in br
52 |
53 * commit e56d41b400a1a8cd50d7880d0278b42e960fb451
54 | Author: il <il>
55 | Date: Sat Apr 20 09:15:21 2013 +0000
56 |
57 | commit in trunk
58 |
59 * commit 4374f4dcb6125dae25cc630a7b81149595621d6d
60 Author: il <il>
61 Date: Sat Apr 20 09:11:34 2013 +0000
62
63 root
64
65 Wrong graph, imported with: /usr/bin/cvsps --fast-export proj | git fast-import
66
67 * commit 6351661c6711ebb6295c473cb1110fbb9d0513ab
68 | Author: il <il>
69 | Date: Sat Apr 20 09:23:01 2013 +0000
70 |
71 | second commit in trunk
72 |
73 * commit e56d41b400a1a8cd50d7880d0278b42e960fb451
74 | Author: il <il>
75 | Date: Sat Apr 20 09:15:21 2013 +0000
76 |
77 | commit in trunk
78 |
79 * commit 4374f4dcb6125dae25cc630a7b81149595621d6d
80 Author: il <il>
81 Date: Sat Apr 20 09:11:34 2013 +0000
82
83 root
84
85 * commit edb5d8ac84296d376aada841f4c45e05ba8db1d8
86 Author: il <il>
87 Date: Sat Apr 20 09:16:37 2013 +0000
88
89 commit in br
90 """
91
92 import sys, testlifter
93
94 testlifter.verbose += sys.argv[1:].count("-v")
95 repo = testlifter.CVSRepository("postbranch.repo")
96 repo.init()
97 repo.module("module")
98 co = repo.checkout("module", "postbranch.checkout")
99
100 # 1) create file "f"
101 co.write("f", "random content")
102 co.add("f")
103
104 # 2) commit
105 co.commit("root")
106
107 # 3) create branch "br":
108 # name the branch's point of attachment
109 co.outdo("cvs -Q tag br_0")
110 # actually create the branch
111 co.outdo("cvs -Q tag -r br_0 -b br")
112
113 # 4) modify f, commit in trunk
114 co.write("f", "different random content")
115 co.commit("commit in trunk")
116
117 # 5) switch to new branch
118 co.outdo("cvs -Q update -r br")
119
120 # 6) modify f, commit in br
121 co.write("f", "even more random content")
122 co.commit("commit in br")
123
124 # 7) switch back to trunk
125 co.outdo("cvs -Q -q up -CAd")
126
127 # 8) modify f, commit in trunk
128 co.write("f", "even more different random content")
129 co.commit("second commit in trunk")
130
131 repo.cleanup()
132
133 # end