Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to restore file from mercurial .hg/store/data/

Tags:

file

mercurial

I had a file main.py that was committed to mercurial but then accidentally reverted and deleted.

I notice a binary file exists .hg/store/data/main.py.i Is it possible to restore the original file from this?

like image 837
hoju Avatar asked Feb 25 '23 02:02

hoju


1 Answers

Unfortunately, as I said on the mailing list, it is not possible to undo a deletion or revertion like that.

The -C option to the hg update command says specifically:

options:

 -C --clean      discard uncommitted changes (no backup)
 -c --check      update across branches if no uncommitted changes
 -d --date DATE  tipmost revision matching date
 -r --rev REV    revision
    --mq         operate on patch repository

So the changes to that file is lost.

What you can do is get the file out from a specific revision, but it sounds to me as you had uncommitted changes to the file and the changes and/or file was completely deleted.

like image 195
Lasse V. Karlsen Avatar answered Mar 04 '23 19:03

Lasse V. Karlsen