You are looking at historical revision 732 of this page. It may differ significantly from its current revision.
The svn-post-commit-hooks eggs|egg uses the svn-client egg to provide high-level functions useful for the creation of programs meant to run as post-commit hooks for Subversion repositories (such as svnwiki or svnblog).
The check-and-update function checks out a copy of the repository to a local directory and checks to see if there are new unprocessed commits.
(use svn-post-commit-hooks) (check-and-update ; URL of the repository "https://svn.afc.no-ip.info/svn/chicken-eggs/wiki" ; Login to authenticate "anonymous" ; Password "" ; Local path where a copy should be checked-out/updated "/tmp/repository-wiki" ; Data file where the post-commit program stores the last commit it has ; successfully processed "/tmp/data-wiki/last-revision.txt" ; Function to call if the repository has indeed changed. It receives ; two parameters, the last processed revision and the current revision. (lambda (old-revision new-revision) ...))
List all commits after a certain one
Note: the name get-log is very likely going to change in a future release of this egg.
(use stream-ext svn-post-commit-hooks) (stream->list (get-log ; Directory with the copy (check-out) of the repository: "/tmp/repository-wiki" ; Initial revision (return the log *after* the revision number specified): 0 ; Login to authenticate as: "anonymous" ; Password: ""))
List files that changed after a revision
The list-changed-files function returns an entry with the files that have changed after a certain revision. This is implemented on top of get-log, being more convenient in the general case.
(use svn-post-commit-hooks format-modular) ; Function to process the entry objects returned by list-changed files. Each ; object is an entry record corresponding to a position in the file system (a ; file or a directory). Entry records have a changes field with a list of the ; commits that affected them and a subs record with a hash-table for files in ; the current directory. (define (process-entry entry name) (format #t "Location: ~A~%" name) (format #t " Changes:~%") (for-each show-change (entry-changes entry)) ; Recursively process sub-entries (for directories): (hash-table-walk (entry-subs entry) (lambda (sub-name sub-entry) (process-entry sub-entry (string-append name "/" sub-name))))) ; Function to show one specific change, as returned by list-changed-files in ; the subs field of the entry record. (define (show-change change) (format #t " Revision: ~A~%" (change-rev change)) (format #t " Seconds (date): ~A~%" (change-seconds change)) (format #t " Data: ~A~%" (change-data change))) ; And now lets get the entry for all changes to a repository: (process-entry (list-changed-files ; The URL of the repository or a directory with a local copy: "/tmp/repository-wiki" ; A subdirectory from the repository if we only want reports for commits ; affecting that directory: "" ; Login to authenticate with: "anonymous" ; Password: "" ; Initial revision (list-changed-files will only return reports for commits ; after the one we specify): 0) "")
This egg is made by Alejandro Forero Cuervo <email@example.com>.
Copyright (C) 2006 Alejandro Forero Cuervo <firstname.lastname@example.org>
The svn-post-commit-hooks egg is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
The svn-post-commit-hooks egg is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with the svn-post-commit-hooks egg; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- First release.