diff --git a/.git-rcs-keywords/.git_filters/rcs-keywords.clean b/.git-rcs-keywords/.git_filters/rcs-keywords.clean new file mode 100755 index 00000000000..175f972979c --- /dev/null +++ b/.git-rcs-keywords/.git_filters/rcs-keywords.clean @@ -0,0 +1,13 @@ +#!/usr/bin/perl -p +# +# @brief Git filter to implement rcs keyword expansion as seen in cvs and svn. +# @author Martin Turon +# +# Copyright (c) 2009-2011 Turon Technologies, Inc. All rights reserved. + +s/\$Id[^\$]*\$/\$Id\$/; +s/\$Date[^\$]*\$/\$Date\$/; +s/\$Author[^\$]*\$/\$Author\$/; +s/\$Source[^\$]*\$/\$Source\$/; +s/\$File[^\$]*\$/\$File\$/; +s/\$Revision[^\$]*\$/\$Revision\$/; diff --git a/.git-rcs-keywords/.git_filters/rcs-keywords.smudge b/.git-rcs-keywords/.git_filters/rcs-keywords.smudge new file mode 100755 index 00000000000..e83c166c132 --- /dev/null +++ b/.git-rcs-keywords/.git_filters/rcs-keywords.smudge @@ -0,0 +1,49 @@ +#!/usr/bin/perl +# +# @brief Git filter to implement rcs keyword expansion as seen in cvs and svn. +# @author Martin Turon +# +# Usage: +# .git_filter/rcs-keywords.smudge file_path < file_contents +# +# To add keyword expansion: +# /.gitattributes - *.c filter=rcs-keywords +# /.git_filters/rcs-keywords.smudge - copy this file to project +# /.git_filters/rcs-keywords.clean - copy companion to project +# ~/.gitconfig - add [filter] lines below +# +# [filter "rcs-keywords"] +# clean = .git_filters/rcs-keywords.clean +# smudge = .git_filters/rcs-keywords.smudge %f +# +# Copyright (c) 2009-2011 Turon Technologies, Inc. All rights reserved. + +$path = shift; +$path =~ /.*\/(.*)/; +$filename = $1; + +if (0 == length($filename)) { + $filename = $path; +} + +# Need to grab filename and to use git log for this to be accurate. +$rev = `git log -- $path | head -n 3`; +$rev =~ /^Author:\s*(.*)\s*$/m; +$author = $1; +$author =~ /\s*(.*)\s*<.*/; +$name = $1; +$rev =~ /^Date:\s*(.*)\s*$/m; +$date = $1; +$rev =~ /^commit (.*)$/m; +$ident = $1; + +while () { + s/\$Date[^\$]*\$/\$Date: $date \$/; + s/\$Author[^\$]*\$/\$Author: $author \$/; + s/\$Id[^\$]*\$/\$Id: $filename | $date | $name \$/; + s/\$File[^\$]*\$/\$File: $filename \$/; + s/\$Source[^\$]*\$/\$Source: $path \$/; + s/\$Revision[^\$]*\$/\$Revision: $ident \$/; +} continue { + print or die "-p destination: $!\n"; +} diff --git a/.git-rcs-keywords/.gitattributes b/.git-rcs-keywords/.gitattributes new file mode 100644 index 00000000000..e9d188a2ccd --- /dev/null +++ b/.git-rcs-keywords/.gitattributes @@ -0,0 +1,8 @@ +# .gitattributes +# Map file extensions to git filters + +*.h filter=rcs-keywords +*.c filter=rcs-keywords +*.cc filter=rcs-keywords +*.m filter=rcs-keywords +*.mm filter=rcs-keywords diff --git a/.git-rcs-keywords/.gitconfig b/.git-rcs-keywords/.gitconfig new file mode 100644 index 00000000000..e504b510aa4 --- /dev/null +++ b/.git-rcs-keywords/.gitconfig @@ -0,0 +1,11 @@ + +[alias] + co = checkout + ci = commit -a + +# To add keyword expansion: +# git init +# cp ~/.gitconfig, /.gitattributes, and /.git_filters +[filter "rcs-keywords"] + clean = .git_filters/rcs-keywords.clean + smudge = .git_filters/rcs-keywords.smudge %f diff --git a/.git-rcs-keywords/README b/.git-rcs-keywords/README new file mode 100644 index 00000000000..268f29ee0ba --- /dev/null +++ b/.git-rcs-keywords/README @@ -0,0 +1,28 @@ + +This module provides a means to add keyword expansion of the following +standard RCS tags to your git projects: + + $Id$ + $Date$ + $File$ + $Author$ + $Revision$ + $Source$ + +The mechanism used are filters. The smudge filter is run on checkout, and the +clean filter is run on commit. The tags are only expanded on the local disk, +not in the repository itself. + +To start, you need to add the following to ~/.gitconfig: + +[filter "rcs-keywords"] + clean = .git_filters/rcs-keywords.clean + smudge = .git_filters/rcs-keywords.smudge %f + +Then, to add keyword expansion, simply add these files to your project: + /.gitattributes - *.c filter=rcs-keywords + /.git_filters/rcs-keywords.smudge - copy this file to project + /.git_filters/rcs-keywords.clean - copy companion to project + +Note: This feature is known not to work in git 1.6.2.2 and 1.7.3.*, and + verified to work in git 1.7.4.4 and 1.7.4.msysgit.0 diff --git a/.git-rcs-keywords/hello.c b/.git-rcs-keywords/hello.c new file mode 100644 index 00000000000..21bb0c79a3c --- /dev/null +++ b/.git-rcs-keywords/hello.c @@ -0,0 +1,14 @@ +/** + * @file hello.c + * @author @$Author$ + * @date @$Date$ + * @version @$Revision$ + * + * $Id$ + */ + +#include "stdio.h" + +int main(int argc, char *argv[]) + printf("Hello, world!"); +} diff --git a/.gitattributes b/.gitattributes index 5b1ef5f047a..d99a946953b 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,13 +1,21 @@ # see man gitattributes # Map file extensions to git filters -# See .git-keywords directory and .gitconfig -*.h filter=kw -*.hpp filter=kw -*.c filter=kw -*.cpp filter=kw -*.py filter=kw -*.am filter=kw -*.m filter=kw +# See .git-keywords directory for kw filter, and .gitconfig +#*.h filter=kw +#*.hpp filter=kw +#*.c filter=kw +#*.cpp filter=kw +#*.py filter=kw +#*.am filter=kw +#*.m filter=kw +# See .git-rcs-keywords/.git_filters directory for filters, and .gitconfig +*.h filter=rcs-keywords +*.hpp filter=rcs-keywords +*.c filter=rcs-keywords +*.cpp filter=rcs-keywords +*.py filter=rcs-keywords +*.am filter=rcs-keywords +*.m filter=rcs-keywords diff --git a/.gitconfig b/.gitconfig index 691dd89c604..32e82d2f9ba 100644 --- a/.gitconfig +++ b/.gitconfig @@ -1,4 +1,10 @@ # See .git-keywords directory for README -[filter "kw"] - clean = .git-keywords/kwclean - smudge = .git-keywords/kwset +#[filter "kw"] +# clean = .git-keywords/kwclean +# smudge = .git-keywords/kwset + +# See .git-rcs-keywords for README +[filter "rcs-keywords"] + clean = .git-rcs-keywords/.git_filters/rcs-keywords.clean + smudge = .git-rcs-keywords/.git_filters/rcs-keywords.smudge %f + diff --git a/scripts/Makefile.am b/scripts/Makefile.am index bb8db6ecb69..cd47148a333 100644 --- a/scripts/Makefile.am +++ b/scripts/Makefile.am @@ -320,6 +320,9 @@ fsgdfPlot.tcl endif if SMALL_DIST_INSTALL +tktoolsdir = $(prefix)/tktools +tktools_SCRIPTS= \ +tkregister2.tcl else tktoolsdir = $(prefix)/tktools tktools_SCRIPTS= \