NAME
	tagcp -- stamp your NILFS snapshot

SYNOPSIS

	tagcp -t text [options..] [directory]
	tagcp -f file [options..] [directory]

DESCRIPTION

The ``Tagcp'' is a sub command to help users to tag current NILFS
state with the specified data.  It writes a file or a simple text
to a special file of NILFS (.sketch) with their meta information
including data type and size.

About the sketch file and its data format, see sketch.txt.

Specify a text (-t option) or a data file (-f option), and specify
a directory on the NILFS filesystem.  The directory argument is 
used to select a NILFS instance to be tagged.  When the directory
argument is omitted, all NILFS instances are tagged.

The text argument is written as a plain text.  An optional type 
argment (-c option) changes its type to other format such as html,
xml, or wiki data.

The type of data given by the file argument is determined by
content or file extension.

By default, the tag is written immediately even if the NILFS
has no changes.  Tagcp supports two other synchronization mode; 
nosync mode and moderate mode (see descriptions below).

The sketch data written in the checkpoint can be viewed by commands
such as listcp and inspect, or directly though a file (.sketch).


The following options are available:

 -f <file>
     Write sketch data to the current NILFS checkpoint via the
     .sketch file.

 -t <string>
     Write a text-based tag to the current NILFS checkpoint via the
     .sketch file.

 -c <type>
     Specify data type explicitly. <type> is one of the followings:

       text   plain text
       jpeg   jpeg image
       gif    gif image
       png    png image
       html   html text
       xml    xml text
       wiki   wiki based text;
              useful to express a fraction of meta-language
              (e.g. html)
       other  data not categorized above.

 -m  Moderate mode; data written by this mode may be canceled if
     the target NILFS filesystem has no updates.

 -n  No-sync mode; write tag data without synchronization.
     Data written by this mode is kept in memory and their disk 
     write is delayed until the next filesystem write.
     They might be disappeared if the filesystem is unmounted
     without any updates.

 -a  Append a tag instead of overwriting the sketch file.
     This option lets it have multiple data.

 -h  Show help message.


Examples:

The following example shows an SCM tool like usage.

 devel> cd /project/nilfs
 devel> tagcp -t "NILFS-1.0.6 was released" .


Trapping system or user events is another potential usage.
Paticular user operations, or system alarms could be entangled
with NILFS snapshots.

 note> cd /etc/acpi
 note> cat events/default      -- included in the acpid package
 event=.*
 action=/etc/acpi/default.sh %e
 note> cat default.sh          -- included in the acpid package
 ...
 case "$ev_type" in
     button)
         case "$event" in
             power)
                  /sbin/tagcp -m -t "Hybernating system"
                  sync;sync;sync
                  /usr/local/sbin/hibernate
                  break
                  ;;
 ...
         esac
     ;;
 esac


 stationery> cat ~/.bashrc
 ...
 alias rm='/sbin/tagcp -n -t "Removing file(s)" 2> /dev/null; rm'
 alias mv='/sbin/tagcp -n -t "Moving file(s)" 2> /dev/null; mv'
 ...
 function tar() {
     expr index "$1" x > /dev/null &&
     /sbin/tagcp -n -t "Expanding a tar-ball $2" `pwd` 2> /dev/null
     /bin/tar $@
 }
 ...

Tagging an image can be done as follows:

 webcam> tagcp -n -f capture.jpg /path-to/nilfs-mounted-dir

At present, only small files (less than 4046 bytes) are acceptable;
Tagging of unprocessed images would fail.


The rest is up to your ingenuity.

For example, combining RSS readers and this feature seems to be one
interesting application.  Some sort of news articles (e.g. important
social news, unusual weather conditions, earthquakes, ...) would help
to recall a certain time point in the long stretch of time.

---
tagcp.txt,v 1.11 2006/03/15 05:00:57 ryusuke Exp
