[Originally files as https://bitbucket.org/marmoute/mutable-history/issue/19/inconsistent-results-running-hg-phase-on] Consider the script ``` hg init phasetest cd phasetest echo -e "\nLine 0" >> foo hg add foo hg ci -m "Line 0" for i in {1..5} do echo -e "\nLine $i" >> foo hg amend -m "Line $i" done for i in {0..10} do echo "hg phase -r $i" hg phase -r $i done echo -e "\nhg log -v\n" hg log -v cd .. ``` The output of this script is as follows. For every run of the script, I get a different, non-deterministic mix of "no node!", "unknown revision", and "ambiguous identifier". With the `--hidden` flag I get `draft` for all except 0. I think these messages could be improved. ``` hg phase -r 0 -1: public hg phase -r 1 abort: 00changelog.i@1: ambiguous identifier! hg phase -r 2 abort: unknown revision '2'! hg phase -r 3 abort: unknown revision '3'! hg phase -r 4 abort: 00changelog.i@4: ambiguous identifier! hg phase -r 5 abort: 00changelog.i@5: ambiguous identifier! hg phase -r 6 abort: unknown revision '6'! hg phase -r 7 abort: unknown revision '7'! hg phase -r 8 abort: 00changelog.i@8e9adaeb337af8631e2f01a99cfb3ae7c562a87c: no node! hg phase -r 9 abort: unknown revision '9'! hg phase -r 10 10: draft hg log -v changeset: 10:46b96745f138 tag: tip parent: -1:000000000000 user: Faheem Mitha <faheem@faheem.info> date: Sun Jul 07 15:18:38 2013 +0530 files: foo description: Line 5 ```
abort: 00changelog.i@8e9adaeb337af8631e2f01a99cfb3ae7c562a87c: no node! -> this appears to be an actual bug revlog._partialmatch seems to be unaware of filtered revisions.
Fixed by http://selenic.com/repo/hg/rev/fd1bb7c1be78 Matt Mackall <mpm@selenic.com> revlog: handle hidden revs in _partialmatch (issue3979) Looking up hidden prefixes could cause a no node exception Looking up unique non-hidden prefixes could be ambiguous (please test the fix)