##// END OF EJS Templates
tests: cover revision conversion logic in githelp tests...
Denis Laxalde -
r44185:5470e636 stable
parent child Browse files
Show More
@@ -1,316 +1,320 b''
1 $ cat >> $HGRCPATH << EOF
1 $ cat >> $HGRCPATH << EOF
2 > [extensions]
2 > [extensions]
3 > githelp =
3 > githelp =
4 > EOF
4 > EOF
5
5
6 $ hg init repo
6 $ hg init repo
7 $ cd repo
7 $ cd repo
8 $ echo foo > test_file
8 $ echo foo > test_file
9 $ mkdir dir
9 $ mkdir dir
10 $ echo foo > dir/file
10 $ echo foo > dir/file
11 $ echo foo > removed_file
11 $ echo foo > removed_file
12 $ echo foo > deleted_file
12 $ echo foo > deleted_file
13 $ hg add -q .
13 $ hg add -q .
14 $ hg commit -m 'bar'
14 $ hg commit -m 'bar'
15 $ hg bookmark both
15 $ hg bookmark both
16 $ touch both
16 $ touch both
17 $ touch untracked_file
17 $ touch untracked_file
18 $ hg remove removed_file
18 $ hg remove removed_file
19 $ rm deleted_file
19 $ rm deleted_file
20
20
21 githelp on a single command should succeed
21 githelp on a single command should succeed
22 $ hg githelp -- commit
22 $ hg githelp -- commit
23 hg commit
23 hg commit
24 $ hg githelp -- git commit
24 $ hg githelp -- git commit
25 hg commit
25 hg commit
26
26
27 githelp should fail nicely if we don't give it arguments
27 githelp should fail nicely if we don't give it arguments
28 $ hg githelp
28 $ hg githelp
29 abort: missing git command - usage: hg githelp -- <git command>
29 abort: missing git command - usage: hg githelp -- <git command>
30 [255]
30 [255]
31 $ hg githelp -- git
31 $ hg githelp -- git
32 abort: missing git command - usage: hg githelp -- <git command>
32 abort: missing git command - usage: hg githelp -- <git command>
33 [255]
33 [255]
34
34
35 githelp on a command with options should succeed
35 githelp on a command with options should succeed
36 $ hg githelp -- commit -pm "abc"
36 $ hg githelp -- commit -pm "abc"
37 hg commit --interactive -m 'abc'
37 hg commit --interactive -m 'abc'
38
38
39 githelp on a command with standalone unrecognized option should succeed with warning
39 githelp on a command with standalone unrecognized option should succeed with warning
40 $ hg githelp -- commit -p -v
40 $ hg githelp -- commit -p -v
41 ignoring unknown option -v
41 ignoring unknown option -v
42 hg commit --interactive
42 hg commit --interactive
43
43
44 githelp on a command with unrecognized option packed with other options should fail with error
44 githelp on a command with unrecognized option packed with other options should fail with error
45 $ hg githelp -- commit -pv
45 $ hg githelp -- commit -pv
46 abort: unknown option 'v' packed with other options
46 abort: unknown option 'v' packed with other options
47 (please try passing the option as its own flag: -v)
47 (please try passing the option as its own flag: -v)
48 [255]
48 [255]
49
49
50 githelp for git rebase --skip
50 githelp for git rebase --skip
51 $ hg githelp -- git rebase --skip
51 $ hg githelp -- git rebase --skip
52 hg revert --all -r .
52 hg revert --all -r .
53 hg rebase --continue
53 hg rebase --continue
54
54
55 githelp for git commit --amend (hg commit --amend pulls up an editor)
55 githelp for git commit --amend (hg commit --amend pulls up an editor)
56 $ hg githelp -- commit --amend
56 $ hg githelp -- commit --amend
57 hg commit --amend
57 hg commit --amend
58
58
59 githelp for git commit --amend --no-edit (hg amend does not pull up an editor)
59 githelp for git commit --amend --no-edit (hg amend does not pull up an editor)
60 $ hg githelp -- commit --amend --no-edit
60 $ hg githelp -- commit --amend --no-edit
61 hg amend
61 hg amend
62
62
63 githelp for git checkout -- . (checking out a directory)
63 githelp for git checkout -- . (checking out a directory)
64 $ hg githelp -- checkout -- .
64 $ hg githelp -- checkout -- .
65 note: use --no-backup to avoid creating .orig files
65 note: use --no-backup to avoid creating .orig files
66
66
67 hg revert .
67 hg revert .
68
68
69 githelp for git checkout "HEAD^" (should still work to pass a rev)
69 githelp for git checkout "HEAD^" (should still work to pass a rev)
70 $ hg githelp -- checkout "HEAD^"
70 $ hg githelp -- checkout "HEAD^"
71 hg update .^
71 hg update .^
72
72
73 githelp checkout: args after -- should be treated as paths no matter what
73 githelp checkout: args after -- should be treated as paths no matter what
74 $ hg githelp -- checkout -- HEAD
74 $ hg githelp -- checkout -- HEAD
75 note: use --no-backup to avoid creating .orig files
75 note: use --no-backup to avoid creating .orig files
76
76
77 hg revert HEAD
77 hg revert HEAD
78
78
79 githelp for git checkout with rev and path
79 githelp for git checkout with rev and path
80 $ hg githelp -- checkout "HEAD^" -- file.txt
80 $ hg githelp -- checkout "HEAD^" -- file.txt
81 note: use --no-backup to avoid creating .orig files
81 note: use --no-backup to avoid creating .orig files
82
82
83 hg revert -r .^ file.txt
83 hg revert -r .^ file.txt
84
84
85 githelp for git with rev and path, without separator
85 githelp for git with rev and path, without separator
86 $ hg githelp -- checkout "HEAD^" file.txt
86 $ hg githelp -- checkout "HEAD^" file.txt
87 note: use --no-backup to avoid creating .orig files
87 note: use --no-backup to avoid creating .orig files
88
88
89 hg revert -r .^ file.txt
89 hg revert -r .^ file.txt
90
90
91 githelp for checkout with a file as first argument
91 githelp for checkout with a file as first argument
92 $ hg githelp -- checkout test_file
92 $ hg githelp -- checkout test_file
93 note: use --no-backup to avoid creating .orig files
93 note: use --no-backup to avoid creating .orig files
94
94
95 hg revert test_file
95 hg revert test_file
96
96
97 githelp for checkout with a removed file as first argument
97 githelp for checkout with a removed file as first argument
98 $ hg githelp -- checkout removed_file
98 $ hg githelp -- checkout removed_file
99 note: use --no-backup to avoid creating .orig files
99 note: use --no-backup to avoid creating .orig files
100
100
101 hg revert removed_file
101 hg revert removed_file
102
102
103 githelp for checkout with a deleted file as first argument
103 githelp for checkout with a deleted file as first argument
104 $ hg githelp -- checkout deleted_file
104 $ hg githelp -- checkout deleted_file
105 note: use --no-backup to avoid creating .orig files
105 note: use --no-backup to avoid creating .orig files
106
106
107 hg revert deleted_file
107 hg revert deleted_file
108
108
109 githelp for checkout with a untracked file as first argument
109 githelp for checkout with a untracked file as first argument
110 $ hg githelp -- checkout untracked_file
110 $ hg githelp -- checkout untracked_file
111 note: use --no-backup to avoid creating .orig files
111 note: use --no-backup to avoid creating .orig files
112
112
113 hg revert untracked_file
113 hg revert untracked_file
114
114
115 githelp for checkout with a directory as first argument
115 githelp for checkout with a directory as first argument
116 $ hg githelp -- checkout dir
116 $ hg githelp -- checkout dir
117 note: use --no-backup to avoid creating .orig files
117 note: use --no-backup to avoid creating .orig files
118
118
119 hg revert dir
119 hg revert dir
120
120
121 githelp for checkout when not in repo root
121 githelp for checkout when not in repo root
122 $ cd dir
122 $ cd dir
123 $ hg githelp -- checkout file
123 $ hg githelp -- checkout file
124 note: use --no-backup to avoid creating .orig files
124 note: use --no-backup to avoid creating .orig files
125
125
126 hg revert file
126 hg revert file
127
127
128 $ cd ..
128 $ cd ..
129
129
130 githelp for checkout with an argument that is both a file and a revision
130 githelp for checkout with an argument that is both a file and a revision
131 $ hg githelp -- checkout both
131 $ hg githelp -- checkout both
132 hg update both
132 hg update both
133
133
134 githelp for checkout with the -p option
134 githelp for checkout with the -p option
135 $ hg githelp -- git checkout -p xyz
135 $ hg githelp -- git checkout -p xyz
136 hg revert -i -r xyz
136 hg revert -i -r xyz
137
137
138 $ hg githelp -- git checkout -p xyz -- abc
138 $ hg githelp -- git checkout -p xyz -- abc
139 note: use --no-backup to avoid creating .orig files
139 note: use --no-backup to avoid creating .orig files
140
140
141 hg revert -i -r xyz abc
141 hg revert -i -r xyz abc
142
142
143 githelp for checkout with the -f option and a rev
143 githelp for checkout with the -f option and a rev
144 $ hg githelp -- git checkout -f xyz
144 $ hg githelp -- git checkout -f xyz
145 hg update -C xyz
145 hg update -C xyz
146 $ hg githelp -- git checkout --force xyz
146 $ hg githelp -- git checkout --force xyz
147 hg update -C xyz
147 hg update -C xyz
148
148
149 githelp for checkout with the -f option without an arg
149 githelp for checkout with the -f option without an arg
150 $ hg githelp -- git checkout -f
150 $ hg githelp -- git checkout -f
151 hg revert --all
151 hg revert --all
152 $ hg githelp -- git checkout --force
152 $ hg githelp -- git checkout --force
153 hg revert --all
153 hg revert --all
154
154
155 githelp for grep with pattern and path
155 githelp for grep with pattern and path
156 $ hg githelp -- grep shrubbery flib/intern/
156 $ hg githelp -- grep shrubbery flib/intern/
157 hg grep shrubbery flib/intern/
157 hg grep shrubbery flib/intern/
158
158
159 githelp for reset, checking ~ in git becomes ~1 in mercurial
159 githelp for reset, checking ~ in git becomes ~1 in mercurial
160 $ hg githelp -- reset HEAD~
160 $ hg githelp -- reset HEAD~
161 hg update .~1
161 hg update .~1
162 $ hg githelp -- reset "HEAD^"
162 $ hg githelp -- reset "HEAD^"
163 hg update .^
163 hg update .^
164 $ hg githelp -- reset HEAD~3
164 $ hg githelp -- reset HEAD~3
165 hg update .~3
165 hg update .~3
166
166
167 $ hg githelp -- reset --mixed HEAD
167 $ hg githelp -- reset --mixed HEAD
168 note: --mixed has no meaning since Mercurial has no staging area
168 note: --mixed has no meaning since Mercurial has no staging area
169
169
170 hg update .
170 hg update .
171 $ hg githelp -- reset --soft HEAD
171 $ hg githelp -- reset --soft HEAD
172 note: --soft has no meaning since Mercurial has no staging area
172 note: --soft has no meaning since Mercurial has no staging area
173
173
174 hg update .
174 hg update .
175 $ hg githelp -- reset --hard HEAD
175 $ hg githelp -- reset --hard HEAD
176 hg update --clean .
176 hg update --clean .
177
177
178 githelp for git show --name-status
178 githelp for git show --name-status
179 $ hg githelp -- git show --name-status
179 $ hg githelp -- git show --name-status
180 hg log --style status -r .
180 hg log --style status -r .
181
181
182 githelp for git show --pretty=format: --name-status
182 githelp for git show --pretty=format: --name-status
183 $ hg githelp -- git show --pretty=format: --name-status
183 $ hg githelp -- git show --pretty=format: --name-status
184 hg status --change .
184 hg status --change .
185
185
186 githelp for show with no arguments
186 githelp for show with no arguments
187 $ hg githelp -- show
187 $ hg githelp -- show
188 hg export
188 hg export
189
189
190 githelp for show with a path
190 githelp for show with a path
191 $ hg githelp -- show test_file
191 $ hg githelp -- show test_file
192 hg cat test_file
192 hg cat test_file
193
193
194 githelp for show with not a path:
194 githelp for show with not a path:
195 $ hg githelp -- show rev
195 $ hg githelp -- show rev
196 hg export rev
196 hg export rev
197
197
198 githelp for show with many arguments
198 githelp for show with many arguments
199 $ hg githelp -- show argone argtwo
199 $ hg githelp -- show argone argtwo
200 hg export argone argtwo
200 hg export argone argtwo
201 $ hg githelp -- show test_file argone argtwo
201 $ hg githelp -- show test_file argone argtwo
202 hg cat test_file argone argtwo
202 hg cat test_file argone argtwo
203
203
204 githelp for show with --unified options
204 githelp for show with --unified options
205 $ hg githelp -- show --unified=10
205 $ hg githelp -- show --unified=10
206 hg export --config diff.unified=10
206 hg export --config diff.unified=10
207 $ hg githelp -- show -U100
207 $ hg githelp -- show -U100
208 hg export --config diff.unified=100
208 hg export --config diff.unified=100
209
209
210 githelp for show with a path and --unified
210 githelp for show with a path and --unified
211 $ hg githelp -- show -U20 test_file
211 $ hg githelp -- show -U20 test_file
212 hg cat test_file --config diff.unified=20
212 hg cat test_file --config diff.unified=20
213
213
214 githelp for stash drop without name
214 githelp for stash drop without name
215 $ hg githelp -- git stash drop
215 $ hg githelp -- git stash drop
216 hg shelve -d <shelve name>
216 hg shelve -d <shelve name>
217
217
218 githelp for stash drop with name
218 githelp for stash drop with name
219 $ hg githelp -- git stash drop xyz
219 $ hg githelp -- git stash drop xyz
220 hg shelve -d xyz
220 hg shelve -d xyz
221
221
222 githelp for stash list with patch
222 githelp for stash list with patch
223 $ hg githelp -- git stash list -p
223 $ hg githelp -- git stash list -p
224 hg shelve -l -p
224 hg shelve -l -p
225
225
226 githelp for stash show
226 githelp for stash show
227 $ hg githelp -- git stash show
227 $ hg githelp -- git stash show
228 hg shelve --stat
228 hg shelve --stat
229
229
230 githelp for stash show with patch and name
230 githelp for stash show with patch and name
231 $ hg githelp -- git stash show -p mystash
231 $ hg githelp -- git stash show -p mystash
232 hg shelve -p mystash
232 hg shelve -p mystash
233
233
234 githelp for stash clear
234 githelp for stash clear
235 $ hg githelp -- git stash clear
235 $ hg githelp -- git stash clear
236 hg shelve --cleanup
236 hg shelve --cleanup
237
237
238 githelp for whatchanged should show deprecated message
238 githelp for whatchanged should show deprecated message
239 $ hg githelp -- whatchanged -p
239 $ hg githelp -- whatchanged -p
240 this command has been deprecated in the git project, thus isn't supported by this tool
240 this command has been deprecated in the git project, thus isn't supported by this tool
241
241
242
242
243 githelp for git branch -m renaming
243 githelp for git branch -m renaming
244 $ hg githelp -- git branch -m old new
244 $ hg githelp -- git branch -m old new
245 hg bookmark -m old new
245 hg bookmark -m old new
246
246
247 When the old name is omitted, git branch -m new renames the current branch.
247 When the old name is omitted, git branch -m new renames the current branch.
248 $ hg githelp -- git branch -m new
248 $ hg githelp -- git branch -m new
249 hg bookmark -m `hg log -T"{activebookmark}" -r .` new
249 hg bookmark -m `hg log -T"{activebookmark}" -r .` new
250
250
251 Branch deletion in git strips commits
251 Branch deletion in git strips commits
252 $ hg githelp -- git branch -d
252 $ hg githelp -- git branch -d
253 hg strip -B
253 hg strip -B
254 $ hg githelp -- git branch -d feature
254 $ hg githelp -- git branch -d feature
255 hg strip -B feature -B
255 hg strip -B feature -B
256 $ hg githelp -- git branch --delete experiment1 experiment2
256 $ hg githelp -- git branch --delete experiment1 experiment2
257 hg strip -B experiment1 -B experiment2 -B
257 hg strip -B experiment1 -B experiment2 -B
258
258
259 githelp for reuse message using the shorthand
259 githelp for reuse message using the shorthand
260 $ hg githelp -- git commit -C deadbeef
260 $ hg githelp -- git commit -C deadbeef
261 hg commit -M deadbeef
261 hg commit -M deadbeef
262
262
263 githelp for reuse message using the the long version
263 githelp for reuse message using the the long version
264 $ hg githelp -- git commit --reuse-message deadbeef
264 $ hg githelp -- git commit --reuse-message deadbeef
265 hg commit -M deadbeef
265 hg commit -M deadbeef
266
266
267 githelp for reuse message using HEAD
268 $ hg githelp -- git commit --reuse-message HEAD~
269 hg commit -M .~1
270
267 githelp for apply with no options
271 githelp for apply with no options
268 $ hg githelp -- apply
272 $ hg githelp -- apply
269 hg import --no-commit
273 hg import --no-commit
270
274
271 githelp for apply with directory strip custom
275 githelp for apply with directory strip custom
272 $ hg githelp -- apply -p 5
276 $ hg githelp -- apply -p 5
273 hg import --no-commit -p 5
277 hg import --no-commit -p 5
274
278
275 githelp for apply with prefix directory
279 githelp for apply with prefix directory
276 $ hg githelp -- apply --directory=modules
280 $ hg githelp -- apply --directory=modules
277 hg import --no-commit --prefix modules
281 hg import --no-commit --prefix modules
278
282
279 git merge-base
283 git merge-base
280 $ hg githelp -- git merge-base --is-ancestor
284 $ hg githelp -- git merge-base --is-ancestor
281 ignoring unknown option --is-ancestor
285 ignoring unknown option --is-ancestor
282 note: ancestors() is part of the revset language
286 note: ancestors() is part of the revset language
283 (learn more about revsets with 'hg help revsets')
287 (learn more about revsets with 'hg help revsets')
284
288
285 hg log -T '{node}\n' -r 'ancestor(A,B)'
289 hg log -T '{node}\n' -r 'ancestor(A,B)'
286
290
287 githelp for git blame
291 githelp for git blame
288 $ hg githelp -- git blame
292 $ hg githelp -- git blame
289 hg annotate -udl
293 hg annotate -udl
290
294
291 githelp for add
295 githelp for add
292
296
293 $ hg githelp -- git add
297 $ hg githelp -- git add
294 hg add
298 hg add
295
299
296 $ hg githelp -- git add -p
300 $ hg githelp -- git add -p
297 note: Mercurial will commit when complete, as there is no staging area in Mercurial
301 note: Mercurial will commit when complete, as there is no staging area in Mercurial
298
302
299 hg commit --interactive
303 hg commit --interactive
300
304
301 $ hg githelp -- git add --all
305 $ hg githelp -- git add --all
302 note: use hg addremove to remove files that have been deleted
306 note: use hg addremove to remove files that have been deleted
303
307
304 hg add
308 hg add
305
309
306 githelp for reflog
310 githelp for reflog
307
311
308 $ hg githelp -- git reflog
312 $ hg githelp -- git reflog
309 hg journal
313 hg journal
310
314
311 note: in hg commits can be deleted from repo but we always have backups
315 note: in hg commits can be deleted from repo but we always have backups
312
316
313 $ hg githelp -- git reflog --all
317 $ hg githelp -- git reflog --all
314 hg journal --all
318 hg journal --all
315
319
316 note: in hg commits can be deleted from repo but we always have backups
320 note: in hg commits can be deleted from repo but we always have backups
General Comments 0
You need to be logged in to leave comments. Login now