Bug 2388 - Crash with hg qmv when patches have same name
Summary: Crash with hg qmv when patches have same name
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-09-19 17:09 UTC by contingencyplan
Modified: 2012-05-13 05:11 UTC (History)
7 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 contingencyplan 2010-09-19 17:09 UTC
If I have two patches, a.patch and b.patch, and I rename them so I have
b.patch -> c.patch, a.patch -> b.patch, Mercurial + mq crashes upon the
second rename when the mq directory is versioned and a.patch and b.patch
have been committed. Furthermore, the crash leaves the mq directory in an
inconsistent state -- the series file still lists a.patch, but the rename of
a.patch -> b.patch occurred, so attempts to push a.patch will fail. On the
other hand, if I commit the rename b.patch -> c.patch to the mq repository,
I can then perform the a.patch -> b.patch rename without issue, thus
providing a workaround.

This is the minimum sequence of commands to cause the crash. In particular,
the patch directory must be versioned, and both a.patch and b.patch must be
committed to it before the renaming occurs.

In a clean directory:

% hg init

% hg qinit -c

% hg qnew a.patch

% hg qnew b.patch

% hg ci --mq -m "a.patch b.patch"

% hg qmv b.patch c.patch

% hg qmv a.patch b.patch
** unknown exception encountered, details follow
** report bug details to http://mercurial.selenic.com/bts/
** or mercurial@selenic.com
** Python 2.6.5 (r265:79063, Apr 16 2010, 13:57:41) [GCC 4.4.3]
** Mercurial Distributed SCM (version 1.6.3)
** Extensions loaded: bookmarks, churn, color, convert, eol, extdiff, fetch,
gpg, git, mq, graphlog, pager, progress, purge, rebase, record
Traceback (most recent call last):
  File "/usr/bin/hg", line 27, in <module>
    mercurial.dispatch.run()
  File "/usr/lib/pymodules/python2.6/mercurial/dispatch.py", line 16, in run
    sys.exit(dispatch(sys.argv[1:]))
  File "/usr/lib/pymodules/python2.6/mercurial/dispatch.py", line 34, in
dispatch
    return _runcatch(u, args)
  File "/usr/lib/pymodules/python2.6/mercurial/dispatch.py", line 54, in
_runcatch
    return _dispatch(ui, args)
  File "/usr/lib/pymodules/python2.6/mercurial/dispatch.py", line 494, in
_dispatch
    cmdpats, cmdoptions)
  File "/usr/lib/pymodules/python2.6/mercurial/dispatch.py", line 355, in
runcommand
    ret = _runcommand(ui, options, cmd, d)
  File "/usr/lib/pymodules/python2.6/mercurial/extensions.py", line 174, in wrap
    return wrapper(origfn, *args, **kwargs)
  File "/usr/lib/pymodules/python2.6/hgext/pager.py", line 95, in pagecmd
    return orig(ui, options, cmd, cmdfunc)
  File "/usr/lib/pymodules/python2.6/mercurial/extensions.py", line 174, in wrap
    return wrapper(origfn, *args, **kwargs)
  File "/usr/lib/pymodules/python2.6/hgext/color.py", line 211, in colorcmd
    return orig(ui_, opts, cmd, cmdfunc)
  File "/usr/lib/pymodules/python2.6/mercurial/dispatch.py", line 545, in
_runcommand
    return checkargs()
  File "/usr/lib/pymodules/python2.6/mercurial/dispatch.py", line 499, in
checkargs
    return cmdfunc()
  File "/usr/lib/pymodules/python2.6/mercurial/dispatch.py", line 492, in
<lambda>
    d = lambda: util.checksignature(func)(ui, *args, **cmdoptions)
  File "/usr/lib/pymodules/python2.6/mercurial/util.py", line 420, in check
    return func(*args, **kwargs)
  File "/usr/lib/pymodules/python2.6/hgext/mq.py", line 2336, in rename
    wctx.undelete([name])
  File "/usr/lib/pymodules/python2.6/mercurial/context.py", line 847, in
undelete
    t = fctx.data()
AttributeError: 'changectx' object has no attribute 'data'

% hg qseries
a.patch
c.patch

% hg qpop -a
popping c.patch
popping a.patch
patch queue now empty

% hg qpush
applying a.patch
unable to read a.patch

% ls .hg/patches
b.patch  c.patch  series  status

% hg status --mq
M series
A c.patch
R b.patch
! a.patch


According to kiilerix in IRC #mercurial, this issue was introduced via
http://www.selenic.com/hg/rev/a1aad8333864 .
Comment 1 HG Bot 2010-09-21 16:00 UTC
Fixed by http://hg.intevation.org/mercurial/crew/rev/4ae3e5dffa60
Patrick Mezard <pmezard@gmail.com>
context: fix filectx.undelete() (issue2388)
Comment 2 Patrick Mézard 2010-09-22 16:24 UTC
In main, resolving

And thanks for the very nice test case you produced!
Comment 3 Patrick Mézard 2010-09-22 16:24 UTC
In main, resolving

And thanks for the very nice test case you produced!
Comment 4 Bugzilla 2012-05-12 09:12 UTC

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

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