Using hg returns to Mercurial

I am using Mercurial. I made a storage clone. For debugging, I changed a few lines of code in a java file. However, I did not make these changes. I just want to return them back to their original state, as shown in the repository. I tried hg revert filename.java , which returned it, but now when I do hg status , I see additional files added to my folder, now it seems:

 ? filename.java.orig 

Can I just delete these files, and why does Mercurial do them when I use revert?

+61
mercurial
Feb 10 '10 at 18:26
source share
8 answers

Yes, you can delete them. This is a safety feature if you returned what you did not want to return.

+47
Feb 10 '10 at 18:29
source share

You can also use the --no-backup flag and .orig files will not be created

 hg revert --no-backup filename.java 

As with Mercurial 2.0, you can use the -C flag instead to suppress generated .orig files.

 hg revert -C filename.java 
+85
Aug 04 '10 at 3:45
source share

I can find a cleaning extension . Using:

 hg purge 

"This extension clears all files and directories that are not tracked by Mercurial," including .orig files, but excluding ignored files (unless you use --all).

+23
Sep 06 2018-10-06
source share

As others have pointed out, you can safely delete these files.

You can remove them by running this command from the root of your repo:

 rm `hg st -un | grep orig` 

If you want to go back and don't care about backing up the source files, you need the command:

 hg update -C 
+8
Feb 11 '10 at 4:40
source share

These are copies of files before you return them. If you do not need it, you can delete them manually or using the Cleanup extension :

 hg clean 
+6
Feb 10 '10 at 19:14
source share

These backup files can be created for merge and return operations (see the man page ). You can add an ignore rule if you want, or simply delete them if you no longer need them.

+5
Feb 10 2018-10-18
source share

They are quite common as a result of various operations. Looking at one of the moderate-sized repositories I'm working on, they find 237 of them. I don’t like deleting things that may be useful, and I have no reason to specify legitimate files with the same suffix, so instead I add the following instead of .hgignore:

 .\.orig$ 
0
Feb 10 2018-10-10
source share

I myself made this batch file.

 IF "%1%" == "d" ( del /s *.orig del /s *.rej ) ELSE ( del /s /p *.rej del /s /p *.orig ) 

Help: Save this content as orig.bat

  • Run orig d to delete all rejects and orig files at once without confirmation.
  • Run orig to delete confirmation files [Security Engine]

Hope this will be helpful.

0
Nov 23
source share



All Articles