views:

349

answers:

1

Using Mercurial, TortoiseHG, Win XP.

I had a working directory with a number of files. Committed and ready.

My syncing software [incorrectly configured] copied some very old files [from before I was using HG] into my working directory, overwriting many many hours of work.

I wanted to go back to the last committed version, so I did "update to revision" -> current branch tip.

That must have been the wrong thing, as now it shows all of those old files as being the current files, and no sign anywhere of all my work.

That "update to revision" doesn't show in the history or anywhere.

Anything I can do to get my files back?

Also, anytime I try to sync with bitbucket, it hangs, blocks the internet [browser and IM cease to work], and doesn't update [hence I do not have any other copy]. Anyone with an idea how to fix?

Thanks (desperate!)

Below is the graph, as requested. It doesn't show me anything about the update to tip (?): alt text

+3  A: 

If all your changes were committed all you have to do is:
1. revert local changes (hg revert -a)
2. update to the revision you want (e.g., hg update tip)

If you don't revert local changes HG will try to keep them when updating the working directory.

I don't have any solution to your second problem. I used TortoiseHG on WinXP and it worked well. Try to upgrade to a newer version

artemb
How do I get the command line? I have been using TortoiseHG?Why should this be different than my unsuccessful update to tip using tortoiseHG?
SamGoody
You can get command line by going Start -> Run and typing cmdThis ain't very different, you can do the same with TortoiseHG. Open status window, revert all changes and then open the changelog window, choose a revision to update to and do so.You may want to make a backup copy in case you have some valuable uncommitted changes because they will be lost after the revert
artemb
If you want to do this in TortoiseHG, you can. There is a "Revert files..." item on the context menu, which allows you to do step 1 from this answer. Then you can just re-run the update tip that you tried previously to get yourself right.
Phil Booth
I dunno what Im doing wrong, but I sure am glad you suggesting backing up. above instructions got me back to some earlier revision - not sure where. Cutting my losses now - I can redo a few days of work, and it will be quicker than this. But am curious, is there any way I can ask for the second to last version of a given file?
SamGoody
You don't have to mark anything correct, but we're definitely in the Pebkac zone on this one. From the questions you're asking above there's at least some confusion about the term 'update':"That "update to revision" doesn't show in the history or anywhere"Update is not a history modifying action. Update is more like 'checkout' in traditional CVS-style source control systems. Update says "make my working copy look like revision X in the history _and_ modify the parent of my working directory to be X". Contrast that with 'revert' (modifies the working copy but _not_ the parent).
Ry4an
Right, Pebkac. I am definitely a noob at HG :( The graph does not reflect the original "update to current branch tip" action. I don't think it reflected the 'revert' or the second 'update' either [done on artemb's suggestion], but since I have since deleted the entire repo I can no longer check. (As said, I first copied the whole repo as a backup.) The original problem: when I did 'update to tip' instead of it making the working directory look like my last committed set, it made the last commit include my working directory. Artemb's commands did not fix that.
SamGoody
I assume that the above answer is correct, and therefore am marking it as such. It has not worked for me though.
SamGoody
You can unmark the answer if it didn't work. I believe that you need to invest a little more time in learning the basics of Mercurial to work effectively. Here are some materials:http://mercurial.selenic.com/wiki/Tutorialhttp://mercurial.selenic.com/wiki/UnderstandingMercurialhttp://www.ivy.fr/mercurial/ref/v1.0/I hope you don't go into "Mercurial sucks" because of not learning it well enough. Happy versionning
artemb