| 1 |
$ cat >> $HGRCPATH << EOF |
| 2 |
> [extensions] |
| 3 |
> show = |
| 4 |
> EOF |
| 5 |
|
| 6 |
No arguments shows available views |
| 7 |
|
| 8 |
$ hg init empty |
| 9 |
$ cd empty |
| 10 |
$ hg show |
| 11 |
available views: |
| 12 |
|
| 13 |
bookmarks -- bookmarks and their associated changeset |
| 14 |
stack -- current line of work |
| 15 |
work -- changesets that aren't finished |
| 16 |
|
| 17 |
abort: no view requested |
| 18 |
(use "hg show VIEW" to choose a view) |
| 19 |
[255] |
| 20 |
|
| 21 |
`hg help show` prints available views |
| 22 |
|
| 23 |
$ hg help show |
| 24 |
hg show VIEW |
| 25 |
|
| 26 |
show various repository information |
| 27 |
|
| 28 |
A requested view of repository data is displayed. |
| 29 |
|
| 30 |
If no view is requested, the list of available views is shown and the command |
| 31 |
aborts. |
| 32 |
|
| 33 |
Note: |
| 34 |
There are no backwards compatibility guarantees for the output of this |
| 35 |
command. Output may change in any future Mercurial release. |
| 36 |
|
| 37 |
Consumers wanting stable command output should specify a template via |
| 38 |
"-T/--template". |
| 39 |
|
| 40 |
List of available views: |
| 41 |
|
| 42 |
bookmarks bookmarks and their associated changeset |
| 43 |
|
| 44 |
stack current line of work |
| 45 |
|
| 46 |
work changesets that aren't finished |
| 47 |
|
| 48 |
(use 'hg help -e show' to show help for the show extension) |
| 49 |
|
| 50 |
options: |
| 51 |
|
| 52 |
-T --template TEMPLATE display with template |
| 53 |
|
| 54 |
(some details hidden, use --verbose to show complete help) |
| 55 |
|
| 56 |
Unknown view prints error |
| 57 |
|
| 58 |
$ hg show badview |
| 59 |
abort: unknown view: badview |
| 60 |
(run "hg show" to see available views) |
| 61 |
[255] |
| 62 |
|
| 63 |
HGPLAIN results in abort |
| 64 |
|
| 65 |
$ HGPLAIN=1 hg show bookmarks |
| 66 |
abort: must specify a template in plain mode |
| 67 |
(invoke with -T/--template to control output format) |
| 68 |
[255] |
| 69 |
|
| 70 |
But not if a template is specified |
| 71 |
|
| 72 |
$ HGPLAIN=1 hg show bookmarks -T '{bookmark}\n' |
| 73 |
(no bookmarks set) |
| 74 |
|
| 75 |
$ cd .. |
| 76 |
|
| 77 |
bookmarks view with no bookmarks prints empty message |
| 78 |
|
| 79 |
$ hg init books |
| 80 |
$ cd books |
| 81 |
$ touch f0 |
| 82 |
$ hg -q commit -A -m initial |
| 83 |
|
| 84 |
$ hg show bookmarks |
| 85 |
(no bookmarks set) |
| 86 |
|
| 87 |
bookmarks view shows bookmarks in an aligned table |
| 88 |
|
| 89 |
$ echo book1 > f0 |
| 90 |
$ hg commit -m 'commit for book1' |
| 91 |
$ echo book2 > f0 |
| 92 |
$ hg commit -m 'commit for book2' |
| 93 |
|
| 94 |
$ hg bookmark -r 1 book1 |
| 95 |
$ hg bookmark a-longer-bookmark |
| 96 |
|
| 97 |
$ hg show bookmarks |
| 98 |
* a-longer-bookmark 7b57 |
| 99 |
book1 b757 |
| 100 |
|
| 101 |
A custom bookmarks template works |
| 102 |
|
| 103 |
$ hg show bookmarks -T '{node} {bookmark} {active}\n' |
| 104 |
7b5709ab64cbc34da9b4367b64afff47f2c4ee83 a-longer-bookmark True |
| 105 |
b757f780b8ffd71267c6ccb32e0882d9d32a8cc0 book1 False |
| 106 |
|
| 107 |
bookmarks JSON works |
| 108 |
|
| 109 |
$ hg show bookmarks -T json |
| 110 |
[ |
| 111 |
{ |
| 112 |
"active": true, |
| 113 |
"bookmark": "a-longer-bookmark", |
| 114 |
"longestbookmarklen": 17, |
| 115 |
"node": "7b5709ab64cbc34da9b4367b64afff47f2c4ee83", |
| 116 |
"nodelen": 4 |
| 117 |
}, |
| 118 |
{ |
| 119 |
"active": false, |
| 120 |
"bookmark": "book1", |
| 121 |
"longestbookmarklen": 17, |
| 122 |
"node": "b757f780b8ffd71267c6ccb32e0882d9d32a8cc0", |
| 123 |
"nodelen": 4 |
| 124 |
} |
| 125 |
] |
| 126 |
|
| 127 |
JSON works with no bookmarks |
| 128 |
|
| 129 |
$ hg book -d a-longer-bookmark |
| 130 |
$ hg book -d book1 |
| 131 |
$ hg show bookmarks -T json |
| 132 |
[ |
| 133 |
] |
| 134 |
|
| 135 |
commands.show.aliasprefix aliases values to `show <view>` |
| 136 |
|
| 137 |
$ hg --config commands.show.aliasprefix=s sbookmarks |
| 138 |
(no bookmarks set) |
| 139 |
|
| 140 |
$ hg --config commands.show.aliasprefix=sh shwork |
| 141 |
@ 7b57 commit for book2 |
| 142 |
o b757 commit for book1 |
| 143 |
o ba59 initial |
| 144 |
|
| 145 |
$ hg --config commands.show.aliasprefix='s sh' swork |
| 146 |
@ 7b57 commit for book2 |
| 147 |
o b757 commit for book1 |
| 148 |
o ba59 initial |
| 149 |
|
| 150 |
$ hg --config commands.show.aliasprefix='s sh' shwork |
| 151 |
@ 7b57 commit for book2 |
| 152 |
o b757 commit for book1 |
| 153 |
o ba59 initial |
| 154 |
|
| 155 |
The aliases don't appear in `hg config` |
| 156 |
|
| 157 |
$ hg --config commands.show.aliasprefix=s config alias |
| 158 |
[1] |
| 159 |
|
| 160 |
Doesn't overwrite existing alias |
| 161 |
|
| 162 |
$ hg --config alias.swork='log -r .' --config commands.show.aliasprefix=s swork |
| 163 |
changeset: 2:7b5709ab64cb |
| 164 |
tag: tip |
| 165 |
user: test |
| 166 |
date: Thu Jan 01 00:00:00 1970 +0000 |
| 167 |
summary: commit for book2 |
| 168 |
|
| 169 |
|
| 170 |
$ hg --config alias.swork='log -r .' --config commands.show.aliasprefix=s config alias |
| 171 |
alias.swork=log -r . |
| 172 |
|
| 173 |
$ cd .. |