1#require rhg
2
3  $ NO_FALLBACK="env RHG_ON_UNSUPPORTED=abort"
4
5Unimplemented command
6  $ $NO_FALLBACK rhg unimplemented-command
7  unsupported feature: error: Found argument 'unimplemented-command' which wasn't expected, or isn't valid in this context
8
9  USAGE:
10      rhg [OPTIONS] <SUBCOMMAND>
11
12  For more information try --help
13
14  [252]
15  $ rhg unimplemented-command --config rhg.on-unsupported=abort-silent
16  [252]
17
18Finding root
19  $ $NO_FALLBACK rhg root
20  abort: no repository found in '$TESTTMP' (.hg not found)!
21  [255]
22
23  $ hg init repository
24  $ cd repository
25  $ $NO_FALLBACK rhg root
26  $TESTTMP/repository
27
28Reading and setting configuration
29  $ echo "[ui]" >> $HGRCPATH
30  $ echo "username = user1" >> $HGRCPATH
31  $ $NO_FALLBACK rhg config ui.username
32  user1
33  $ echo "[ui]" >> .hg/hgrc
34  $ echo "username = user2" >> .hg/hgrc
35  $ $NO_FALLBACK rhg config ui.username
36  user2
37  $ $NO_FALLBACK rhg --config ui.username=user3 config ui.username
38  user3
39
40Unwritable file descriptor
41  $ $NO_FALLBACK rhg root > /dev/full
42  abort: No space left on device (os error 28)
43  [255]
44
45Deleted repository
46  $ rm -rf `pwd`
47  $ $NO_FALLBACK rhg root
48  abort: error getting current working directory: $ENOENT$
49  [255]
50
51Listing tracked files
52  $ cd $TESTTMP
53  $ hg init repository
54  $ cd repository
55  $ for i in 1 2 3; do
56  >   echo $i >> file$i
57  >   hg add file$i
58  > done
59  > hg commit -m "commit $i" -q
60
61Listing tracked files from root
62  $ $NO_FALLBACK rhg files
63  file1
64  file2
65  file3
66
67Listing tracked files from subdirectory
68  $ mkdir -p path/to/directory
69  $ cd path/to/directory
70  $ $NO_FALLBACK rhg files
71  ../../../file1
72  ../../../file2
73  ../../../file3
74
75Listing tracked files through broken pipe
76  $ $NO_FALLBACK rhg files | head -n 1
77  ../../../file1
78
79Debuging data in inline index
80  $ cd $TESTTMP
81  $ rm -rf repository
82  $ hg init repository
83  $ cd repository
84  $ for i in 1 2 3 4 5 6; do
85  >   echo $i >> file-$i
86  >   hg add file-$i
87  >   hg commit -m "Commit $i" -q
88  > done
89  $ $NO_FALLBACK rhg debugdata -c 2
90  8d0267cb034247ebfa5ee58ce59e22e57a492297
91  test
92  0 0
93  file-3
94
95  Commit 3 (no-eol)
96  $ $NO_FALLBACK rhg debugdata -m 2
97  file-1\x00b8e02f6433738021a065f94175c7cd23db5f05be (esc)
98  file-2\x005d9299349fc01ddd25d0070d149b124d8f10411e (esc)
99  file-3\x002661d26c649684b482d10f91960cc3db683c38b4 (esc)
100
101Debuging with full node id
102  $ $NO_FALLBACK rhg debugdata -c `hg log -r 0 -T '{node}'`
103  d1d1c679d3053e8926061b6f45ca52009f011e3f
104  test
105  0 0
106  file-1
107
108  Commit 1 (no-eol)
109
110Specifying revisions by changeset ID
111  $ hg log -T '{node}\n'
112  c6ad58c44207b6ff8a4fbbca7045a5edaa7e908b
113  d654274993d0149eecc3cc03214f598320211900
114  f646af7e96481d3a5470b695cf30ad8e3ab6c575
115  cf8b83f14ead62b374b6e91a0e9303b85dfd9ed7
116  91c6f6e73e39318534dc415ea4e8a09c99cd74d6
117  6ae9681c6d30389694d8701faf24b583cf3ccafe
118  $ $NO_FALLBACK rhg files -r cf8b83
119  file-1
120  file-2
121  file-3
122  $ $NO_FALLBACK rhg cat -r cf8b83 file-2
123  2
124  $ $NO_FALLBACK rhg cat --rev cf8b83 file-2
125  2
126  $ $NO_FALLBACK rhg cat -r c file-2
127  abort: ambiguous revision identifier: c
128  [255]
129  $ $NO_FALLBACK rhg cat -r d file-2
130  2
131  $ $NO_FALLBACK rhg cat -r 0000 file-2
132  file-2: no such file in rev 000000000000
133  [1]
134
135Cat files
136  $ cd $TESTTMP
137  $ rm -rf repository
138  $ hg init repository
139  $ cd repository
140  $ echo "original content" > original
141  $ hg add original
142  $ hg commit -m "add original" original
143Without `--rev`
144  $ $NO_FALLBACK rhg cat original
145  original content
146With `--rev`
147  $ $NO_FALLBACK rhg cat -r 0 original
148  original content
149Cat copied file should not display copy metadata
150  $ hg copy original copy_of_original
151  $ hg commit -m "add copy of original"
152  $ $NO_FALLBACK rhg cat original
153  original content
154  $ $NO_FALLBACK rhg cat -r 1 copy_of_original
155  original content
156
157
158Fallback to Python
159  $ $NO_FALLBACK rhg cat original --exclude="*.rs"
160  unsupported feature: error: Found argument '--exclude' which wasn't expected, or isn't valid in this context
161
162  USAGE:
163      rhg cat [OPTIONS] <FILE>...
164
165  For more information try --help
166
167  [252]
168  $ rhg cat original --exclude="*.rs"
169  original content
170
171  $ FALLBACK_EXE="$RHG_FALLBACK_EXECUTABLE"
172  $ unset RHG_FALLBACK_EXECUTABLE
173  $ rhg cat original --exclude="*.rs"
174  abort: 'rhg.on-unsupported=fallback' without 'rhg.fallback-executable' set.
175  [255]
176  $ RHG_FALLBACK_EXECUTABLE="$FALLBACK_EXE"
177  $ export RHG_FALLBACK_EXECUTABLE
178
179  $ rhg cat original --exclude="*.rs" --config rhg.fallback-executable=false
180  [1]
181
182  $ rhg cat original --exclude="*.rs" --config rhg.fallback-executable=hg-non-existent
183  tried to fall back to a 'hg-non-existent' sub-process but got error $ENOENT$
184  unsupported feature: error: Found argument '--exclude' which wasn't expected, or isn't valid in this context
185
186  USAGE:
187      rhg cat [OPTIONS] <FILE>...
188
189  For more information try --help
190
191  [252]
192
193  $ rhg cat original --exclude="*.rs" --config rhg.fallback-executable=rhg
194  Blocking recursive fallback. The 'rhg.fallback-executable = rhg' config points to `rhg` itself.
195  unsupported feature: error: Found argument '--exclude' which wasn't expected, or isn't valid in this context
196
197  USAGE:
198      rhg cat [OPTIONS] <FILE>...
199
200  For more information try --help
201
202  [252]
203
204Fallback with shell path segments
205  $ $NO_FALLBACK rhg cat .
206  unsupported feature: `..` or `.` path segment
207  [252]
208  $ $NO_FALLBACK rhg cat ..
209  unsupported feature: `..` or `.` path segment
210  [252]
211  $ $NO_FALLBACK rhg cat ../..
212  unsupported feature: `..` or `.` path segment
213  [252]
214
215Fallback with filesets
216  $ $NO_FALLBACK rhg cat "set:c or b"
217  unsupported feature: fileset
218  [252]
219
220Fallback with generic hooks
221  $ $NO_FALLBACK rhg cat original --config hooks.pre-cat=something
222  unsupported feature: pre-cat hook defined
223  [252]
224
225  $ $NO_FALLBACK rhg cat original --config hooks.post-cat=something
226  unsupported feature: post-cat hook defined
227  [252]
228
229  $ $NO_FALLBACK rhg cat original --config hooks.fail-cat=something
230  unsupported feature: fail-cat hook defined
231  [252]
232
233Fallback with [defaults]
234  $ $NO_FALLBACK rhg cat original --config "defaults.cat=-r null"
235  unsupported feature: `defaults` config set
236  [252]
237
238
239Requirements
240  $ $NO_FALLBACK rhg debugrequirements
241  dotencode
242  fncache
243  generaldelta
244  persistent-nodemap
245  revlog-compression-zstd (zstd !)
246  revlogv1
247  sparserevlog
248  store
249
250  $ echo indoor-pool >> .hg/requires
251  $ $NO_FALLBACK rhg files
252  unsupported feature: repository requires feature unknown to this Mercurial: indoor-pool
253  [252]
254
255  $ $NO_FALLBACK rhg cat -r 1 copy_of_original
256  unsupported feature: repository requires feature unknown to this Mercurial: indoor-pool
257  [252]
258
259  $ $NO_FALLBACK rhg debugrequirements
260  unsupported feature: repository requires feature unknown to this Mercurial: indoor-pool
261  [252]
262
263  $ echo -e '\xFF' >> .hg/requires
264  $ $NO_FALLBACK rhg debugrequirements
265  abort: parse error in 'requires' file
266  [255]
267
268Persistent nodemap
269  $ cd $TESTTMP
270  $ rm -rf repository
271  $ hg --config format.use-persistent-nodemap=no init repository
272  $ cd repository
273  $ $NO_FALLBACK rhg debugrequirements | grep nodemap
274  [1]
275  $ hg debugbuilddag .+5000 --overwritten-file --config "storage.revlog.nodemap.mode=warn"
276  $ hg id -r tip
277  c3ae8dec9fad tip
278  $ ls .hg/store/00changelog*
279  .hg/store/00changelog.d
280  .hg/store/00changelog.i
281  $ $NO_FALLBACK rhg files -r c3ae8dec9fad
282  of
283
284  $ cd $TESTTMP
285  $ rm -rf repository
286  $ hg --config format.use-persistent-nodemap=True init repository
287  $ cd repository
288  $ $NO_FALLBACK rhg debugrequirements | grep nodemap
289  persistent-nodemap
290  $ hg debugbuilddag .+5000 --overwritten-file --config "storage.revlog.nodemap.mode=warn"
291  $ hg id -r tip
292  c3ae8dec9fad tip
293  $ ls .hg/store/00changelog*
294  .hg/store/00changelog-*.nd (glob)
295  .hg/store/00changelog.d
296  .hg/store/00changelog.i
297  .hg/store/00changelog.n
298
299Specifying revisions by changeset ID
300  $ $NO_FALLBACK rhg files -r c3ae8dec9fad
301  of
302  $ $NO_FALLBACK rhg cat -r c3ae8dec9fad of
303  r5000
304
305Crate a shared repository
306
307  $ echo "[extensions]"      >> $HGRCPATH
308  $ echo "share = "          >> $HGRCPATH
309
310  $ cd $TESTTMP
311  $ hg init repo1
312  $ echo a > repo1/a
313  $ hg -R repo1 commit -A -m'init'
314  adding a
315
316  $ hg share repo1 repo2
317  updating working directory
318  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
319
320And check that basic rhg commands work with sharing
321
322  $ $NO_FALLBACK rhg files -R repo2
323  repo2/a
324  $ $NO_FALLBACK rhg -R repo2 cat -r 0 repo2/a
325  a
326
327Same with relative sharing
328
329  $ hg share repo2 repo3 --relative
330  updating working directory
331  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
332
333  $ $NO_FALLBACK rhg files -R repo3
334  repo3/a
335  $ $NO_FALLBACK rhg -R repo3 cat -r 0 repo3/a
336  a
337
338Same with share-safe
339
340  $ echo "[format]"         >> $HGRCPATH
341  $ echo "use-share-safe = True" >> $HGRCPATH
342
343  $ cd $TESTTMP
344  $ hg init repo4
345  $ cd repo4
346  $ echo a > a
347  $ hg commit -A -m'init'
348  adding a
349
350  $ cd ..
351  $ hg share repo4 repo5
352  updating working directory
353  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
354
355And check that basic rhg commands work with sharing
356
357  $ cd repo5
358  $ $NO_FALLBACK rhg files
359  a
360  $ $NO_FALLBACK rhg cat -r 0 a
361  a
362
363The blackbox extension is supported
364
365  $ echo "[extensions]" >> $HGRCPATH
366  $ echo "blackbox =" >> $HGRCPATH
367  $ echo "[blackbox]" >> $HGRCPATH
368  $ echo "maxsize = 1" >> $HGRCPATH
369  $ $NO_FALLBACK rhg files > /dev/null
370  $ cat .hg/blackbox.log
371  ????/??/?? ??:??:??.??? * @d3873e73d99ef67873dac33fbcc66268d5d2b6f4 (*)> (rust) files exited 0 after 0.??? seconds (glob)
372  $ cat .hg/blackbox.log.1
373  ????/??/?? ??:??:??.??? * @d3873e73d99ef67873dac33fbcc66268d5d2b6f4 (*)> (rust) files (glob)
374
375Subrepos are not supported
376
377  $ touch .hgsub
378  $ $NO_FALLBACK rhg files
379  unsupported feature: subrepos (.hgsub is present)
380  [252]
381  $ rhg files
382  a
383  $ rm .hgsub
384