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