|
1 #!/bin/sh |
|
2 |
|
3 cat <<EOF >> $HGRCPATH |
|
4 [extensions] |
|
5 hgext.keyword = |
|
6 [keyword] |
|
7 * = |
|
8 b = ignore |
|
9 [hooks] |
|
10 commit= |
|
11 commit.test=cp a hooktest |
|
12 EOF |
|
13 |
|
14 echo % help |
|
15 hg help keyword |
|
16 |
|
17 echo % hg kwdemo |
|
18 hg --quiet kwdemo --default \ |
|
19 | sed -e 's![^ ][^ ]*demo.txt,v!/TMP/demo.txt,v!' \ |
|
20 -e 's/,v [a-z0-9][a-z0-9]* /,v xxxxxxxxxxxx /' \ |
|
21 -e '/[$]Revision/ s/: [a-z0-9][a-z0-9]* /: xxxxxxxxxxxx /' \ |
|
22 -e 's! 20[0-9][0-9]/[01][0-9]/[0-3][0-9] [0-2][0-9]:[0-6][0-9]:[0-6][0-9]! 2000/00/00 00:00:00!' |
|
23 |
|
24 hg --quiet kwdemo "Branch = {branches}" |
|
25 |
|
26 hg init Test |
|
27 cd Test |
|
28 |
|
29 echo % kwshrink should exit silently in empty/invalid repo |
|
30 hg kwshrink |
|
31 |
|
32 echo 'expand $Id$' > a |
|
33 echo 'do not process $Id:' >> a |
|
34 echo 'xxx $' >> a |
|
35 echo 'ignore $Id$' > b |
|
36 ln -s a sym |
|
37 echo % cat |
|
38 cat sym a b |
|
39 |
|
40 echo % addremove |
|
41 hg addremove |
|
42 echo % status |
|
43 hg status |
|
44 |
|
45 echo % default keyword expansion including commit hook |
|
46 echo % interrupted commit should not change state or run commit hook |
|
47 HGEDITOR=false hg --debug commit |
|
48 echo % status |
|
49 hg status |
|
50 |
|
51 echo % commit |
|
52 hg --debug commit -mabsym -d '0 0' -u 'User Name <user@example.com>' |
|
53 echo % status |
|
54 hg status |
|
55 echo % identify |
|
56 hg --quiet identify |
|
57 echo % cat |
|
58 cat sym a b |
|
59 echo % hg cat |
|
60 hg cat sym a b |
|
61 |
|
62 echo |
|
63 echo % diff a hooktest |
|
64 diff a hooktest |
|
65 |
|
66 echo % removing commit hook from config |
|
67 sed -e '/\[hooks\]/,$ d' $HGRCPATH > $HGRCPATH.nohook |
|
68 mv $HGRCPATH.nohook $HGRCPATH |
|
69 rm hooktest |
|
70 |
|
71 echo % touch |
|
72 touch a b |
|
73 echo % status |
|
74 hg status |
|
75 |
|
76 rm sym a b |
|
77 echo % update |
|
78 hg update |
|
79 echo % cat |
|
80 cat sym a b |
|
81 |
|
82 echo % copy |
|
83 hg cp a c |
|
84 |
|
85 echo % kwfiles added |
|
86 hg kwfiles |
|
87 |
|
88 echo % commit |
|
89 hg --debug commit -ma2c -d '1 0' -u 'User Name <user@example.com>' |
|
90 echo % cat a c |
|
91 cat a c |
|
92 echo % touch copied c after 1 second |
|
93 sleep 1 |
|
94 touch c |
|
95 echo % status |
|
96 hg status |
|
97 |
|
98 echo % kwfiles |
|
99 hg kwfiles |
|
100 |
|
101 echo % diff --rev |
|
102 hg diff --rev 0 | grep -v 'b/c' |
|
103 |
|
104 echo % rollback |
|
105 hg rollback |
|
106 echo % status |
|
107 hg status |
|
108 echo % update -C |
|
109 hg update --clean |
|
110 |
|
111 echo % custom keyword expansion |
|
112 echo % try with kwdemo |
|
113 hg --quiet kwdemo "Xinfo = {author}: {desc}" |
|
114 |
|
115 cat <<EOF >>$HGRCPATH |
|
116 [keywordmaps] |
|
117 Id = {file} {node|short} {date|rfc822date} {author|user} |
|
118 Xinfo = {author}: {desc} |
|
119 EOF |
|
120 |
|
121 echo % cat |
|
122 cat sym a b |
|
123 echo % hg cat |
|
124 hg cat sym a b |
|
125 |
|
126 echo |
|
127 echo '$Xinfo$' >> a |
|
128 cat <<EOF >> log |
|
129 firstline |
|
130 secondline |
|
131 EOF |
|
132 |
|
133 echo % interrupted commit should not change state |
|
134 HGEDITOR=false hg commit |
|
135 echo % status |
|
136 hg status |
|
137 |
|
138 echo % commit |
|
139 hg --debug commit -l log -d '2 0' -u 'User Name <user@example.com>' |
|
140 rm log |
|
141 echo % status |
|
142 hg status |
|
143 |
|
144 echo % cat |
|
145 cat sym a b |
|
146 echo % hg cat |
|
147 hg cat sym a b |
|
148 echo |
|
149 |
|
150 echo % remove |
|
151 hg remove a |
|
152 hg --debug commit -m rma |
|
153 echo % status |
|
154 hg status |
|
155 echo % rollback |
|
156 hg rollback |
|
157 echo % status |
|
158 hg status |
|
159 echo % revert a |
|
160 hg revert --no-backup --rev tip a |
|
161 echo % cat a |
|
162 cat a |
|
163 |
|
164 echo % clone to test incoming |
|
165 cd .. |
|
166 hg clone -r0 Test Test-a |
|
167 cd Test-a |
|
168 cat <<EOF >> .hg/hgrc |
|
169 [paths] |
|
170 default = ../Test |
|
171 EOF |
|
172 echo % incoming |
|
173 # remove path to temp dir |
|
174 hg incoming | sed -e 's/^\(comparing with \).*\(test-keyword.*\)/\1\2/' |
|
175 |
|
176 sed -i.bak -e 's/Id.*/& rejecttest/' a |
|
177 rm a.bak |
|
178 echo % commit rejecttest |
|
179 hg --debug commit -m'rejects?' -d '3 0' -u 'User Name <user@example.com>' |
|
180 echo % export |
|
181 hg export -o ../rejecttest.diff tip |
|
182 |
|
183 cd ../Test |
|
184 echo % import |
|
185 hg import ../rejecttest.diff |
|
186 echo % cat |
|
187 cat sym a b |
|
188 echo |
|
189 echo % rollback |
|
190 hg rollback |
|
191 echo % clean update |
|
192 hg update --clean |
|
193 |
|
194 echo % kwexpand/kwshrink on selected files |
|
195 mkdir x |
|
196 echo % copy a x/a |
|
197 hg copy a x/a |
|
198 echo % kwexpand a |
|
199 hg --verbose kwexpand a |
|
200 echo % kwexpand x/a should abort |
|
201 hg --verbose kwexpand x/a |
|
202 cd x |
|
203 hg --debug commit -m xa -d '3 0' -u 'User Name <user@example.com>' |
|
204 echo % cat a |
|
205 cat a |
|
206 echo % kwshrink a inside directory x |
|
207 hg --verbose kwshrink a |
|
208 echo % cat a |
|
209 cat a |
|
210 cd - > /dev/null 2>&1 |
|
211 |
|
212 echo % kwexpand nonexistent |
|
213 hg kwexpand nonexistent |
|
214 |
|
215 echo % switch off expansion |
|
216 echo % kwshrink with unknown file u |
|
217 cp a u |
|
218 hg --verbose kwshrink |
|
219 echo % cat |
|
220 cat sym a b |
|
221 echo % hg cat |
|
222 hg cat sym a b |
|
223 echo |
|
224 rm $HGRCPATH |
|
225 echo % cat |
|
226 cat sym a b |
|
227 echo % hg cat |
|
228 hg cat sym a b |
|
229 echo |