2
votes

I have a branch called "developing" with a certain status o files with a release number 500 with a.java and b.java inside.

STEP - a.java has been deleted from developing and then pushed (501). - a branch is created from 501 called (my_branch); - in my_branch I have added a new version of a.java and a new file c.java;

PROBLEM When I try to merge my_branch with developing, mercurial delete a.java. The result is my_branch with b.java and c.java;

What I think is that mercurial is aware of previusly deleting of a.java and, without prompting a warning, delete the file even if I have added again in my_branch.

How can I force my_branch's file to be merged?

2

2 Answers

2
votes

I just tried the described scenario. The mercurial doesn't delete new version of previously deleted file.

Steps to reproduce:

  • Create new hg repository
  • Create new file a.txt, commit changes - version 1
  • Delete file a.txt, commit changes - version 2
  • Create file b.txt, commit changes - version 3
  • Update to version 2, by hg update -C 2
  • Create again new file a.txt, commit changes ( creates new head)

Merging two heads results in files a.txt and b.txt

0
votes

I'm with @bbaja42 that there's some detail missing in your description -- this doesn't happen in normal usage.

That said, it's easy to work around -- just put the file you want in place before you commit the merge -- merges are always manually committed in Mercurial.

hg update my_branch
hg merge developing
hg revert -r my_branch a.java
hg add a.java # might be unnecessary, but it can't hurt
hg commit -m 'committed the merge with a.java from my_branch in place'