Bug 2298 - IndexError exception with revsets
Summary: IndexError exception with revsets
Status: RESOLVED FIXED
Alias: None
Product: Mercurial
Classification: Unclassified
Component: Mercurial (show other bugs)
Version: unspecified
Hardware: All All
: normal bug
Assignee: Bugzilla
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-07-22 06:25 UTC by Renato Cunha
Modified: 2012-05-13 05:00 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 Renato Cunha 2010-07-22 06:25 UTC
Milan Stanojevi reported to the user mailing list:

In my repository, I tried
  
hg log -r 'ancestor(tip,rev) and rev'
  
where rev is ancestor of tip and got the following exception
  
** unknown exception encountered, details follow
** report bug details to http://mercurial.selenic.com/bts/
** or mercurial@selenic.com
** Python 2.4.3 (#1, Sep  3 2009, 15:37:37) [GCC 4.1.2 20080704 (Red
Hat 4.1.2-46)]
** Mercurial Distributed SCM (version 1.6)
** Extensions loaded: extdiff, fetch, graphlog, graphviz, hgk, mq,
purge, record, transplant
Traceback (most recent call last):
  File "/home/mstanojevic/local/mercurial-1.6/hg", line 27, in ?
    mercurial.dispatch.run()
  File "mercurial/dispatch.py", line 16, in run
  File "mercurial/dispatch.py", line 34, in dispatch
  File "mercurial/dispatch.py", line 54, in _runcatch
  File "mercurial/dispatch.py", line 483, in _dispatch
  File "mercurial/dispatch.py", line 351, in runcommand
  File "mercurial/dispatch.py", line 534, in _runcommand
  File "mercurial/dispatch.py", line 488, in checkargs
File "mercurial/dispatch.py", line 481, in <lambda>
  File "mercurial/util.py", line 420, in check
  File "mercurial/extensions.py", line 115, in wrap
  File "mercurial/util.py", line 420, in check
  File "hgext/mq.py", line 2791, in mqcommand
  File "mercurial/util.py", line 420, in check
  File "mercurial/extensions.py", line 115, in wrap
  File "mercurial/util.py", line 420, in check
  File "hgext/graphlog.py", line 368, in graph
  File "mercurial/util.py", line 420, in check
  File "/usr/lib64/python2.4/commands.py", line 2526, in log

  File "mercurial/cmdutil.py", line 1040, in walkchangerevs
  File "mercurial/cmdutil.py", line 178, in revrange
  File "mercurial/revset.py", line 568, in mfunc
  File "mercurial/revset.py", line 110, in getset
  File "mercurial/revset.py", line 148, in andset
  File "mercurial/revset.py", line 110, in getset
  File "mercurial/revset.py", line 164, in func
  File "mercurial/revset.py", line 230, in ancestor
IndexError: list index out of range
Command exited with non-zero status 1

hg log -r 'ancestor(tip,rev) or rev' works just fine

Hopefully you can figure out what is wrong.

Btw, I really like the revsets feature.

Thanks
Comment 1 Renato Cunha 2010-07-22 06:29 UTC
In the ancestor function in revset.py, when

 a = getset(repo, subset, l[0])

is done, the 'a' variable gets an empty list.

As Milan already pointed out, leaving the 'and' out doesn't trigger this
bug, like in hg log -r 'ancestor(tip,1.6)'
Comment 2 Renato Cunha 2010-07-22 06:36 UTC
Running it without quotes works quite fine, btw.

hg log -r ancestor(tip,1.6) and 1.6
Comment 3 Matt Mackall 2010-07-22 08:00 UTC
Without quotes is a different beast entirely. 'and' and '1.6' will be
treated as filenames.

Fix in stable.
Comment 4 Renato Cunha 2010-07-22 08:24 UTC
For historical purposes, fix is in changeset
http://selenic.com/repo/hg/rev/ebaf117c2642 and also marked the bug as resolved.
Comment 5 Bugzilla 2012-05-12 09:11 UTC

--- Bug imported by bugzilla@serpentine.com 2012-05-12 09:11 EDT  ---

This bug was previously known as _bug_ 2298 at http://mercurial.selenic.com/bts/issue2298