You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by HAcland <hu...@googlemail.com> on 2008/07/07 08:05:12 UTC

post-commit.bat to create copy of commited file

Hi,

I need subversion to automatically create a copy of the file which was
commited in a new location on the server file system. I am aware that I
should be using the post-commit.bat hook (Server on Win 2003) but I am
unable to find the correct SVN or SVNADMIN utility to use. Moreover I do not
know how I would use the two parameters which post-commit.bat has access to,
namely: REPOS="$1" and REV="$2"

If someone could shed some light on this I would be most grateful.
Thanks in advanced
Hugh

-- 
View this message in context: http://www.nabble.com/post-commit.bat-to-create-copy-of-commited-file-tp18311887p18311887.html
Sent from the Subversion Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: post-commit.bat to create copy of commited file

Posted by Ryan Schmidt <su...@ryandesign.com>.
On Jul 7, 2008, at 05:38, HAcland wrote:

> I sort of worked out that I should be using 'svn update'. I have  
> written the
> following post-commit.bat file:
>
> D:
> cd D:[my file path]\workingCopy\
> PATH C:\Program Files\subversion\svn-win32-1.4.6\bin\;
> mkdir demoDirToShowItIsBeingRunOK
> svn update
>
> This post-commit.bat file runs fine from the command line: it  
> performs the
> svn update on the required working copy. However, when I perform a  
> commit
> from a remote PC (using Tortoise) the post-commit hook runs fine  
> (because I
> can now see a newly created directory  
> 'demoDirToShowItIsBeingRunOK') but the
> crucial 'svn update' command is not being run. I am thinking this  
> is to do
> with permissions but am a loss to explain it...

It could be that it's asking for credentials (username/password).  
These were probably already cached when you ran it from the command  
line, but when the hook script is being run it's happening as a  
different user so it doesn't have that information cached. You may  
need to supply it using the --username and --password arguments. You  
should also use the --non-interactive argument since a hook script  
cannot be interactive with the svn command. You should write the  
error output of svn update to a file so that you can examine its  
contents and see what's actually going wrong. Like (I think this  
works on Windows too):

svn update 2 > C:\[someplacethisusercanwrite]\svn.error.log



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: post-commit.bat to create copy of commited file

Posted by HAcland <hu...@googlemail.com>.
Thanks Ryan,

I sort of worked out that I should be using 'svn update'. I have written the
following post-commit.bat file:

D:
cd D:[my file path]\workingCopy\
PATH C:\Program Files\subversion\svn-win32-1.4.6\bin\;
mkdir demoDirToShowItIsBeingRunOK
svn update

This post-commit.bat file runs fine from the command line: it performs the
svn update on the required working copy. However, when I perform a commit
from a remote PC (using Tortoise) the post-commit hook runs fine (because I
can now see a newly created directory 'demoDirToShowItIsBeingRunOK') but the
crucial 'svn update' command is not being run. I am thinking this is to do
with permissions but am a loss to explain it...

any ideas?
thanks for you help,
Hugh



HAcland wrote:
> 
> Hi,
> 
> I need subversion to automatically create a copy of the file which was
> commited in a new location on the server file system. I am aware that I
> should be using the post-commit.bat hook (Server on Win 2003) but I am
> unable to find the correct SVN or SVNADMIN utility to use. Moreover I do
> not know how I would use the two parameters which post-commit.bat has
> access to, namely: REPOS="$1" and REV="$2"
> 
> If someone could shed some light on this I would be most grateful.
> Thanks in advanced
> Hugh
> 
> 

-- 
View this message in context: http://www.nabble.com/post-commit.bat-to-create-copy-of-commited-file-tp18311887p18313926.html
Sent from the Subversion Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: post-commit.bat to create copy of commited file

Posted by Ryan Schmidt <su...@ryandesign.com>.
On Jul 7, 2008, at 03:05, HAcland wrote:

> I need subversion to automatically create a copy of the file which was
> commited in a new location on the server file system. I am aware  
> that I
> should be using the post-commit.bat hook (Server on Win 2003) but I am
> unable to find the correct SVN or SVNADMIN utility to use.

Did you install Subversion, available from http:// 
subversion.tigris.org/ ? It provides the svn and svnadmin command  
line programs, among other things.

> Moreover I do not
> know how I would use the two parameters which post-commit.bat has  
> access to,
> namely: REPOS="$1" and REV="$2"

If you want to know what files were affected by the revision, you  
would call "svnlook changed" and pass it the repository location and  
the revision.


Now... Why do you want to copy files manually? Perhaps there's a  
better way to accomplish your goal. Perhaps you can simply "svn  
update" a working copy on your server after every commit. Then you  
don't have to worry about what changed, and instead you let  
Subversion handle it for you. Or if that doesn't suit you, maybe you  
can explain your use case and we can help find a good solution.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org