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