How to recover a file from mercurial.hg / store / data /

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

I noticed that there is a binary .hg / store / data / main.py.i file. Can I restore the original file from this?

+4
source share
3 answers

Unfortunately, as I said on the mailing list, it’s not possible to cancel the deletion or reversal.

The -C option for 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

Therefore, changes to this file are lost.

What you can do is get the file from a specific version, but that sounds to me, since you had uncommitted changes to the file, and the changes and / or file were completely deleted.

+5
source

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

+2
source

I found that the file was saved in a different head:

 hg heads hg merge -r N 
+1
source

Source: https://habr.com/ru/post/1339622/


All Articles