logo       
Google Custom Search
    AddThis Social Bookmark Button
-->

[darcs #96] File and Directory Metadata: msg#00251

Subject: [darcs #96] File and Directory Metadata
Wed Nov 24 19:23:45 2004: New ticket: 96.
Transaction: Ticket created by guest
       Queue: Darcs
     Subject: File and Directory Metadata
       Owner: Nobody
  Requestors: silverdirk@xxxxxxxxxxxxxx
      Status: new
 Ticket <URL: http://bugs.darcs.net/.//Ticket/Display.html?id=96 >

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@xxxxxxxxxxxxxx**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@xxxxxxxxxxxxxx**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!


<Prev in Thread] Current Thread [Next in Thread>