View on GitHub

hgnotebook

Mercurial extension to store and retrieve metadata on file of a repository

download .ZIPdownload .TGZ

hgnotebook

hgnotebook is a Mercurial extension that allow user to store and retrieve metadata on file of a repository.

Installation

A functional installation of Mercurial 1.3 or later is required. hgnotebook can be installed like every other Mercurial extension by adding notebook = ~/path/to/hgnotebook in the extensions section of your .hgrc.

How it work

The added meta data are exported in pickle to be easily exported between clones. By default the pickle file is .notes, if you want the meta data to be shared, remember to add it under version control. The is no limitation on file type or meta data type. By default the title and the path of the file is displayed, but for each filter or when you order the results, the corresponding column is added with the value. The title column refer to the title key in the meta data, but if it not set, the extension try to read the first line of the file to display it.

Extension usage

Add, modify or remove meta data on the note:

hg meta –-key KEY –-note NOTE [–-remove] [VALUES]

List the file. Without options, list the title and the path:

hg note

Limit the number of file to NbOfElement:

hg note –-limit NbOfElement

Order the node list by the value of specified field:

hg note –-order keyword

The - symbol before the criteria reverse the order.

Filter files which have this key. If a value is specified only the file which have this key matching value depending of the operator are displayed:

hg note –-filter key[__operator][=values]

Available operator are:

You can separate the different filters with the ## symbol. For example to filter the date and the title:

hg note -f title__startswith=What##date__contains=2010

By default the ## act as matching all the rules but if the ~ is set at the beginning of the filter the file is displayed if at least one key match with a value.

Of course all this arguments can be combined to have a powerful metadata management.