Subversion Input Filters

From NAMIC Wiki
Revision as of 13:16, 18 December 2006 by Andy (talk | contribs) (Update from Wiki)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
Home < Subversion Input Filters

Subversion allows filtering of files that are commited allowing to verfiy validity of certain things. This can be used to do the commit checks for tabs, new-lines, ...

To enable this feature, create a file:

/path/to/subversion/tree/hooks/pre-commit

There should already be already directory hooks with several files in them.

I used python to write a pre-commit hook, but in general you can use anything.

In the script, the first argument is repository (REPOS) and the second number is a transaction number (TXN). With these two arguments, you can call command svnlook. For example:

 svnlook command -t "TXN" "REPOS" args

Some commands are:

  • log - Get log information (this is comment given when doing commit)
  • author - Get author information
  • changed - List of files that were changed
  • dirs-changed - List of directories that changed
  • date - Time of commit
  • diff - List of changes in diff format
  • info - Get all the information about the commit (but diff)
  • cat - Display the file after the change
  • history - Display the history
  • tree - Display the tree hierarchy