Newer
Older
kwshrink a inside directory x
$ hg --verbose kwshrink a
overwriting x/a shrinking keywords
$ cat a
expand $Id$
do not process $Id:
xxx $
$Xinfo$
$ cd ..
kwexpand nonexistent
$ hg kwexpand nonexistent
hg serve
- expand with hgweb file
- no expansion with hgweb annotate/changeset/filediff/comparison
- expand with hgweb file, again
- check errors
$ hg serve -p $HGPORT -d --pid-file=hg.pid -A access.log -E errors.log
$ cat hg.pid >> $DAEMON_PIDS
$ get-with-headers.py localhost:$HGPORT 'file/tip/a/?style=raw'
200 Script output follows
expand $Id: a bb948857c743 Thu, 01 Jan 1970 00:00:02 +0000 user $
do not process $Id:
xxx $
$Xinfo: User Name <user@example.com>: firstline $
$ get-with-headers.py localhost:$HGPORT 'annotate/tip/a/?style=raw'
200 Script output follows
user@1: expand $Id$
user@1: do not process $Id:
user@1: xxx $
user@2: $Xinfo$
$ get-with-headers.py localhost:$HGPORT 'rev/tip/?style=raw'
200 Script output follows
# HG changeset patch
# User User Name <user@example.com>
# Date 3 0
# Node ID b4560182a3f9a358179fd2d835c15e9da379c1e4
# Parent bb948857c743469b22bbf51f7ec8112279ca5d83
xa
diff -r bb948857c743 -r b4560182a3f9 x/a
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/x/a Thu Jan 01 00:00:03 1970 +0000
@@ -0,0 +1,4 @@
+expand $Id$
+do not process $Id:
+xxx $
+$Xinfo$
$ get-with-headers.py localhost:$HGPORT 'diff/bb948857c743/a?style=raw'
200 Script output follows
diff -r ef63ca68695b -r bb948857c743 a
--- a/a Thu Jan 01 00:00:00 1970 +0000
+++ b/a Thu Jan 01 00:00:02 1970 +0000
@@ -1,3 +1,4 @@
expand $Id$
do not process $Id:
xxx $
+$Xinfo$
$ get-with-headers.py localhost:$HGPORT 'comparison/bb948857c743/a' | grep '\$[a-zA-Z]'
<td class="source equal"><a href="#l1r1"> 1</a> expand $Id$</td>
<td class="source equal"><a href="#l1r1"> 1</a> expand $Id$</td>
<td class="source equal"><a href="#l2r2"> 2</a> do not process $Id:</td>
<td class="source equal"><a href="#l2r2"> 2</a> do not process $Id:</td>
<td class="source insert"><a href="#r4"> 4</a> $Xinfo$</td>
(check "kwweb_skip"-ed webcommand doesn't suppress expanding keywords
at subsequent webcommands)
$ get-with-headers.py localhost:$HGPORT 'file/tip/a/?style=raw'
200 Script output follows
expand $Id: a bb948857c743 Thu, 01 Jan 1970 00:00:02 +0000 user $
do not process $Id:
xxx $
$Xinfo: User Name <user@example.com>: firstline $

