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
|
#!/bin/sh
hg init a
cd a
echo a > a
hg add a
echo line 1 > b
echo line 2 >> b
hg commit -l b -d '1000000 0' -u 'User Name <user@hostname>'
hg add b
echo other 1 > c
echo other 2 >> c
echo >> c
echo other 3 >> c
hg commit -l c -d '1100000 0' -u 'A. N. Other <other@place>'
hg add c
hg commit -m 'no person' -d '1200000 0' -u 'other@place'
echo c >> c
hg commit -m 'no user, no domain' -d '1300000 0' -u 'person'
echo foo > .hg/branch
hg commit -m 'new branch' -d '1400000 0' -u 'person'
hg co -q 3
echo other 4 >> d
hg add d
hg commit -m 'new head' -d '1500000 0' -u 'person'
hg merge -q foo
hg commit -m 'merge' -d '1500001 0' -u 'person'
# second branch starting at nullrev
hg update null
echo second > second
hg add second
hg commit -m second -d '1000000 0' -u 'User Name <user@hostname>'
echo third > third
hg add third
hg mv second fourth
hg commit -m third -d "2020-01-01 10:01"
# make sure user/global hgrc does not affect tests
echo '[ui]' > .hg/hgrc
echo 'logtemplate =' >> .hg/hgrc
echo 'style =' >> .hg/hgrc
echo '# default style is like normal output'
echo '# normal'
hg log > log.out
hg log --style default > style.out
cmp log.out style.out || diff -u log.out style.out
echo '# verbose'
hg log -v > log.out
hg log -v --style default > style.out
cmp log.out style.out || diff -u log.out style.out
echo '# debug'
hg log --debug > log.out
hg log --debug --style default > style.out
cmp log.out style.out || diff -u log.out style.out
echo '# revision with no copies (used to print a traceback)'
hg tip -v --template '\n'
echo '# compact style works'
hg log --style compact
hg log -v --style compact
hg log --debug --style compact
# Test xml styles
echo '# xml style works (--style xml)'
hg log --style xml
echo '# xml style works (-v --style xml)'
hg log -v --style xml
echo '# xml style works (--debug --style xml)'
hg log --debug --style xml
echo '# error if style not readable'
touch q
chmod 0 q
hg log --style ./q
echo '# error if no style'
hg log --style notexist
echo '# error if style missing key'
echo 'q = q' > t
hg log --style ./t
echo '# error if include fails'
echo 'changeset = q' >> t
hg log --style ./t
echo '# include works'
rm q
echo '{rev}' > q
hg log --style ./t
echo '# ui.style works'
echo '[ui]' > .hg/hgrc
echo 'style = t' >> .hg/hgrc
hg log
echo '# issue338'
hg log --style=changelog > changelog
cat changelog
echo '# issue 2130'
hg heads --style changelog
echo "# keys work"
for key in author branches date desc file_adds file_dels file_mods \
file_copies file_copies_switch files \
manifest node parents rev tags diffstat extras; do
for mode in '' --verbose --debug; do
hg log $mode --template "$key$mode: {$key}\n"
done
done
echo '# filters work'
hg log --template '{author|domain}\n'
hg log --template '{author|person}\n'
hg log --template '{author|user}\n'
hg log --template '{date|age}\n' > /dev/null || exit 1
hg log -l1 --template '{date|age}\n'
hg log --template '{date|date}\n'
hg log --template '{date|isodate}\n'
hg log --template '{date|isodatesec}\n'
hg log --template '{date|rfc822date}\n'
hg log --template '{desc|firstline}\n'
hg log --template '{node|short}\n'
hg log --template '<changeset author="{author|xmlescape}"/>\n'
echo '# formatnode filter works'
echo '# quiet'
hg -q log -r 0 --template '{node|formatnode}\n'
echo '# normal'
hg log -r 0 --template '{node|formatnode}\n'
echo '# verbose'
hg -v log -r 0 --template '{node|formatnode}\n'
echo '# debug'
hg --debug log -r 0 --template '{node|formatnode}\n'
echo '# error on syntax'
echo 'x = "f' >> t
hg log
cd ..
echo '# latesttag'
hg init latesttag
cd latesttag
echo a > file
hg ci -Am a -d '0 0'
echo b >> file
hg ci -m b -d '1 0'
echo c >> head1
hg ci -Am h1c -d '2 0'
hg update -q 1
echo d >> head2
hg ci -Am h2d -d '3 0'
echo e >> head2
hg ci -m h2e -d '4 0'
hg merge -q
hg ci -m merge -d '5 0'
echo '# No tag set'
hg log --template '{rev}: {latesttag}+{latesttagdistance}\n'
echo '# one common tag: longuest path wins'
hg tag -r 1 -m t1 -d '6 0' t1
hg log --template '{rev}: {latesttag}+{latesttagdistance}\n'
echo '# one ancestor tag: more recent wins'
hg tag -r 2 -m t2 -d '7 0' t2
hg log --template '{rev}: {latesttag}+{latesttagdistance}\n'
echo '# two branch tags: more recent wins'
hg tag -r 3 -m t3 -d '8 0' t3
hg log --template '{rev}: {latesttag}+{latesttagdistance}\n'
echo '# merged tag overrides'
hg tag -r 5 -m t5 -d '9 0' t5
hg tag -r 3 -m at3 -d '10 0' at3
hg log --template '{rev}: {latesttag}+{latesttagdistance}\n'
cd ..
echo '# style path expansion (issue1948)'
mkdir -p home/styles
cat > home/styles/teststyle <<EOF
changeset = 'test {rev}:{node|short}\n'
EOF
HOME=`pwd`/home; export HOME
cat > latesttag/.hg/hgrc <<EOF
[ui]
style = ~/styles/teststyle
EOF
hg -R latesttag tip
echo '# test recursive showlist template (issue1989)'
cat > style1989 <<EOF
changeset = '{file_mods}{manifest}{extras}'
file_mod = 'M|{author|person}\n'
manifest = '{rev},{author}\n'
extra = '{key}: {author}\n'
EOF
hg -R latesttag log -r tip --style=style1989
echo '# done'
|