[darcs-devel] [issue307] File and Directory Metadata

Eric Kow bugs at darcs.net
Sun Oct 15 13:03:20 PDT 2006


New submission from Eric Kow <eric.kow at gmail.com>:

File and Directory Metadata
Import of RT #96

guest <silverdirk at silverdirk.com> 2004-11-24
--------------------------------------------
Subject: File and Directory Metadata

This is a clarification of the metadata feature I would like in darcs.
I'm willing to work on this, but currently have no time. I'm posting it
in case it inspires anyone else to investigate.

The feature would add metadata tags to arbitrary source files or
directories. It would allow miscelaneous data to be maintained about a
file. The properties would 'follow' a file through renames, and die
when the file was removed. The properties would be of the form
name=value, where name is a unique key (per-file) for looking up the
value.

The properties would behave much like single-line binary entries, in
that they could only have 1 value or no value, and the patching would
see "old" and "new" versions of the data (no line-based merging).

I'm using several debatable features in this example not to argue their
worth, but to show how this feature could make other features easier to
implement.

Reccomended Patch Format:

[Added foo and set unix permissions and set line type to logical
silverdirk at silverdirk.com**20041124000000] <> {
addfile ./foo
hunk ./foo 1
+blah blah blah
+blah blah blah
}
meta ./foo
+unixperm=rw-rw----
+linetype=logical
}
}
[Changed the unix perms to be executable, and added a sub-repo
silverdirk at silverdirk.com**20041124000000] <> {
meta ./foo
-unixperm=rw-rw----
+unixperm=rwxrwx---
}
adddir ./sub-project
meta ./sub-project
+is_subrepo=y
+subrepo_default_repo=http://conserv.silverdirk.com/repo/blah
}
}

Reccomended User Interface:
$ darcs add foo
$ darcs meta foo unixperm=rw-rw---- linetype=logical
$ darcs record
... etc ...
$ darcs meta foo unixperm=rwxrwx---
$ darcs get http://conserv.silverdirk.com/repo/sub-project
$ darcs add sub-project
$ darcs meta sub-project is_subrepo=y subrepo_default_repo=`cat sub-
project/_darcs/prefs/defaultrepo`
$ darcs record
... etc ...

$ darcs query meta foo sub-project --verbose
Metadata for ./foo:
unixperm = rwxrwx---
linetype = logical
Metadata for ./sub-project:
is_subrepo = y
subrepo_default_repo = http://...

$ darcs query meta foo sub-project --for-script
{foo
unixperm='rwxrwx---'
linetype='logical'
}
{sub_project
is_subrepo='y'
subrepo_default_repo='http://...
}
$ cd /tmp && darcs get /path/to/mainproj
$ darcs query meta * --for-script | (
while read fname; do
(
file="${fname/{/}";
while read attr; do
[ $attr -eq '}' ] && break;
export $attr;
done;
perl ~/bin/after-darcs.pl $file;
)
done;
)

Toss on the pre and post script, and we have Power to the People!

----------
messages: 1102
nosy: EricKow, droundy, tommy
priority: feature
status: unread
title: File and Directory Metadata
topic: FromRequestTracker

____________________________________
Darcs issue tracker <bugs at darcs.net>
<http://bugs.darcs.net/issue307>
____________________________________




More information about the darcs-devel mailing list