Mercurial > hg-stable
view tests/test-bheads @ 10189:e451e599fbcf
patch: support diff data loss detection and upgrade
In worst case, generating diff in upgrade mode can be two times more expensive
than generating it in git mode directly: we may have to regenerate the whole
diff again whenever a git feature is detected. Also, the first diff attempt is
completely buffered instead of being streamed. That said, even without having
profiled it yet, I am convinced we can fast-path the upgrade mode if necessary
were it to be used in regular diff commands, and not only in mq where avoiding
data loss is worth the price.
author | Patrick Mezard <pmezard@gmail.com> |
---|---|
date | Fri, 01 Jan 2010 20:54:05 +0100 |
parents | 5b7da468531b |
children | fd511e9eeea6 |
line wrap: on
line source
#!/bin/sh heads() { hg heads --template '{rev}: {desc|firstline|strip}\n' "$@" } hg init a cd a echo 'root' >root hg add root hg commit -m "Adding root node" heads echo '-------' heads . echo '=======' echo 'a' >a hg add a hg branch a hg commit -m "Adding a branch" heads echo '-------' heads . echo '=======' hg update -C 0 echo 'b' >b hg add b hg branch b hg commit -m "Adding b branch" heads echo '-------' heads . echo '=======' echo 'bh1' >bh1 hg add bh1 hg commit -m "Adding b branch head 1" heads echo '-------' heads . echo '=======' hg update -C 2 echo 'bh2' >bh2 hg add bh2 hg commit -m "Adding b branch head 2" heads echo '-------' heads . echo '=======' hg update -C 2 echo 'bh3' >bh3 hg add bh3 hg commit -m "Adding b branch head 3" heads echo '-------' heads . echo '=======' hg merge 4 hg commit -m "Merging b branch head 2 and b branch head 3" heads echo '-------' heads . echo '=======' echo 'c' >c hg add c hg branch c hg commit -m "Adding c branch" heads echo '-------' heads . echo '=======' heads -r 3 . echo $? echo '-------' heads -r 2 . echo $? echo '-------' hg update -C 4 echo $? echo '-------' heads -r 3 . echo $? echo '-------' heads -r 2 . echo $? echo '-------' heads -r 7 . echo $? echo '=======' for i in 0 1 2 3 4 5 6 7; do hg update -C "$i" heads echo '-------' heads . echo '-------' done echo '=======' for i in a b c z; do heads "$i" echo '-------' done echo '=======' heads 0 1 2 3 4 5 6 7