Bug 3979 - hg phase without the --hidden flag on obsolete changesets gives unclear messages
Summary: hg phase without the --hidden flag on obsolete changesets gives unclear messages
Status: RESOLVED FIXED
Alias: None
Product: Mercurial
Classification: Unclassified
Component: Mercurial (show other bugs)
Version: 2.6.2
Hardware: PC Linux
: wish feature
Assignee: Pierre-Yves David
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-07-07 07:41 UTC by Faheem Mitha
Modified: 2013-08-01 23:56 UTC (History)
3 users (show)

See Also:
Python Version: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Faheem Mitha 2013-07-07 07:41 UTC
[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
```
Comment 1 Matt Mackall 2013-07-23 17:13 UTC
abort: 00changelog.i@8e9adaeb337af8631e2f01a99cfb3ae7c562a87c: no node!
 -> this appears to be an actual bug

revlog._partialmatch seems to be unaware of filtered revisions.
Comment 2 HG Bot 2013-07-24 15:00 UTC
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)