Debian Codegraph @

tests/test-convert-hg-source.t

raw
1 $ cat >> $HGRCPATH <<EOF
2 > [extensions]
3 > convert=
4 > [convert]
5 > hg.saverev=False
6 > EOF
7 $ hg init orig
8 $ cd orig
9 $ echo foo > foo
10 $ echo bar > bar
11 $ hg ci -qAm 'add foo bar' -d '0 0'
12 $ echo >> foo
13 $ hg ci -m 'change foo' -d '1 0'
14 $ hg up -qC 0
15 $ hg copy --after --force foo bar
16 $ hg copy foo baz
17 $ hg ci -m 'make bar and baz copies of foo' -d '2 0'
18 created new head
19
20 Test that template can print all file copies (issue4362)
21 $ hg log -r . --template "{file_copies % ' File: {file_copy}\n'}"
22 File: bar (foo)
23 File: baz (foo)
24
25 $ hg bookmark premerge1
26 $ hg merge -r 1
27 merging baz and foo to baz
28 1 files updated, 1 files merged, 0 files removed, 0 files unresolved
29 (branch merge, don't forget to commit)
30 $ hg ci -m 'merge local copy' -d '3 0'
31 $ hg up -C 1
32 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
33 (leaving bookmark premerge1)
34 $ hg bookmark premerge2
35 $ hg merge 2
36 merging foo and baz to baz
37 1 files updated, 1 files merged, 0 files removed, 0 files unresolved
38 (branch merge, don't forget to commit)
39 $ hg ci -m 'merge remote copy' -d '4 0'
40 created new head
41
42 Make and delete some tags
43
44 $ hg tag that
45 $ hg tag --remove that
46 $ hg tag this
47
48 #if execbit
49 $ chmod +x baz
50 #else
51 $ echo some other change to make sure we get a rev 5 > baz
52 #endif
53 $ hg ci -m 'mark baz executable' -d '5 0'
54 $ cd ..
55 $ hg convert --datesort orig new 2>&1 | grep -v 'subversion python bindings could not be loaded'
56 initializing destination new repository
57 scanning source...
58 sorting...
59 converting...
60 8 add foo bar
61 7 change foo
62 6 make bar and baz copies of foo
63 5 merge local copy
64 4 merge remote copy
65 3 Added tag that for changeset 8601262d7472
66 2 Removed tag that
67 1 Added tag this for changeset 706614b458c1
68 0 mark baz executable
69 updating bookmarks
70 $ cd new
71 $ hg out ../orig
72 comparing with ../orig
73 searching for changes
74 no changes found
75 [1]
76 #if execbit
77 $ hg bookmarks
78 premerge1 3:973ef48a98a4
79 premerge2 8:c4968fdf2e5d
80 #else
81 Different hash because no x bit
82 $ hg bookmarks
83 premerge1 3:973ef48a98a4
84 premerge2 8:1cc21e701444
85 #endif
86
87 Test that redoing a convert results in an identical graph
88 $ cd ../
89 $ rm new/.hg/shamap
90 $ hg convert --datesort orig new 2>&1 | grep -v 'subversion python bindings could not be loaded'
91 scanning source...
92 sorting...
93 converting...
94 8 add foo bar
95 7 change foo
96 6 make bar and baz copies of foo
97 5 merge local copy
98 4 merge remote copy
99 3 Added tag that for changeset 8601262d7472
100 2 Removed tag that
101 1 Added tag this for changeset 706614b458c1
102 0 mark baz executable
103 updating bookmarks
104 $ hg -R new log -G -T '{rev} {desc}'
105 o 8 mark baz executable
106 |
107 o 7 Added tag this for changeset 706614b458c1
108 |
109 o 6 Removed tag that
110 |
111 o 5 Added tag that for changeset 8601262d7472
112 |
113 o 4 merge remote copy
114 |\
115 +---o 3 merge local copy
116 | |/
117 | o 2 make bar and baz copies of foo
118 | |
119 o | 1 change foo
120 |/
121 o 0 add foo bar
122
123
124 check shamap LF and CRLF handling
125
126 $ cat > rewrite.py <<EOF
127 > import sys
128 > # Interlace LF and CRLF
129 > lines = [(l.rstrip() + ((i % 2) and b'\n' or b'\r\n'))
130 > for i, l in enumerate(open(sys.argv[1], 'rb'))]
131 > open(sys.argv[1], 'wb').write(b''.join(lines))
132 > EOF
133 $ "$PYTHON" rewrite.py new/.hg/shamap
134 $ cd orig
135 $ hg up -qC 1
136 $ echo foo >> foo
137 $ hg ci -qm 'change foo again'
138 $ hg up -qC 2
139 $ echo foo >> foo
140 $ hg ci -qm 'change foo again again'
141 $ cd ..
142 $ hg convert --datesort orig new 2>&1 | grep -v 'subversion python bindings could not be loaded'
143 scanning source...
144 sorting...
145 converting...
146 1 change foo again again
147 0 change foo again
148 updating bookmarks
149
150 init broken repository
151
152 $ hg init broken
153 $ cd broken
154 $ echo a >> a
155 $ echo b >> b
156 $ hg ci -qAm init
157 $ echo a >> a
158 $ echo b >> b
159 $ hg copy b c
160 $ hg ci -qAm changeall
161 $ hg up -qC 0
162 $ echo bc >> b
163 $ hg ci -m changebagain
164 created new head
165 $ HGMERGE=internal:local hg -q merge
166 $ hg ci -m merge
167 $ hg mv b d
168 $ hg ci -m moveb
169
170 break it
171
172 $ rm .hg/store/data/b.*
173 $ cd ..
174 $ hg --config convert.hg.ignoreerrors=True convert broken fixed
175 initializing destination fixed repository
176 scanning source...
177 sorting...
178 converting...
179 4 init
180 ignoring: b@1e88685f5ddec574a34c70af492f95b6debc8741: no match found
181 3 changeall
182 2 changebagain
183 1 merge
184 0 moveb
185 $ hg -R fixed verify -q
186
187 manifest -r 0
188
189 $ hg -R fixed manifest -r 0
190 a
191
192 manifest -r tip
193
194 $ hg -R fixed manifest -r tip
195 a
196 c
197 d
198 $ cd ..
199
200 $ hg init commit-references
201 $ cd commit-references
202 $ echo a > a
203 $ hg ci -Aqm initial
204 $ echo b > b
205 $ hg ci -Aqm 'the previous commit was 1451231c8757'
206 $ echo c > c
207 $ hg ci -Aqm 'the working copy is called ffffffffffff'
208
209 $ cd ..
210 $ hg convert commit-references new-commit-references -q \
211 > --config convert.hg.sourcename=yes
212 $ cd new-commit-references
213 $ hg log -T '{node|short} {desc}\n'
214 fe295c9e6bc6 the working copy is called ffffffffffff
215 642508659503 the previous commit was c2491f685436
216 c2491f685436 initial