Mercurial > hg
diff tests/test-revset.t @ 24940:6b54f749659b
revset: avoid returning duplicates when returning ancestors
Before this patch, _revancestors were giving false result when a revision was
duplicated in the input. Duplicated entry are rare but may happen when using the
`%lx` notation internally.
This series has no visible impact on the performance of the function according
to benchmark.
author | Pierre-Yves David <pierre-yves.david@fb.com> |
---|---|
date | Wed, 26 Mar 2014 15:55:50 -0700 |
parents | 022282152632 |
children | 263bbed1833c |
line wrap: on
line diff
--- a/tests/test-revset.t Wed Mar 26 16:21:30 2014 -0700 +++ b/tests/test-revset.t Wed Mar 26 15:55:50 2014 -0700 @@ -1,5 +1,27 @@ $ HGENCODING=utf-8 $ export HGENCODING + $ cat > testrevset.py << EOF + > import mercurial.revset + > + > baseset = mercurial.revset.baseset + > + > def r3232(repo, subset, x): + > """"simple revset that return [3,2,3,2] + > + > revisions duplicated on purpose. + > """ + > if 3 not in subset: + > if 2 in subset: + > return baseset([2,2]) + > return baseset() + > return baseset([3,3,2,2]) + > + > mercurial.revset.symbols['r3232'] = r3232 + > EOF + $ cat >> $HGRCPATH << EOF + > [extensions] + > testrevset=$TESTTMP/testrevset.py + > EOF $ try() { > hg debugrevspec --debug "$@" @@ -340,6 +362,9 @@ 0 $ log 'ancestor(1,2,3,4,5)' 1 + +test ancestors + $ log 'ancestors(5)' 0 1 @@ -347,6 +372,12 @@ 5 $ log 'ancestor(ancestors(5))' 0 + $ log '::r3232()' + 0 + 1 + 2 + 3 + $ log 'author(bob)' 2 $ log 'author("re:bob|test")'