|hg rename|d files no longer |hg merge|ing [(k)eep or (d)elete?]

Edward Lee edilee at mozilla.com
Tue Aug 7 05:08:58 CDT 2007


On 8/7/07, Edward Lee <edilee at mozilla.com> wrote:
> Are there any known issues with rename
Good news and bad news. Seems like it's an issue of |hg merge| and not
|hg rename|. By renaming the files back to original, commit, rename to
the new name, commit, mercurial is able to merge the files correctly
when pulling changes. However, this problem of mercurial forgetting
about the rename can occur again fairly easily.

> some reason after merging [6] some changes from (1) into (2), pulling
> new changes results in "[(k)eep or (d)elete?]"
> [6] http://hg.mozilla.org/mozilla-central/?rev/d7e93861f3f3
The interesting thing here is that it turns out the merge just
happened to not touch any of the renamed files. So any merges that
don't involve the renamed files will have mercurial forgetting about
the rename. Similarly, even if some of the renamed files are touched,
the remaining renamed files that are untouched are also forgotten in
the merge.

----

Here is a sample set of commands that result in the "keep or delete" prompt.

mkdir testhg
cd testhg
hg init source
cd source
touch one.c
hg add one.c
touch two.h
hg add two.h
hg commit -m init
cd ..
hg clone source dest
cd dest
hg rename one.c one.cpp
hg commit -m rename
cd ../source
echo hello >> two.h
hg commit -m hello
cd ../dest
hg pull ../source
hg merge
hg commit -m mergehello
cd ../source
echo world >> one.c
hg commit -m world
cd ../dest
hg pull ../source
hg merge

And the corresponding output..

2 files updated, 0 files merged, 0 files removed, 0 files unresolved
pulling from ../source
searching for changes
adding changesets
adding manifests
adding file changes
added 1 changesets with 1 changes to 1 files (+1 heads)
(run 'hg heads' to see heads, 'hg merge' to merge)
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
(branch merge, don't forget to commit)
pulling from ../source
searching for changes
adding changesets
adding manifests
adding file changes
added 1 changesets with 1 changes to 1 files (+1 heads)
(run 'hg heads' to see heads, 'hg merge' to merge)
remote changed one.c which local deleted
(k)eep or (d)elete?

Ed


More information about the Mercurial mailing list