Linux Ask!

Linux Ask! is a Q & A web site specific for Linux related questions. Questions are collected, answered and audited by experienced Linux users.

Feb 242011
 

Adding the missing ignore function to Mercurial

Answer:

The following script add the ignore function to the Mercurial

#!/usr/bin/env python
"""Ignore pathnames and patterns"""
import os
def ignore(ui, repo, *pathnames):
    """Ignore the given pathnames and patterns."""
    outf = open(os.path.join(repo.root, ".hgignore"), "a")
    for p in pathnames:
        outf.write(p + "\n")
    outf.close()
    return
cmdtable = {
    'ignore': (ignore, [], "hg ignore pathname [pathname]"),
}

Save the script as ignore.py (e.g. ~/hg/ignore.py), and add the following line in your own ~/.hgrc

[extensions]
ignore = ~/hg/ignore.py

Reference: http://dmoonc.com/blog/?p=266

 Leave a Reply

(required)

(required)

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>