Project Home


A Mercurial extension that allows the user to quickly deal with foreign files.

Table of Contents


A Mercurial extension that allows the user to quickly deal with foreign files.

This script allows you to add or delete files that are present but unknown to a repository. It deals with the case where you have been working for a while in a repository and forgot to tell Mercurial to add add some files before committing, or want to cleanup and delete some of those files lying around.

Foreign runs 'status' on the given directories, to find out which files are unaccounted for and for each of these files, it interactively asks you what to do with it (commands are invoked with one keystroke):

- add it in the repository (for the next commit)
- delete it
- ignore/mask it (adds the path to .hgignore)
- view the file with a pager (e.g., more)
- skip it for now (leave it where it is)
- quit/exit (stop doing this)

The script works interactively and is meant to allow you to quickly deal with the forgotten files in a checkout checkout.

(In svn-foreign, deleted files were being backed up to a temporary location (using some code from project xxdiff). I will eventually integrate this code in here.)

Please Donate!


This computer program or library is provided for free. I am aware that some of the programs that I provide for free allow people to get their work done faster or better, save them time and money. If you are using this program for benefit, especially if you are using it within a commercial environment and it saves you time or work, please consider making a donation by sending me a book from my Amazon Wishlist or by a direct donation to my company's PayPal account by clicking on the link below.


Download program here.