##// END OF EJS Templates
test: enforce master to be the default branch in test...
marmoute -
r47596:6dea77e1 default
parent child Browse files
Show More
@@ -1,359 +1,360 b''
1 #require pygit2
1 #require pygit2
2
2
3 Setup:
3 Setup:
4 $ GIT_AUTHOR_NAME='test'; export GIT_AUTHOR_NAME
4 $ GIT_AUTHOR_NAME='test'; export GIT_AUTHOR_NAME
5 > GIT_AUTHOR_EMAIL='test@example.org'; export GIT_AUTHOR_EMAIL
5 > GIT_AUTHOR_EMAIL='test@example.org'; export GIT_AUTHOR_EMAIL
6 > GIT_AUTHOR_DATE="2007-01-01 00:00:00 +0000"; export GIT_AUTHOR_DATE
6 > GIT_AUTHOR_DATE="2007-01-01 00:00:00 +0000"; export GIT_AUTHOR_DATE
7 > GIT_COMMITTER_NAME="$GIT_AUTHOR_NAME"; export GIT_COMMITTER_NAME
7 > GIT_COMMITTER_NAME="$GIT_AUTHOR_NAME"; export GIT_COMMITTER_NAME
8 > GIT_COMMITTER_EMAIL="$GIT_AUTHOR_EMAIL"; export GIT_COMMITTER_EMAIL
8 > GIT_COMMITTER_EMAIL="$GIT_AUTHOR_EMAIL"; export GIT_COMMITTER_EMAIL
9 > GIT_COMMITTER_DATE="$GIT_AUTHOR_DATE"; export GIT_COMMITTER_DATE
9 > GIT_COMMITTER_DATE="$GIT_AUTHOR_DATE"; export GIT_COMMITTER_DATE
10 > count=10
10 > count=10
11 > gitcommit() {
11 > gitcommit() {
12 > GIT_AUTHOR_DATE="2007-01-01 00:00:$count +0000";
12 > GIT_AUTHOR_DATE="2007-01-01 00:00:$count +0000";
13 > GIT_COMMITTER_DATE="$GIT_AUTHOR_DATE"
13 > GIT_COMMITTER_DATE="$GIT_AUTHOR_DATE"
14 > git commit "$@" >/dev/null 2>/dev/null || echo "git commit error"
14 > git commit "$@" >/dev/null 2>/dev/null || echo "git commit error"
15 > count=`expr $count + 1`
15 > count=`expr $count + 1`
16 > }
16 > }
17 $ git config --global init.defaultBranch master
17
18
18
19
19 $ hg version -v --config extensions.git= | grep '^[E ]'
20 $ hg version -v --config extensions.git= | grep '^[E ]'
20 Enabled extensions:
21 Enabled extensions:
21 git internal (pygit2 *) (glob)
22 git internal (pygit2 *) (glob)
22
23
23 Test auto-loading extension works:
24 Test auto-loading extension works:
24 $ mkdir nogit
25 $ mkdir nogit
25 $ cd nogit
26 $ cd nogit
26 $ mkdir .hg
27 $ mkdir .hg
27 $ echo git >> .hg/requires
28 $ echo git >> .hg/requires
28 $ hg status
29 $ hg status
29 abort: repository specified git format in .hg/requires but has no .git directory
30 abort: repository specified git format in .hg/requires but has no .git directory
30 [255]
31 [255]
31 $ git config --global init.defaultBranch master
32 $ git config --global init.defaultBranch master
32 $ git init
33 $ git init
33 Initialized empty Git repository in $TESTTMP/nogit/.git/
34 Initialized empty Git repository in $TESTTMP/nogit/.git/
34 This status invocation shows some hg gunk because we didn't use
35 This status invocation shows some hg gunk because we didn't use
35 `hg init --git`, which fixes up .git/info/exclude for us.
36 `hg init --git`, which fixes up .git/info/exclude for us.
36 $ hg status
37 $ hg status
37 ? .hg/cache/git-commits.sqlite
38 ? .hg/cache/git-commits.sqlite
38 ? .hg/cache/git-commits.sqlite-shm
39 ? .hg/cache/git-commits.sqlite-shm
39 ? .hg/cache/git-commits.sqlite-wal
40 ? .hg/cache/git-commits.sqlite-wal
40 ? .hg/requires
41 ? .hg/requires
41 $ cd ..
42 $ cd ..
42
43
43 Now globally enable extension for the rest of the test:
44 Now globally enable extension for the rest of the test:
44 $ cat <<EOF >> $HGRCPATH
45 $ cat <<EOF >> $HGRCPATH
45 > [extensions]
46 > [extensions]
46 > git=
47 > git=
47 > [git]
48 > [git]
48 > log-index-cache-miss = yes
49 > log-index-cache-miss = yes
49 > EOF
50 > EOF
50
51
51 Make a new repo with git:
52 Make a new repo with git:
52 $ mkdir foo
53 $ mkdir foo
53 $ cd foo
54 $ cd foo
54 $ git init
55 $ git init
55 Initialized empty Git repository in $TESTTMP/foo/.git/
56 Initialized empty Git repository in $TESTTMP/foo/.git/
56 Ignore the .hg directory within git:
57 Ignore the .hg directory within git:
57 $ echo .hg >> .git/info/exclude
58 $ echo .hg >> .git/info/exclude
58 $ echo alpha > alpha
59 $ echo alpha > alpha
59 $ git add alpha
60 $ git add alpha
60 $ gitcommit -am 'Add alpha'
61 $ gitcommit -am 'Add alpha'
61 $ echo beta > beta
62 $ echo beta > beta
62 $ git add beta
63 $ git add beta
63 $ gitcommit -am 'Add beta'
64 $ gitcommit -am 'Add beta'
64 $ echo gamma > gamma
65 $ echo gamma > gamma
65 $ git status
66 $ git status
66 On branch master
67 On branch master
67 Untracked files:
68 Untracked files:
68 (use "git add <file>..." to include in what will be committed)
69 (use "git add <file>..." to include in what will be committed)
69 gamma
70 gamma
70
71
71 nothing added to commit but untracked files present (use "git add" to track)
72 nothing added to commit but untracked files present (use "git add" to track)
72
73
73 Without creating the .hg, hg status fails:
74 Without creating the .hg, hg status fails:
74 $ hg status
75 $ hg status
75 abort: no repository found in '$TESTTMP/foo' (.hg not found)
76 abort: no repository found in '$TESTTMP/foo' (.hg not found)
76 [10]
77 [10]
77 But if you run hg init --git, it works:
78 But if you run hg init --git, it works:
78 $ hg init --git
79 $ hg init --git
79 $ hg id --traceback
80 $ hg id --traceback
80 heads mismatch, rebuilding dagcache
81 heads mismatch, rebuilding dagcache
81 3d9be8deba43 tip master
82 3d9be8deba43 tip master
82 $ hg status
83 $ hg status
83 ? gamma
84 ? gamma
84 Log works too:
85 Log works too:
85 $ hg log
86 $ hg log
86 changeset: 1:3d9be8deba43
87 changeset: 1:3d9be8deba43
87 bookmark: master
88 bookmark: master
88 tag: tip
89 tag: tip
89 user: test <test@example.org>
90 user: test <test@example.org>
90 date: Mon Jan 01 00:00:11 2007 +0000
91 date: Mon Jan 01 00:00:11 2007 +0000
91 summary: Add beta
92 summary: Add beta
92
93
93 changeset: 0:c5864c9d16fb
94 changeset: 0:c5864c9d16fb
94 user: test <test@example.org>
95 user: test <test@example.org>
95 date: Mon Jan 01 00:00:10 2007 +0000
96 date: Mon Jan 01 00:00:10 2007 +0000
96 summary: Add alpha
97 summary: Add alpha
97
98
98
99
99
100
100 and bookmarks:
101 and bookmarks:
101 $ hg bookmarks
102 $ hg bookmarks
102 * master 1:3d9be8deba43
103 * master 1:3d9be8deba43
103
104
104 diff even works transparently in both systems:
105 diff even works transparently in both systems:
105 $ echo blah >> alpha
106 $ echo blah >> alpha
106 $ git diff
107 $ git diff
107 diff --git a/alpha b/alpha
108 diff --git a/alpha b/alpha
108 index 4a58007..faed1b7 100644
109 index 4a58007..faed1b7 100644
109 --- a/alpha
110 --- a/alpha
110 +++ b/alpha
111 +++ b/alpha
111 @@ -1* +1,2 @@ (glob)
112 @@ -1* +1,2 @@ (glob)
112 alpha
113 alpha
113 +blah
114 +blah
114 $ hg diff --git
115 $ hg diff --git
115 diff --git a/alpha b/alpha
116 diff --git a/alpha b/alpha
116 --- a/alpha
117 --- a/alpha
117 +++ b/alpha
118 +++ b/alpha
118 @@ -1,1 +1,2 @@
119 @@ -1,1 +1,2 @@
119 alpha
120 alpha
120 +blah
121 +blah
121
122
122 Remove a file, it shows as such:
123 Remove a file, it shows as such:
123 $ rm alpha
124 $ rm alpha
124 $ hg status
125 $ hg status
125 ! alpha
126 ! alpha
126 ? gamma
127 ? gamma
127
128
128 Revert works:
129 Revert works:
129 $ hg revert alpha --traceback
130 $ hg revert alpha --traceback
130 $ hg status
131 $ hg status
131 ? gamma
132 ? gamma
132 $ git status
133 $ git status
133 On branch master
134 On branch master
134 Untracked files:
135 Untracked files:
135 (use "git add <file>..." to include in what will be committed)
136 (use "git add <file>..." to include in what will be committed)
136 gamma
137 gamma
137
138
138 nothing added to commit but untracked files present (use "git add" to track)
139 nothing added to commit but untracked files present (use "git add" to track)
139
140
140 Add shows sanely in both:
141 Add shows sanely in both:
141 $ hg add gamma
142 $ hg add gamma
142 $ hg status
143 $ hg status
143 A gamma
144 A gamma
144 $ hg files
145 $ hg files
145 alpha
146 alpha
146 beta
147 beta
147 gamma
148 gamma
148 $ git ls-files
149 $ git ls-files
149 alpha
150 alpha
150 beta
151 beta
151 gamma
152 gamma
152 $ git status
153 $ git status
153 On branch master
154 On branch master
154 Changes to be committed:
155 Changes to be committed:
155 (use "git restore --staged <file>..." to unstage)
156 (use "git restore --staged <file>..." to unstage)
156 new file: gamma
157 new file: gamma
157
158
158
159
159 forget does what it should as well:
160 forget does what it should as well:
160 $ hg forget gamma
161 $ hg forget gamma
161 $ hg status
162 $ hg status
162 ? gamma
163 ? gamma
163 $ git status
164 $ git status
164 On branch master
165 On branch master
165 Untracked files:
166 Untracked files:
166 (use "git add <file>..." to include in what will be committed)
167 (use "git add <file>..." to include in what will be committed)
167 gamma
168 gamma
168
169
169 nothing added to commit but untracked files present (use "git add" to track)
170 nothing added to commit but untracked files present (use "git add" to track)
170
171
171 clean up untracked file
172 clean up untracked file
172 $ rm gamma
173 $ rm gamma
173
174
174 hg log FILE
175 hg log FILE
175
176
176 $ echo a >> alpha
177 $ echo a >> alpha
177 $ hg ci -m 'more alpha' --traceback --date '1583522787 18000'
178 $ hg ci -m 'more alpha' --traceback --date '1583522787 18000'
178 $ echo b >> beta
179 $ echo b >> beta
179 $ hg ci -m 'more beta'
180 $ hg ci -m 'more beta'
180 heads mismatch, rebuilding dagcache
181 heads mismatch, rebuilding dagcache
181 $ echo a >> alpha
182 $ echo a >> alpha
182 $ hg ci -m 'even more alpha'
183 $ hg ci -m 'even more alpha'
183 heads mismatch, rebuilding dagcache
184 heads mismatch, rebuilding dagcache
184 $ hg log -G alpha
185 $ hg log -G alpha
185 heads mismatch, rebuilding dagcache
186 heads mismatch, rebuilding dagcache
186 @ changeset: 4:6626247b7dc8
187 @ changeset: 4:6626247b7dc8
187 : bookmark: master
188 : bookmark: master
188 : tag: tip
189 : tag: tip
189 : user: test <test>
190 : user: test <test>
190 : date: Thu Jan 01 00:00:00 1970 +0000
191 : date: Thu Jan 01 00:00:00 1970 +0000
191 : summary: even more alpha
192 : summary: even more alpha
192 :
193 :
193 o changeset: 2:a1983dd7fb19
194 o changeset: 2:a1983dd7fb19
194 : user: test <test>
195 : user: test <test>
195 : date: Fri Mar 06 14:26:27 2020 -0500
196 : date: Fri Mar 06 14:26:27 2020 -0500
196 : summary: more alpha
197 : summary: more alpha
197 :
198 :
198 o changeset: 0:c5864c9d16fb
199 o changeset: 0:c5864c9d16fb
199 user: test <test@example.org>
200 user: test <test@example.org>
200 date: Mon Jan 01 00:00:10 2007 +0000
201 date: Mon Jan 01 00:00:10 2007 +0000
201 summary: Add alpha
202 summary: Add alpha
202
203
203 $ hg log -G beta
204 $ hg log -G beta
204 o changeset: 3:d8ee22687733
205 o changeset: 3:d8ee22687733
205 : user: test <test>
206 : user: test <test>
206 : date: Thu Jan 01 00:00:00 1970 +0000
207 : date: Thu Jan 01 00:00:00 1970 +0000
207 : summary: more beta
208 : summary: more beta
208 :
209 :
209 o changeset: 1:3d9be8deba43
210 o changeset: 1:3d9be8deba43
210 | user: test <test@example.org>
211 | user: test <test@example.org>
211 ~ date: Mon Jan 01 00:00:11 2007 +0000
212 ~ date: Mon Jan 01 00:00:11 2007 +0000
212 summary: Add beta
213 summary: Add beta
213
214
214
215
215 $ hg log -r "children(3d9be8deba43)" -T"{node|short} {children}\n"
216 $ hg log -r "children(3d9be8deba43)" -T"{node|short} {children}\n"
216 a1983dd7fb19 3:d8ee22687733
217 a1983dd7fb19 3:d8ee22687733
217
218
218 hg annotate
219 hg annotate
219
220
220 $ hg annotate alpha
221 $ hg annotate alpha
221 0: alpha
222 0: alpha
222 2: a
223 2: a
223 4: a
224 4: a
224 $ hg annotate beta
225 $ hg annotate beta
225 1: beta
226 1: beta
226 3: b
227 3: b
227
228
228
229
229 Files in subdirectories. TODO: case-folding support, make this `A`
230 Files in subdirectories. TODO: case-folding support, make this `A`
230 instead of `a`.
231 instead of `a`.
231
232
232 $ mkdir a
233 $ mkdir a
233 $ echo "This is file mu." > a/mu
234 $ echo "This is file mu." > a/mu
234 $ hg ci -A -m 'Introduce file a/mu'
235 $ hg ci -A -m 'Introduce file a/mu'
235 adding a/mu
236 adding a/mu
236
237
237 Both hg and git agree a/mu is part of the repo
238 Both hg and git agree a/mu is part of the repo
238
239
239 $ git ls-files
240 $ git ls-files
240 a/mu
241 a/mu
241 alpha
242 alpha
242 beta
243 beta
243 $ hg files
244 $ hg files
244 a/mu
245 a/mu
245 alpha
246 alpha
246 beta
247 beta
247
248
248 hg and git status both clean
249 hg and git status both clean
249
250
250 $ git status
251 $ git status
251 On branch master
252 On branch master
252 nothing to commit, working tree clean
253 nothing to commit, working tree clean
253 $ hg status
254 $ hg status
254 heads mismatch, rebuilding dagcache
255 heads mismatch, rebuilding dagcache
255
256
256
257
257 node|shortest works correctly
258 node|shortest works correctly
258 $ hg log -T '{node}\n' | sort
259 $ hg log -T '{node}\n' | sort
259 3d9be8deba43482be2c81a4cb4be1f10d85fa8bc
260 3d9be8deba43482be2c81a4cb4be1f10d85fa8bc
260 6626247b7dc8f231b183b8a4761c89139baca2ad
261 6626247b7dc8f231b183b8a4761c89139baca2ad
261 a1983dd7fb19cbd83ad5a1c2fc8bf3d775dea12f
262 a1983dd7fb19cbd83ad5a1c2fc8bf3d775dea12f
262 ae1ab744f95bfd5b07cf573baef98a778058537b
263 ae1ab744f95bfd5b07cf573baef98a778058537b
263 c5864c9d16fb3431fe2c175ff84dc6accdbb2c18
264 c5864c9d16fb3431fe2c175ff84dc6accdbb2c18
264 d8ee22687733a1991813560b15128cd9734f4b48
265 d8ee22687733a1991813560b15128cd9734f4b48
265 $ hg log -r ae1ab744f95bfd5b07cf573baef98a778058537b --template "{shortest(node,1)}\n"
266 $ hg log -r ae1ab744f95bfd5b07cf573baef98a778058537b --template "{shortest(node,1)}\n"
266 ae
267 ae
267
268
268 This coveres changelog.findmissing()
269 This coveres changelog.findmissing()
269 $ hg merge --preview 3d9be8deba43
270 $ hg merge --preview 3d9be8deba43
270
271
271 This covers manifest.diff()
272 This covers manifest.diff()
272 $ hg diff -c 3d9be8deba43
273 $ hg diff -c 3d9be8deba43
273 diff -r c5864c9d16fb -r 3d9be8deba43 beta
274 diff -r c5864c9d16fb -r 3d9be8deba43 beta
274 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
275 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
275 +++ b/beta Mon Jan 01 00:00:11 2007 +0000
276 +++ b/beta Mon Jan 01 00:00:11 2007 +0000
276 @@ -0,0 +1,1 @@
277 @@ -0,0 +1,1 @@
277 +beta
278 +beta
278
279
279
280
280 Interactive commit should work as expected
281 Interactive commit should work as expected
281
282
282 $ echo bar >> alpha
283 $ echo bar >> alpha
283 $ echo bar >> beta
284 $ echo bar >> beta
284 $ hg commit -m "test interactive commit" -i --config ui.interactive=true --config ui.interface=text << EOF
285 $ hg commit -m "test interactive commit" -i --config ui.interactive=true --config ui.interface=text << EOF
285 > y
286 > y
286 > y
287 > y
287 > n
288 > n
288 > EOF
289 > EOF
289 diff --git a/alpha b/alpha
290 diff --git a/alpha b/alpha
290 1 hunks, 1 lines changed
291 1 hunks, 1 lines changed
291 examine changes to 'alpha'?
292 examine changes to 'alpha'?
292 (enter ? for help) [Ynesfdaq?] y
293 (enter ? for help) [Ynesfdaq?] y
293
294
294 @@ -1,3 +1,4 @@
295 @@ -1,3 +1,4 @@
295 alpha
296 alpha
296 a
297 a
297 a
298 a
298 +bar
299 +bar
299 record change 1/2 to 'alpha'?
300 record change 1/2 to 'alpha'?
300 (enter ? for help) [Ynesfdaq?] y
301 (enter ? for help) [Ynesfdaq?] y
301
302
302 diff --git a/beta b/beta
303 diff --git a/beta b/beta
303 1 hunks, 1 lines changed
304 1 hunks, 1 lines changed
304 examine changes to 'beta'?
305 examine changes to 'beta'?
305 (enter ? for help) [Ynesfdaq?] n
306 (enter ? for help) [Ynesfdaq?] n
306
307
307 Status should be consistent for both systems
308 Status should be consistent for both systems
308
309
309 $ hg status
310 $ hg status
310 heads mismatch, rebuilding dagcache
311 heads mismatch, rebuilding dagcache
311 M beta
312 M beta
312 $ git status | egrep -v '^$|^ \(use '
313 $ git status | egrep -v '^$|^ \(use '
313 On branch master
314 On branch master
314 Changes not staged for commit:
315 Changes not staged for commit:
315 modified: beta
316 modified: beta
316 no changes added to commit (use "git add" and/or "git commit -a")
317 no changes added to commit (use "git add" and/or "git commit -a")
317
318
318 Contents of each commit should be the same
319 Contents of each commit should be the same
319
320
320 $ hg ex -r .
321 $ hg ex -r .
321 # HG changeset patch
322 # HG changeset patch
322 # User test <test>
323 # User test <test>
323 # Date 0 0
324 # Date 0 0
324 # Thu Jan 01 00:00:00 1970 +0000
325 # Thu Jan 01 00:00:00 1970 +0000
325 # Node ID 80adc61cf57e99f6a412d83fee6239d1556cefcf
326 # Node ID 80adc61cf57e99f6a412d83fee6239d1556cefcf
326 # Parent ae1ab744f95bfd5b07cf573baef98a778058537b
327 # Parent ae1ab744f95bfd5b07cf573baef98a778058537b
327 test interactive commit
328 test interactive commit
328
329
329 diff -r ae1ab744f95b -r 80adc61cf57e alpha
330 diff -r ae1ab744f95b -r 80adc61cf57e alpha
330 --- a/alpha Thu Jan 01 00:00:00 1970 +0000
331 --- a/alpha Thu Jan 01 00:00:00 1970 +0000
331 +++ b/alpha Thu Jan 01 00:00:00 1970 +0000
332 +++ b/alpha Thu Jan 01 00:00:00 1970 +0000
332 @@ -1,3 +1,4 @@
333 @@ -1,3 +1,4 @@
333 alpha
334 alpha
334 a
335 a
335 a
336 a
336 +bar
337 +bar
337 $ git show
338 $ git show
338 commit 80adc61cf57e99f6a412d83fee6239d1556cefcf
339 commit 80adc61cf57e99f6a412d83fee6239d1556cefcf
339 Author: test <test>
340 Author: test <test>
340 Date: Thu Jan 1 00:00:00 1970 +0000
341 Date: Thu Jan 1 00:00:00 1970 +0000
341
342
342 test interactive commit
343 test interactive commit
343
344
344 diff --git a/alpha b/alpha
345 diff --git a/alpha b/alpha
345 index d112a75..d2a2e9a 100644
346 index d112a75..d2a2e9a 100644
346 --- a/alpha
347 --- a/alpha
347 +++ b/alpha
348 +++ b/alpha
348 @@ -1,3 +1,4 @@
349 @@ -1,3 +1,4 @@
349 alpha
350 alpha
350 a
351 a
351 a
352 a
352 +bar
353 +bar
353
354
354 Deleting files should also work (this was issue6398)
355 Deleting files should also work (this was issue6398)
355 $ hg revert -r . --all
356 $ hg revert -r . --all
356 reverting beta
357 reverting beta
357 $ hg rm beta
358 $ hg rm beta
358 $ hg ci -m 'remove beta'
359 $ hg ci -m 'remove beta'
359
360
General Comments 0
You need to be logged in to leave comments. Login now