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

hook is called with different 'path to hook' when invoked from a working copy that uses 'file:/..' or 'svn:/..' semantic.

From: Guenter Neiss <g.neiss_at_plarad.de>
Date: Wed, 15 Jul 2009 14:19:18 +0200

I thing this is a bug, but it may be 'by design'.
Shure, using svn-semantic for a wc is preffered, so it's not a big issue...

Short description:
------------------
A hook (here pre-revprop-change) is called with different 'path to hook'
when invoked from a working copy that uses 'file:/..' or 'svn:/..' semantic.
This prevents the script to locate 'helper files' that are stored on the
same
drive as the script itself
(when called from a working copy that uses file-semantic).
See below (under Result) why this prevents the script to locate it's
'helper files'!

Environment:
------------
svn version 1.6.3 (r38063) from CollabNetSubversion-server-1.6.3-3.win32.exe
All PC's running Windows (XP or Server 2003, latest patches/service packs
applied)
A Repository is located on a Server inside the LAN.
The svn-service is running on this server.
Access to the directory containing the Repository from other computers is
permitted via 'network share'.
This share is mounted on a local PC.

Some assumtions to make describing easier:
------------------------------------------
Path to Repository as seen by the server: F:\SVN\PathTest
Path to share as seen by the server: F:\SVN\
Name of the share: SVN-Repository
Computer-Name of the server: svn
Mount point of the share on local PC: R:\

How to reproduce the bug (path's are given as seen from PC):
------------------------------------------------------------
1. Create a Repository R:\PathTest
Now create the script 'pre-revprop-change.bat' inside 'R:\PathTest\hooks'
with the content given below.
This is just a script that show's the different 'path to hook' when the hook
was called due to a request via related command.
Create a file 'R:\HelperDir\HelperFile' (content doesn't matter).

1. Create two working copies on local PC (wc path may be different):
- svn checkout file:///R:/PathTest E:\PathTest_WcUsesFile
- svn checkout svn://svn/PathTest E:\PathTest_WcUsesSVN

2. Try to change the log-message from both working copies
- cd /d E:\PathTest_WcUsesFile
  svn propset --revprop -r 2 svn:log "Just a try"
- cd /d E:\PathTest_WcUsesSVN
  svn propset --revprop -r 2 svn:log "Just a try"

Result:
-------
You will see 'path to hook' is
- R:... on first try (that is the path as seen by the PC)
- F:... on second try (that is the path as seen by the server)
The most important thing is, that on the first try the
HelperFile was NOT found by the script !
This is, because the script is realy running inside the server.
I don't know why the script get's this wrong location of itself (%~dp0).
But as stated above it prevents the script from working on wc's
that uses file-semantic.

Here is the complete output:
----------------------------
E:\>svn checkout file:///R:/PathTest E:\PathTest_WcUsesFile
...
Checked out revision ...

E:\>svn checkout svn://svn/PathTest E:\PathTest_WcUsesSVN
...
Checked out revision ...

E:\>cd /d E:\PathTest_WcUsesFile
E:\PathTest_WcUsesFile>svn propset --revprop -r 1 svn:log "Just a try"
svn: Revprop change blocked by pre-revprop-change hook (exit code 1) with
output:
HelperFilePath: R:\SVN\HelperDir\HelperFile
HelperFile not found

E:\PathTest_WcUsesFile>cd /d E:\PathTest_WcUsesSVN
E:\PathTest_WcUsesSVN>svn propset --revprop -r 1 svn:log "Just a try"
svn: Revprop change blocked by pre-revprop-change hook (exit code 1) with
output:
HelperFilePath: F:\SVN\HelperDir\HelperFile
HelperFile found

#############################################
content of pre-revprop-change.bat
#############################################
@echo off

set HelperFilePath=%~d0\SVN\HelperDir\HelperFile

@echo HelperFilePath: %HelperFilePath%>&2

if exist "%HelperFilePath%" (
 @echo HelperFile found>&2
) else (
 @echo HelperFile not found>&2
)

exit 1
#############################################

------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=1065&dsMessageId=2371457

To unsubscribe from this discussion, e-mail: [users-unsubscribe_at_subversion.tigris.org].
Received on 2009-07-15 14:25:24 CEST

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

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