[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

[PATCH] svn-dev.el: automatic updating of Collab copyright years

From: Erik Huelsmann <ehuels_at_gmail.com>
Date: 2006-11-17 00:34:51 CET

As Kamesh pointed out, I forgot to update several copyright years in some files.

Since I use emacs, I thought I'd extend svn-dev.el with a function to
do it automatically.

Add (add-hook 'before-save-hook 'svn-update-copyright) to your .emacs
and apply this patch to your svn-dev.el and all should be automatic!

bye,

Erik.

Index: ../trunk/tools/dev/svn-dev.el
===================================================================
--- ../trunk/tools/dev/svn-dev.el (revision 22313)
+++ ../trunk/tools/dev/svn-dev.el (working copy)
@@ -6,6 +6,21 @@
 ;;
 ;; All this stuff should get folded into Emacs VC mode, really.

+(defun svn-update-copyright ()
+ "Update the copyright at the top of the file."
+ (interactive)
+ (save-excursion
+ (goto-char (point-min))
+ (let ((start (point)))
+ (search-forward "*/")
+ (save-restriction
+ (narrow-to-region start (point))
+ (goto-char (point-min))
+ (replace-regexp "Copyright (c) \\([0-9]+\\)\\(-[0-9]+\\)? CollabNet"
+ (format "Copyright (c) \\1-%s CollabNet"
+ (format-time-string "%Y" (current-time))))))))
+
+
 (defun svn-revert ()
   "Revert the current buffer and its file to its svn base revision."
   (interactive)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Fri Nov 17 00:35:08 2006

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.