Debian Codegraph @

tests/test-githelp.t

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