views:

35

answers:

1

I've been using TortoiseHG for some time now and I've been running into the same issue once in a while.

Sometimes, when I commit my work, it gives me an error, saying that one (or more) of my files is being used by another process. However, the commit still goes through and is visible in the repository browser.

Next, after closing the processes that caused the error, I reopen the commit dialog that says that there are still changes to be committed (meaning the first commit didn't really do anything). I do another commit, which accomplishes what I wanted to do in the first place, but now I have a different problem: the repository now has two heads. Of course, I'm forced to merge the two heads after this, but my process seems unclean.

Is there a better way to get around such a problem, such as by somehow undoing the commit (but not reverting my files), or should I not bother cleaning stuff like this up?

+1  A: 

hg rollback at the command line should revert the commit but not the changes (I don't use tortoisehg, so unclear if it puts that in a nice UI).

Nick Bastin
Looks like it does, through the Recovery dialog. Will try this next time such a thing happens (pretty soon).
Maxim Zaslavsky
Also, is it possible to somehow go back now and get rid of the faulty commits (and thus, the merges, too)?
Maxim Zaslavsky
Don't focus too much on that - they're not "faulty" so much as just a recording of what happened. You should banish from your mind the thought of ever trying to "fix" history in a revision control system - history already happened, it's immutable. (The only time you ever want to risk really bad things in order to change history is if you committed nuclear launch codes into your RCS by mistake).
Nick Bastin
Didn't get such an error again for some time, but finally got it today - rollback fixed it! Thanks!And what if I do accidentally commit such a file? Well, not nuclear launch codes, but something like a assembly signing keyfile?
Maxim Zaslavsky
Various discussion here: http://hgbook.red-bean.com/read/finding-and-fixing-mistakes.html#sec:undo:aaaiiieee, but you're basically screwed - You *can* dig around in the repo store and "fix" the problem, but you have a problem because you don't know if anyone pulled the change and thus has a local history with the change (and now you've created awful inconsistencies in version histories).
Nick Bastin