Merge problems after moving directories in a branch

Mads Kiilerich mads at kiilerich.com
Tue Apr 6 15:57:26 CDT 2010


Gustavo Narea wrote, On 04/06/2010 03:37 PM:
> I just found another consequence of these bad merges:
>
> We had two files in trunk, "templates/forums/thread_list.html" and 
> "redesign-templates/forums/thread_list.html", and someone edited the 
> later. Then when I try to merge trunk into the branch where I renamed 
> "redesign-templates" and "templates", Mercurial tries to merge both 
> files into "templates/forums/thread_list.html".
>
> It seems to be getting confused because of the "templates" directory: 
> It was renamed to "old-templates" but then another directory took its 
> name (the one which used to be called "redesign-templates").

This looks pretty much like a case designed to collide with the design 
decision in context.py filectx.ancestor that reusing a filename trumps 
actual ancestry. (1327 rides again!)

Anyway, scriptifying this as:

hg init d
cd d
echo '% We had two files in trunk, "templates/forums/thread_list.html" 
and "redesign-templates/forums/thread_list.html"'
mkdir -p templates/forums
echo templates/forums/thread_list.html > templates/forums/thread_list.html
mkdir -p redesign-templates/forums/
echo redesign-templates/forums/thread_list.html > 
redesign-templates/forums/thread_list.html
hg ci -Am initial
echo '% and someone edited the later.'
echo edited >> redesign-templates/forums/thread_list.html
hg ci -m 'edited redesign-templates/forums/thread_list.html'
echo '% another branch'
hg up -r0
echo '% "templates" directory: It was renamed to "old-templates"'
hg mv templates old-templates
hg ci -m 'templates to old-templates'
echo '% another directory took its name (the one which used to be called 
"redesign-templates").'
hg mv redesign-templates templates
hg ci -m 'redesign-templates to templates'
echo '% log:'
hg log
echo '% Then when I try to merge, Mercurial tries to merge both files 
into "templates/forums/thread_list.html".'
hg up -r 1
hg merge -v --debug

It ends with:
remote changed redesign-templates/forums/thread_list.html which local 
deleted
use (c)hanged version or leave (d)eleted? c

1. Nothing was deleted, so that message/prompt is wrong.

2. I couldn't reproduce the described behaviour. Did I misunderstand 
something?

[Shouldn't this move to -devel?]

/Mads


More information about the Mercurial mailing list