开发者

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

开发者 https://www.devze.com 2023-02-11 09:56 出处:网络
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

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 fro开发者_开发问答m this?


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.


You can restore any version of a file with hg revert -r <revision-where-the-file-existed> file.name.


I found the file was maintained in another head:

hg heads
hg merge -r N
0

精彩评论

暂无评论...
验证码 换一张
取 消