[issue589] "undelete" sequence leads to crash

Scott McPeak mercurial-bugs at selenic.com
Sat Jun 16 13:48:13 CDT 2007


New submission from Scott McPeak <smcpeak at acm.org>:

The following sequence of repo actions, which is intended to
have the effect of deleting then undeleting foo.txt, causes
Mercurial 1774c037fbd2 to fail with an unhandled exception:

#!/bin/sh
# demonstrate rename bug in Mercurial

# clean out any previous attempts
rm -rf repo1 repo2

# set up repo1 with a single file
mkdir repo1
cd repo1
hg init
echo "foo" > foo.txt
hg add foo.txt
hg commit -m "added foo.txt for first time"
cd ..

# duplicate it in repo2
hg clone repo1 repo2

# remove the file in repo1
cd repo1
hg remove foo.txt
hg commit -m "removed foo.txt"
cd ..

# rename the file in repo2
cd repo2
hg rename foo.txt bar.txt
hg commit -m "renamed foo.txt to bar.txt"
cd ..

# pull repo2 into repo1
cd repo1
hg pull ../repo2
hg merge
hg commit -m "pulled repo2 into repo1"

# rename bar.txt back to foo.txt, effectively undeleting it
hg rename bar.txt foo.txt
hg commit -m "renamed bar.txt back to foo.txt"

# now try to view the history of foo.txt with follow-rename enabled
hg annotate --follow foo.txt

# (crash)

The unhandled exception looks like this:

** unknown exception encountered, details follow
** report bug details to http://www.selenic.com/mercurial/bts
** or mercurial at selenic.com
** Mercurial Distributed SCM (version 1774c037fbd2)
Traceback (most recent call last):
  File "/home/scott/opt/mercurial/bin/hg", line 12, in ?
    commands.run()
  File "/home/scott/opt/mercurial/lib/python/mercurial/commands.py", line 3065,
in run
    sys.exit(dispatch(sys.argv[1:]))
  File "/home/scott/opt/mercurial/lib/python/mercurial/commands.py", line 3286,
in dispatch
    return d()
  File "/home/scott/opt/mercurial/lib/python/mercurial/commands.py", line 3245,
in <lambda>
    d = lambda: func(u, repo, *args, **cmdoptions)
  File "/home/scott/opt/mercurial/lib/python/mercurial/commands.py", line 131,
in annotate
    lines = fctx.annotate(follow=opts.get('follow'))
  File "/home/scott/opt/mercurial/lib/python/mercurial/context.py", line 306, in
annotate
    curr = pair(hist[p], curr)
KeyError: <filectx foo.txt at fae023cbe97c>

----------
messages: 3203
nosy: smcpeak
priority: bug
status: unread
title: "undelete" sequence leads to crash

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



More information about the Mercurial-devel mailing list