Foreign Extension

This extension is not distributed with Mercurial.

Author: Martin Blais

Source code: http://furius.ca/pubcode/pub/conf/lib/python/hgblais/foreign.py

Web page: http://furius.ca/pubcode/pub/conf/lib/python/hgblais/foreign.py.html

Compatibility: Mercurial 0.9.5 and beyond.

Overview

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 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):

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

Note:

Configuration

Configure your .hgrc to enable the extension by adding following lines:

[extensions]
foreign =

Place foreign.py somewhere accessible from your PYTHONPATH.

Usage Scenario

Here is a example repository with some modifications and unknown files in it.

  banane:~/work/3rdparty$ hg status
  A doc/diagram.dia
  R bin/pgrphack
  ! bin/fghack
  ? doc/project-docs.pdf
  ? doc/project-docs.txt
  ? share/prices.data
  ? share/prices.data.tmp

Here is an example session running 'hg foreign' to prepare it for commit.

  banane:~/work/3rdparty$ hg foreign
  ? doc/project-docs.pdf
  ? doc/project-docs.txt
  ? share/prices.data
  ? share/prices.data.tmp
  ! bin/fghack

  => [Add|Delete|Ignore|Skip|View|Quit]     2027120  doc/project-docs.pdf  ? i
  Add ignore pattern for 'doc/project-docs.pdf'
  => [Add|Delete|Ignore|Skip|View|Quit]       34743  doc/project-docs.txt  ? a
  Added 'doc/project-docs.txt'
  => [Add|Delete|Ignore|Skip|View|Quit]      218622  share/prices.data  ? a
  Added 'share/prices.data'
  => [Add|Delete|Ignore|Skip|View|Quit]           0  share/prices.data.tmp  ? d
  Deleted '/home/blais/work/3rdparty/share/prices.data.tmp'
  => [Revert|Delete|Skip|Quit]                    0  bin/fghack  ? d
  Removed 'bin/fghack'
  (Done.)


CategoryExtensionsByOthers

ForeignExtension (last edited 2012-11-06 15:08:58 by abuehl)