During merges mercurial leaves .orig file for any unresolved file. But after manually resolving problems and marking a file correct it does not delete the .orig file. Can it
A command that I use on Linux for cleaning up, saves the need to do a fresh search with find.
These need to be run from the root directory of the Mercurial project
hg status | grep ".orig" | cut -d ' ' -f 2- | xargs rm -f
Or if you want to clear all unknown files.
hg status | cut -d ' ' -f 2- | xargs rm -f
I have posted this answer before. But this is the correct place to this answer.
I made this batch file myself.
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
orig d
to delete all rejects and orig files at once without confirmationorig
to delete files with confirmation [Safety mechanism]Hope this is helpful.
I personally use the following from the root of the repo:
hg purge -p -I **/*.orig | xargs rm -f
It's a little better than using just 'hg purge' or 'hg purge --all' because you can filter out the specific file types you want to include.
For an explaination:
btw. find
utility has an action -delete
so you can type only:
find <path-to-files> -name '*.orig' -delete
you should use the update hook
update: This is run after an update or merge of the working directory has finished
I'm working in Powershell and didn't see the answer here:
# NOTE: be in the root of your repository
# fetch all .orig files recursively
$orig = (dir *.orig -recurse) ;
# remove each .orig file
foreach ($item in $orig) { del $($item.FullName) ; }
# afterwards I make sure to remove the references to the .orig files in the repo
# then commit & push
hg addremove ;
hg commit -m "remove .orig" ;
hg push ;