Katsunori FUJIWARA
committed
$ killdaemons.py
Prepare merge and resolve tests
$ echo '$Id$' > m
$ hg add m
$ hg commit -m 4kw
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
$ echo foo >> m
$ hg commit -m 5foo
simplemerge
$ hg update 4
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ echo foo >> m
$ hg commit -m 6foo
created new head
$ hg merge
0 files updated, 0 files merged, 0 files removed, 0 files unresolved
(branch merge, don't forget to commit)
$ hg commit -m simplemerge
$ cat m
$Id: m 27d48ee14f67 Thu, 01 Jan 1970 00:00:00 +0000 test $
foo
conflict: keyword should stay outside conflict zone
$ hg update 4
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ echo bar >> m
$ hg commit -m 8bar
created new head
$ hg merge
merging m
warning: conflicts while merging m! (edit, then use 'hg resolve --mark')
0 files updated, 0 files merged, 0 files removed, 1 files unresolved
use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon
<<<<<<< working copy: 88a80c8d172e - test: 8bar
>>>>>>> merge rev: 85d2d2d732a5 - test: simplemerge
resolve to local, m must contain hash of last change (local parent)
(no more unresolved files)
$ hg commit -m localresolve
$ cat m
$Id: m 88a80c8d172e Thu, 01 Jan 1970 00:00:00 +0000 test $
bar
Test restricted mode with transplant -b
$ hg update 6
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ hg branch foo
marked working directory as branch foo
(branches are permanent and global, did you want a bookmark?)
$ mv a a.bak
$ echo foobranch > a
$ cat a.bak >> a
$ rm a.bak
$ hg commit -m 9foobranch
$ hg update default
2 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ hg -y transplant -b foo tip
applying 4aa30d025d50
4aa30d025d50 transplanted to e00abbf63521
Expansion in changeset but not in file
$ hg tip -p
changeset: 11:e00abbf63521
parent: 9:800511b3a22d
user: test
date: Thu Jan 01 00:00:00 1970 +0000
summary: 9foobranch
diff -r 800511b3a22d -r e00abbf63521 a
--- a/a Thu Jan 01 00:00:00 1970 +0000
+++ b/a Thu Jan 01 00:00:00 1970 +0000
@@ -1,3 +1,4 @@
+foobranch
expand $Id$
do not process $Id:
xxx $
$ head -n 2 a
foobranch
expand $Id: a e00abbf63521 Thu, 01 Jan 1970 00:00:00 +0000 test $
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
$ hg -q rollback
$ hg -q update -C
kwshrink with unknown file u
$ cp a u
$ hg --verbose kwshrink
overwriting a shrinking keywords
overwriting m shrinking keywords
overwriting x/a shrinking keywords
Keywords shrunk in working directory, but not yet disabled
- cat shows unexpanded keywords
- hg cat shows expanded keywords
$ cat a b
expand $Id$
do not process $Id:
xxx $
$Xinfo$
ignore $Id$
$ hg cat sym a b && echo
expand $Id: a bb948857c743 Thu, 01 Jan 1970 00:00:02 +0000 user $
do not process $Id:
xxx $
$Xinfo: User Name <user@example.com>: firstline $
ignore $Id$
Now disable keyword expansion

Katsunori FUJIWARA
committed
$ cp $HGRCPATH $HGRCPATH.backup
$ rm "$HGRCPATH"
$ cat a b
expand $Id$
do not process $Id:
xxx $
$Xinfo$
ignore $Id$
$ hg cat sym a b && echo
expand $Id$
do not process $Id:
xxx $
$Xinfo$
ignore $Id$

Katsunori FUJIWARA
committed
enable keyword expansion again
$ cat $HGRCPATH.backup >> $HGRCPATH
Test restricted mode with unshelve
$ echo xxxx >> a
$ hg diff
diff -r 800511b3a22d a
--- a/a Thu Jan 01 00:00:00 1970 +0000
+++ b/a * (glob)
@@ -2,3 +2,4 @@
do not process $Id:
xxx $
$Xinfo$
+xxxx
$ hg shelve -q --name tmp
$ hg shelve --list --patch
tmp (*)* changes to: localresolve (glob)

Katsunori FUJIWARA
committed
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
diff --git a/a b/a
--- a/a
+++ b/a
@@ -2,3 +2,4 @@
do not process $Id:
xxx $
$Xinfo$
+xxxx
$ hg update -q -C 10
$ hg unshelve -q tmp
$ hg diff
diff -r 4aa30d025d50 a
--- a/a Thu Jan 01 00:00:00 1970 +0000
+++ b/a * (glob)
@@ -3,3 +3,4 @@
do not process $Id:
xxx $
$Xinfo$
+xxxx

Katsunori FUJIWARA
committed
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
Test restricted mode with rebase
$ cat <<EOF >> $HGRCPATH
> [extensions]
> rebase =
> EOF
$ hg update -q -C 9
$ echo xxxx >> a
$ hg commit -m '#11'
$ hg diff -c 11
diff -r 800511b3a22d -r b07670694489 a
--- a/a Thu Jan 01 00:00:00 1970 +0000
+++ b/a Thu Jan 01 00:00:00 1970 +0000
@@ -2,3 +2,4 @@
do not process $Id:
xxx $
$Xinfo$
+xxxx
$ hg diff -c 10
diff -r 27d48ee14f67 -r 4aa30d025d50 a
--- a/a Thu Jan 01 00:00:00 1970 +0000
+++ b/a Thu Jan 01 00:00:00 1970 +0000
@@ -1,3 +1,4 @@
+foobranch
expand $Id$
do not process $Id:
xxx $
$ hg rebase -q -s 10 -d 11 --keep
$ hg diff -r 9 -r 12 a
diff -r 800511b3a22d -r 1939b927726c a
--- a/a Thu Jan 01 00:00:00 1970 +0000
+++ b/a Thu Jan 01 00:00:00 1970 +0000
@@ -1,4 +1,6 @@
+foobranch
expand $Id$
do not process $Id:
xxx $
$Xinfo$
+xxxx

Katsunori FUJIWARA
committed
Test restricted mode with graft
$ hg graft -q 10
$ hg diff -r 9 -r 13 a
diff -r 800511b3a22d -r 01a68de1003a a
--- a/a Thu Jan 01 00:00:00 1970 +0000
+++ b/a Thu Jan 01 00:00:00 1970 +0000
@@ -1,4 +1,6 @@
+foobranch
expand $Id$
do not process $Id:
xxx $
$Xinfo$
+xxxx

Katsunori FUJIWARA
committed
Test restricted mode with backout
$ hg backout -q 11 --no-commit

Katsunori FUJIWARA
committed
$ hg diff a
diff -r 01a68de1003a a
--- a/a Thu Jan 01 00:00:00 1970 +0000
+++ b/a * (glob)
@@ -3,4 +3,3 @@
do not process $Id:
xxx $
$Xinfo$
-xxxx

Katsunori FUJIWARA
committed
Test restricted mode with histedit
$ cat <<EOF >> $HGRCPATH
> [extensions]
> histedit =
> EOF
$ hg commit -m 'backout #11'
$ hg histedit -q --command - 13 <<EOF
> pick 49f5f2d940c3 14 backout #11
> pick 01a68de1003a 13 9foobranch
> EOF

Katsunori FUJIWARA
committed
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
Test restricted mode with fetch (with merge)
$ cat <<EOF >> $HGRCPATH
> [extensions]
> fetch =
> EOF
$ hg clone -q -r 9 . ../fetch-merge
$ cd ../fetch-merge
$ hg -R ../Test export 10 | hg import -q -
$ hg fetch -q -r 11
$ hg diff -r 9 a
diff -r 800511b3a22d a
--- a/a Thu Jan 01 00:00:00 1970 +0000
+++ b/a * (glob)
@@ -1,4 +1,6 @@
+foobranch
expand $Id$
do not process $Id:
xxx $
$Xinfo$
+xxxx
Test that patch.diff(), which is implied by "hg diff" or so, doesn't
suppress expanding keywords at subsequent commands
#if windows
$ PYTHONPATH="$TESTDIR/../contrib;$PYTHONPATH"
#else
$ PYTHONPATH="$TESTDIR/../contrib:$PYTHONPATH"
#endif
$ export PYTHONPATH
$ grep -v '^promptecho ' < $HGRCPATH >> $HGRCPATH.new
$ mv $HGRCPATH.new $HGRCPATH
>>> from hgclient import check, readchannel, runcommand
>>> @check
... def check(server):
... # hello block
... readchannel(server)
...
... runcommand(server, [b'cat', b'm'])
... runcommand(server, [b'diff', b'-c', b'.', b'm'])
... runcommand(server, [b'cat', b'm'])
*** runcommand cat m
$Id: m 800511b3a22d Thu, 01 Jan 1970 00:00:00 +0000 test $
bar
*** runcommand diff -c . m
*** runcommand cat m
$Id: m 800511b3a22d Thu, 01 Jan 1970 00:00:00 +0000 test $
bar

Katsunori FUJIWARA
committed
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
#if serve
Test that keywords are expanded only in repositories, which enable
keyword extension, even if multiple repositories are served in a
process
$ cat >> fetch-merge/.hg/hgrc <<EOF
> [extensions]
> keyword = !
> EOF
$ cat > paths.conf <<EOF
> [paths]
> enabled=Test
> disabled=fetch-merge
> EOF
$ hg serve -p $HGPORT -d --pid-file=hg.pid -A access.log -E error.log --webdir-conf paths.conf
$ cat hg.pid >> $DAEMON_PIDS
$ get-with-headers.py localhost:$HGPORT 'enabled/file/tip/m/?style=raw'
200 Script output follows
$Id: m 800511b3a22d Thu, 01 Jan 1970 00:00:00 +0000 test $
bar
$ get-with-headers.py localhost:$HGPORT 'disabled/file/tip/m/?style=raw'
200 Script output follows
$Id$
bar
(check expansion again, for safety)
$ get-with-headers.py localhost:$HGPORT 'enabled/file/tip/m/?style=raw'
200 Script output follows
$Id: m 800511b3a22d Thu, 01 Jan 1970 00:00:00 +0000 test $
bar
$ killdaemons.py
#endif