Mercurial > public > mercurial-scm > hg
view tests/test-command-template @ 4531:b51a8138292a
Avoid extra filelogs entries.
Right now, there are some situations in which localrepo.filecommit can
create filelog entries even though they're not needed. For example:
- permissions for a file have changed;
- qrefresh can create a filelog entry identical to its parent (see the
added test);
- convert-repo creates extra filelog entries in every merge where the
first parent has added files (for example, changeset ebebe9577a1a of
the kernel repo added extra filelog entries to files in the
arch/blackfin directory, even though the merge should only touch the
drivers/ata directory). This makes "hg log file" in a converted repo
less useful than it could be, since it may mention many merges that
don't actually touch that specific file.
They all come from the same basic problem: localrepo.commit (through
filecommit) creates new filelog entries for all files passed to it
(except for some cases during a merge).
Patch and test case provided by Benoit.
This should fix issue351.
author | Alexis S. L. Carvalho <alexis@cecm.usp.br> |
---|---|
date | Sat, 09 Jun 2007 01:04:28 -0300 |
parents | 5e857d72d3ac |
children | 3cf94964c56b |
line wrap: on
line source
#!/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 hg commit -m 'merge' -d '1500001 0' -u 'person' # 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 diff log.out style.out echo '# verbose' hg log -v > log.out hg log -v --style default > style.out diff log.out style.out echo '# debug' hg log --debug > log.out hg log --debug --style default > style.out diff 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 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 "# keys work" for key in author branches date desc file_adds file_dels files \ manifest node parents rev tags; 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 --template '{date|date}\n' hg log --template '{date|isodate}\n' hg log --template '{date|rfc822date}\n' hg log --template '{desc|firstline}\n' hg log --template '{node|short}\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 echo '# done'