Cancel move / rename action in mercurial?

I made hg mv -A oldFile newFile and accidentally got a new file.

I made hg revert newFile , but now the file that was shown as missing (and then as deleted after the move command) now no longer appears at all.

How can I undo this and return to the state I was in, so that the new file appears as unknown and the old file appears as missing?

+6
source share
2 answers
 $ hg st $ mv ab $ hg st ! a ? b $ hg mv -A ab $ hg st A b R a $ hg revert b $ hg st ? b $ ls ab 

So hg revert b restored the old file a . Now all you have to do is hg mv a correct-name .

+7
source

This is where the "unmove" script is written in bash. Up there is help text. The most important point is that the script has a parameter that forcibly deletes any file deletion.

 #!/bin/bash # Syntax: $0 [OPTION] DEST # # This script is mainly intended to undo the effects of: hg move SOURCE DEST # # It first determines which files have been added globally (as if by # hg add), then it runs: # hg -v revert DEST # Finally, it removes all the files that had been added, # and then reverts them as well if possible. # # OPTIONS: # -i :: remove files using rm -i if [ "$1" = -i ] ; then INTERACT=$1 shift fi TODO=() while read -rf ; do TODO+=("$f") done < <( hg st -an " $@ " ) function go { hg -v revert " $@ " for f in "${TODO[@]}" ; do rm $INTERACT "$f" hg -q files "$f" > /dev/null && hg revert "$f" done } go 
0
source

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


All Articles