Debian Codegraph @

tests/test-identify.t

raw
1 #require serve
2
3 #if no-outer-repo
4
5 no repo
6
7 $ hg id
8 abort: there is no Mercurial repository here (.hg not found)
9 [10]
10
11 #endif
12
13 create repo
14
15 $ hg init test
16 $ cd test
17 $ echo a > a
18 $ hg ci -Ama
19 adding a
20
21 basic id usage
22
23 $ hg id
24 cb9a9f314b8b tip
25 $ hg id --debug
26 cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b tip
27 $ hg id -q
28 cb9a9f314b8b
29 $ hg id -v
30 cb9a9f314b8b tip
31
32 with options
33
34 $ hg id -r.
35 cb9a9f314b8b tip
36 $ hg id -n
37 0
38 $ hg id -t
39 tip
40 $ hg id -b
41 default
42 $ hg id -i
43 cb9a9f314b8b
44 $ hg id -n -t -b -i
45 cb9a9f314b8b 0 default tip
46 $ hg id -Tjson
47 [
48 {
49 "bookmarks": [],
50 "branch": "default",
51 "dirty": "",
52 "id": "cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b",
53 "node": "ffffffffffffffffffffffffffffffffffffffff",
54 "parents": ["cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b"],
55 "tags": ["tip"]
56 }
57 ]
58
59 test template keywords and functions which require changectx:
60
61 $ hg id -T '{rev} {node|shortest}\n'
62 2147483647 ffff
63 $ hg id -T '{parents % "{rev} {node|shortest} {desc}\n"}'
64 0 cb9a a
65 $ hg id -T '{parents}\n'
66 cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b
67
68 test nested template: '{tags}'/'{node}' constants shouldn't override the
69 default keywords, but '{id}' persists because there's no default keyword
70 for '{id}' (issue5612)
71
72 $ hg id -T '{tags}\n'
73 tip
74 $ hg id -T '{revset("null:.") % "{rev}:{node|short} {tags} {id|short}\n"}'
75 -1:000000000000 cb9a9f314b8b
76 0:cb9a9f314b8b tip cb9a9f314b8b
77
78 with modifications
79
80 $ echo b > a
81 $ hg id -n -t -b -i
82 cb9a9f314b8b+ 0+ default tip
83 $ hg id -Tjson
84 [
85 {
86 "bookmarks": [],
87 "branch": "default",
88 "dirty": "+",
89 "id": "cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b+",
90 "node": "ffffffffffffffffffffffffffffffffffffffff",
91 "parents": ["cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b"],
92 "tags": ["tip"]
93 }
94 ]
95
96 other local repo
97
98 $ cd ..
99 $ hg -R test id
100 cb9a9f314b8b+ tip
101 #if no-outer-repo
102 $ hg id test
103 cb9a9f314b8b+ tip
104 #endif
105
106 with remote http repo
107
108 $ cd test
109 $ hg serve -p $HGPORT1 -d --pid-file=hg.pid
110 $ cat hg.pid >> $DAEMON_PIDS
111 $ hg id http://localhost:$HGPORT1/
112 cb9a9f314b8b
113
114 remote with rev number?
115
116 $ hg id -n http://localhost:$HGPORT1/
117 abort: can't query remote revision number, branch, or tags
118 [10]
119
120 remote with tags?
121
122 $ hg id -t http://localhost:$HGPORT1/
123 abort: can't query remote revision number, branch, or tags
124 [10]
125
126 remote with branch?
127
128 $ hg id -b http://localhost:$HGPORT1/
129 abort: can't query remote revision number, branch, or tags
130 [10]
131
132 test bookmark support
133
134 $ hg bookmark Y
135 $ hg bookmark Z
136 $ hg bookmarks
137 Y 0:cb9a9f314b8b
138 * Z 0:cb9a9f314b8b
139 $ hg id
140 cb9a9f314b8b+ tip Y/Z
141 $ hg id --bookmarks
142 Y Z
143
144 test remote identify with bookmarks
145
146 $ hg id http://localhost:$HGPORT1/
147 cb9a9f314b8b Y/Z
148 $ hg id --bookmarks http://localhost:$HGPORT1/
149 Y Z
150 $ hg id -r . http://localhost:$HGPORT1/
151 cb9a9f314b8b Y/Z
152 $ hg id --bookmarks -r . http://localhost:$HGPORT1/
153 Y Z
154
155 test invalid lookup
156
157 $ hg id -r noNoNO http://localhost:$HGPORT1/
158 abort: unknown revision 'noNoNO'
159 [255]
160
161 Make sure we do not obscure unknown requires file entries (issue2649)
162
163 $ echo fake >> .hg/requires
164 $ hg id
165 abort: repository requires features unknown to this Mercurial: fake
166 (see https://mercurial-scm.org/wiki/MissingRequirement for more information)
167 [255]
168
169 $ cd ..
170 #if no-outer-repo
171 $ hg id test
172 abort: repository requires features unknown to this Mercurial: fake
173 (see https://mercurial-scm.org/wiki/MissingRequirement for more information)
174 [255]
175 #endif