1

Environment

We have no branches or separate heads at this time.
We each have our working directory on our individual PCs (obviously).


Problem

Developer A pushed a commit out to BitBucket.
Developer B tried to do a commit & push that failed due to changes having been made.
Developer B does a pull on the latest changeset.
Developer B performs an Update ...

At this point, there is usually a merge pop-up that occurs when there are differences in any of the files. There was no such pop-up and therefore overwrote Developer B's working directory.


Question

Is there a way to get back the files that were overwritten before Developer B performed the Update?

Community
  • 1
  • 1
Code Maverick
  • 20,171
  • 12
  • 62
  • 114
  • he may have switched heads, check if there is a hidden head that you should merge with. – nlucaroni Mar 15 '13 at 20:31
  • How do you tell if there is a hidden head? We just switched from VSS about a month ago, so we are very new to this. – Code Maverick Mar 15 '13 at 20:33
  • If you happen to be using eclipse, you can often look at local history to find your previous changes. – DavidA Mar 15 '13 at 20:34
  • `hg heads` will show all the current heads from the terminal and `hg id -n` will tell you the current change-set you're working directory is in. – nlucaroni Mar 15 '13 at 20:35
  • Did he commit **all** the changes, or just **some** of them? I suspect the latter since you claim Mercurial overwrote his working directory, but best to check. – Lasse V. Karlsen Mar 15 '13 at 20:40
  • 1
    Ok ... I've fixed it. Apparently the working directory was switched out for the latest pull and then it created a hidden head as @nlucaroni suggested. I merged it back with the local and everything is there! So if you want to write an answer with what you stated, I'll accept it. – Code Maverick Mar 15 '13 at 20:44
  • 1
    I think you need to work on the terminology here. "Working directory" relates to the folder you have your files in (outside of the .hg directory), typically used in context of changes that have yet not been committed. When you say "overwrote the working directory" that typically means "changes not yet committed was overwritten (aka lost)". – Lasse V. Karlsen Mar 15 '13 at 20:48
  • @LasseV.Karlsen You are right and that's exactly what I thought had happened. I didn't know the changes I committed were swapped out for the changeset I had just pulled. I thought it would ask me to merge during the Update process with what was already in my working directory. – Code Maverick Mar 15 '13 at 20:50

1 Answers1

3

In pulling from the repo, you may have set the head to that particular changeset hiding the other branch the Developer was working on. To view the list of heads use hg heads, and then you can manually merge them, hg merge -r <NUM1> -r <NUM2>.

nlucaroni
  • 47,556
  • 6
  • 64
  • 86