Unexpected rebase behavior on a file that was copied

Vladimir Marek Vladimir.Marek at oracle.com
Tue Dec 11 21:27:27 UTC 2018


Hi,

hg init repo
cd repo
echo one > file_a

hg ci -m "create file" -A # revision 0

hg copy file_a file_b
hg ci -m "copy"  # revision 1

# now update before we created the copy
hg up 0
# modify the original file
echo two > file_a
hg ci -m "modify"


@  changeset:   2:7f07a36707da
|  summary:     modify
|
| o  changeset:   1:27549406f984
|/   summary:     copy
|
o  changeset:   0:3f33e39aaf5d
   user:        Vladimir Marek <Vladimir.Marek at oracle.com>
   date:        Tue Dec 11 22:06:09 2018 +0100
   summary:     create file


# Now try to "move" the "modify" step to happen after the file copy
hg rebase -s 2 -d 1
rebasing 2:7f07a36707da "modify" (tip)
merging file_b and file_a to file_b

$ cat file_a
two

$ cat file_b
two

Before rebasing the changeset "modify" modifies just file_a, after it
modified both files. Is this expected?

Using "hg graft --rev 2" has the same result.

Is there a way to make rebase touch only the file I wanted to change?

Thank you
-- 
	Vlad


More information about the Mercurial mailing list