1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418
|
#!/bin/sh
cat <<EOF >> $HGRCPATH
[extensions]
keyword =
mq =
notify =
record =
transplant =
[ui]
interactive = true
EOF
# demo before [keyword] files are set up
# would succeed without uisetup otherwise
echo % hg kwdemo
hg --quiet kwdemo \
| sed -e 's![^ ][^ ]*demo.txt,v!/TMP/demo.txt,v!' \
-e 's/,v [a-z0-9][a-z0-9]* /,v xxxxxxxxxxxx /' \
-e '/[$]Revision/ s/: [a-z0-9][a-z0-9]* /: xxxxxxxxxxxx /' \
-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!'
hg --quiet kwdemo "Branch = {branches}"
cat <<EOF >> $HGRCPATH
[keyword]
** =
b = ignore
[hooks]
commit=
commit.test=cp a hooktest
EOF
hg init Test-bndl
cd Test-bndl
echo % kwshrink should exit silently in empty/invalid repo
hg kwshrink
# Symlinks cannot be created on Windows. The bundle was made with:
#
# hg init t
# cd t
# echo a > a
# ln -s a sym
# hg add sym
# hg ci -m addsym -u mercurial
# hg bundle --base null ../test-keyword.hg
#
hg pull -u "$TESTDIR/test-keyword.hg" \
| sed 's/pulling from.*test-keyword.hg/pulling from test-keyword.hg/'
echo 'expand $Id$' > a
echo 'do not process $Id:' >> a
echo 'xxx $' >> a
echo 'ignore $Id$' > b
echo % cat
cat a b
echo % no kwfiles
hg kwfiles
echo % untracked candidates
hg -v kwfiles --unknown
echo % addremove
hg addremove
echo % status
hg status
echo % default keyword expansion including commit hook
echo % interrupted commit should not change state or run commit hook
hg --debug commit
echo % status
hg status
echo % commit
hg --debug commit -mabsym -u 'User Name <user@example.com>'
echo % status
hg status
echo % identify
hg debugrebuildstate
hg --quiet identify
echo % cat
cat a b
echo % hg cat
hg cat sym a b
echo
echo % diff a hooktest
diff a hooktest
echo % removing commit hook from config
sed -e '/\[hooks\]/,$ d' "$HGRCPATH" > $HGRCPATH.nohook
mv "$HGRCPATH".nohook "$HGRCPATH"
rm hooktest
echo % bundle
hg bundle --base null ../kw.hg
cd ..
hg init Test
cd Test
echo % notify on pull to check whether keywords stay as is in email
echo % ie. if patch.diff wrapper acts as it should
cat <<EOF >> $HGRCPATH
[hooks]
incoming.notify = python:hgext.notify.hook
[notify]
sources = pull
diffstat = False
[reposubs]
* = Test
EOF
echo % pull from bundle
hg pull -u ../kw.hg 2>&1 | sed -e '/^Content-Type:/,/^diffs (/ d'
echo % remove notify config
sed -e '/\[hooks\]/,$ d' "$HGRCPATH" > $HGRCPATH.nonotify
mv "$HGRCPATH".nonotify "$HGRCPATH"
echo % touch
touch a b
echo % status
hg status
rm sym a b
echo % update
hg update -C
echo % cat
cat a b
echo % check whether expansion is filewise
echo '$Id$' > c
echo 'tests for different changenodes' >> c
echo % commit c
hg commit -A -mcndiff -d '1 0' -u 'User Name <user@example.com>'
echo % force expansion
hg -v kwexpand
echo % compare changenodes in a c
cat a c
echo % record chunk
python -c \
'l=open("a").readlines();l.insert(1,"foo\n");l.append("bar\n");open("a","w").writelines(l);'
hg record -d '1 10' -m rectest<<EOF
y
y
n
EOF
echo
hg identify
hg status
echo % cat modified file
cat a
hg diff | grep -v 'b/a'
hg rollback
echo % record file
echo foo > msg
# do not use "hg record -m" here!
hg record -l msg -d '1 11'<<EOF
y
y
y
EOF
echo % a should be clean
hg status -A a
rm msg
hg rollback
hg update -C
echo % init --mq
hg init --mq
echo % qimport
hg qimport -r tip -n mqtest.diff
echo % commit --mq
hg commit --mq -m mqtest
echo % keywords should not be expanded in patch
cat .hg/patches/mqtest.diff
echo % qpop
hg qpop
echo % qgoto - should imply qpush
hg qgoto mqtest.diff
echo % cat
cat c
echo % hg cat
hg cat c
echo % keyword should not be expanded in filelog
hg --config 'extensions.keyword=!' cat c
echo % qpop and move on
hg qpop
echo % copy
hg cp a c
echo % kwfiles added
hg kwfiles
echo % commit
hg --debug commit -ma2c -d '1 0' -u 'User Name <user@example.com>'
echo % cat a c
cat a c
echo % touch copied c
touch c
echo % status
hg status
echo % kwfiles
hg kwfiles
echo % ignored files
hg -v kwfiles --ignore
echo % all files
hg kwfiles --all
echo % diff --rev
hg diff --rev 1 | grep -v 'b/c'
echo % rollback
hg rollback
echo % status
hg status
echo % update -C
hg update --clean
echo % custom keyword expansion
echo % try with kwdemo
hg --quiet kwdemo "Xinfo = {author}: {desc}"
cat <<EOF >>$HGRCPATH
[keywordmaps]
Id = {file} {node|short} {date|rfc822date} {author|user}
Xinfo = {author}: {desc}
EOF
echo % cat
cat a b
echo % hg cat
hg cat sym a b
echo
echo '$Xinfo$' >> a
cat <<EOF >> log
firstline
secondline
EOF
echo % interrupted commit should not change state
hg commit
echo % status
hg status
echo % commit
hg --debug commit -l log -d '2 0' -u 'User Name <user@example.com>'
rm log
echo % status
hg status
echo % verify
hg verify
echo % cat
cat a b
echo % hg cat
hg cat sym a b
echo
echo % annotate
hg annotate a
echo % remove
hg debugrebuildstate
hg remove a
hg --debug commit -m rma
echo % status
hg status
echo % rollback
hg rollback
echo % status
hg status
echo % revert a
hg revert --no-backup --rev tip a
echo % cat a
cat a
echo % clone
cd ..
echo % expansion in dest
hg --quiet clone Test globalconf
cat globalconf/a
echo % no expansion in dest
hg --quiet --config 'keyword.**=ignore' clone Test localconf
cat localconf/a
echo % clone to test incoming
hg clone -r1 Test Test-a
cd Test-a
cat <<EOF >> .hg/hgrc
[paths]
default = ../Test
EOF
echo % incoming
# remove path to temp dir
hg incoming | sed -e 's/^\(comparing with \).*\(test-keyword.*\)/\1\2/'
sed -e 's/Id.*/& rejecttest/' a > a.new
mv a.new a
echo % commit rejecttest
hg --debug commit -m'rejects?' -d '3 0' -u 'User Name <user@example.com>'
echo % export
hg export -o ../rejecttest.diff tip
cd ../Test
echo % import
hg import ../rejecttest.diff
echo % cat
cat a b
echo
echo % rollback
hg rollback
echo % clean update
hg update --clean
echo % kwexpand/kwshrink on selected files
mkdir x
echo % copy a x/a
hg copy a x/a
echo % kwexpand a
hg --verbose kwexpand a
echo % kwexpand x/a should abort
hg --verbose kwexpand x/a
cd x
hg --debug commit -m xa -d '3 0' -u 'User Name <user@example.com>'
echo % cat a
cat a
echo % kwshrink a inside directory x
hg --verbose kwshrink a
echo % cat a
cat a
cd ..
echo % kwexpand nonexistent
hg kwexpand nonexistent 2>&1 | sed 's/nonexistent:.*/nonexistent:/'
echo % hg serve
hg serve -p $HGPORT -d --pid-file=hg.pid -A access.log -E errors.log
cat hg.pid >> $DAEMON_PIDS
echo % expansion
echo % hgweb file
("$TESTDIR/get-with-headers.py" localhost:$HGPORT '/file/tip/a/?style=raw')
echo % no expansion
echo % hgweb annotate
("$TESTDIR/get-with-headers.py" localhost:$HGPORT '/annotate/tip/a/?style=raw')
echo % hgweb changeset
("$TESTDIR/get-with-headers.py" localhost:$HGPORT '/rev/tip/?style=raw')
echo % hgweb filediff
("$TESTDIR/get-with-headers.py" localhost:$HGPORT '/diff/bb948857c743/a?style=raw')
echo % errors encountered
cat errors.log
echo % merge/resolve
echo '$Id$' > m
hg add m
hg commit -m 4kw
echo foo >> m
hg commit -m 5foo
echo % simplemerge
hg update 4
echo foo >> m
hg commit -m 6foo
hg merge
hg commit -m simplemerge
cat m
echo % conflict
hg update 4
echo bar >> m
hg commit -m 8bar
hg merge
echo % keyword stays outside conflict zone
cat m
echo % resolve to local
HGMERGE=internal:local hg resolve -a
hg commit -m localresolve
cat m
echo % test restricted mode with transplant -b
hg update 6
hg branch foo
mv a a.bak
echo foobranch > a
cat a.bak >> a
rm a.bak
hg commit -m 9foobranch
hg update default
hg -y transplant -b foo tip
echo % no expansion in changeset
hg tip -p
echo % expansion in file
head -n 2 a
hg -q rollback
hg -q update -C
echo % switch off expansion
echo % kwshrink with unknown file u
cp a u
hg --verbose kwshrink
echo % cat
cat a b
echo % hg cat
hg cat sym a b
echo
rm "$HGRCPATH"
echo % cat
cat a b
echo % hg cat
hg cat sym a b
echo
|