[issue3321] parser error on hg update when a '#' is used in the branch or tag name, and the name doesn't exist.

Seth Hill bugs at mercurial.selenic.com
Wed Mar 14 18:49:47 CDT 2012


New submission from Seth Hill <sethrh at gmail.com>:

In my shop we have branches named "#95", "#134" (corresponding to IDs in our issue tracker). 

Assuming I have a branch named #95, If I `hg up "#95"`, everything works as expected. However, if I specify a branch 
that doesn't exist (if I mistype it as `hg up "#995"` or something), I get this (with --traceback): 

Traceback (most recent call last):
  File "/Library/Python/2.7/site-packages/mercurial/dispatch.py", line 87, in _runcatch
    return _dispatch(req)
  File "/Library/Python/2.7/site-packages/mercurial/dispatch.py", line 684, in _dispatch
    cmdpats, cmdoptions)
  File "/Library/Python/2.7/site-packages/mercurial/dispatch.py", line 466, in runcommand
    ret = _runcommand(ui, options, cmd, d)
  File "/Library/Python/2.7/site-packages/mercurial/dispatch.py", line 738, in _runcommand
    return checkargs()
  File "/Library/Python/2.7/site-packages/mercurial/dispatch.py", line 692, in checkargs
    return cmdfunc()
  File "/Library/Python/2.7/site-packages/mercurial/dispatch.py", line 681, in <lambda>
    d = lambda: util.checksignature(func)(ui, *args, **cmdoptions)
  File "/Library/Python/2.7/site-packages/mercurial/util.py", line 458, in check
    return func(*args, **kwargs)
  File "/Library/Python/2.7/site-packages/mercurial/commands.py", line 5615, in update
    rev = scmutil.revsingle(repo, rev, rev).rev()
  File "/Library/Python/2.7/site-packages/mercurial/scmutil.py", line 488, in revsingle
    l = revrange(repo, [revspec])
  File "/Library/Python/2.7/site-packages/mercurial/scmutil.py", line 549, in revrange
    m = revset.match(repo.ui, spec)
  File "/Library/Python/2.7/site-packages/mercurial/revset.py", line 1044, in match
    tree, pos = parse(spec)
  File "/Library/Python/2.7/site-packages/mercurial/parser.py", line 81, in parse
    self._advance()
  File "/Library/Python/2.7/site-packages/mercurial/parser.py", line 31, in _advance
    self.current = self._iter.next()
  File "/Library/Python/2.7/site-packages/mercurial/revset.py", line 94, in tokenize
    raise error.ParseError(_("syntax error"), pos)
ParseError: ('syntax error', 0)
hg: parse error at 0: syntax error


This is a very minor issue, since nothing bad happens. But putting a '#' anywhere in the name seems to trigger this 
error. Seen on hg 2.0.2 on 10.7/python 2.7, 10.6/python 2.6, and Win7 w/TortoiseHg 2.0.2.

----------
messages: 19388
nosy: seth
priority: bug
status: unread
title: parser error on hg update when a '#' is used in the branch or tag name, and the name doesn't exist.
topic: 2.0.2, hg

____________________________________________________
Mercurial issue tracker <bugs at mercurial.selenic.com>
<http://mercurial.selenic.com/bts/issue3321>
____________________________________________________


More information about the Mercurial-devel mailing list