Rooot.net

  • Increase font size
  • Default font size
  • Decrease font size
The first step to getting the things you want out of life is this: Decide what you want.
Home Development Code Change a SVN commit log message or date

Change a SVN commit log message or date

Most of the information stored in a SVN commit can be edited. This is the case of the message and date: edition of these values just require a simple hook.

Adding the pre-revprop-change hook to allow SVN properties edition

In your repository, create a file hooks/pre-revprop-change or simply copy file hooks/pre-revprop-change.tmpl. Then ensure read and execute rights are granted for everyone. This script will be executed whenever a property is changed. The script return value tells if a modification is allowed or not. Edit the file so it looks like:

#!/bin/sh

REPOS="$1"
REV="$2"
USER="$3"
PROPNAME="$4"
ACTION="$5"

if [ "$ACTION" = "M" -a "$PROPNAME" = "svn:log" ]; then exit 0; fi
if [ "$ACTION" = "M" -a "$PROPNAME" = "svn:date" ]; then exit 0; fi

echo "Only svn:log and svn:date revision properties can be changed" >&2
exit 1

Caution! This script allows anyone who has write access to the repository to change date and log. You may want to restrict this access by adding some check to the $USER value

Editing a SVN commit log or date

From your workcopy, you can edit a SVN commit log with:

~$ svn propset --revprop -r 25 svn:log "Bugfix 007."

To edit a date, just check the date format first:

~$ svn propget svn:date --revprop -r1
2007-04-17T22:00:19.308764Z

Then edit the svn:date property to change the date:

~$ svn propset svn:date --revprop -r1 "2007-04-18T22:00:19.308764Z"

Comments
Add New Search
valmein   |::ffff:203.132..xxx |2011-05-03 10:29:51
administrator disabled it.. how to enable it back?
pwet   |::ffff:88.191.6.xxx |2011-05-03 10:45:04
Adding a SVN hook requires you to have a privileged access to the SVN
repository... So you have to be an administrator (or ask your administrator) to
allow this kind of property change.
Tejas  - Add list of user for permission   |203.191.35.xxx |2017-04-18 16:43:09
For pre-revprop-change, I don't want all user to make changes. But a specific
list of users.
User list should more easy to maintain. Like you have an array.
Simply modify it i.e. either add or remove any user and script will work.
Write comment
Name:
Email:
 
Website:
Title:
UBBCode:
[b] [i] [u] [url] [quote] [code] [img] 
 
 
:angry::0:confused::cheer:B):evil::silly::dry::lol::kiss::D:pinch:
:(:shock::X:side::):P:unsure::woohoo::huh::whistle:;):s
:!::?::idea::arrow:
 
Please input the anti-spam code that you can read in the image.

3.26 Copyright (C) 2008 Compojoom.com / Copyright (C) 2007 Alain Georgette / Copyright (C) 2006 Frantisek Hliva. All rights reserved."