Re: SVN MOVE don't perform a delete in some case

2010-04-16 Thread Stefan Sperling
On Fri, Apr 16, 2010 at 09:40:34AM +0200, Yann Crueghe wrote:
 Hi !

Hi!

 *Test 1 : Try to rename a directory BRANCHE to BRANCHE_1*
 
 *Command :*
 svn move --message Rename BRANCHE to BRANCHE_1 
 http://tetris.agora.msanet:16060/svn/METIER/y78amodifier/branches/BRANCHE 
 http://tetris.agora.msanet:16060/svn/METIER/y78amodifier/branches/BRANCHE_1
 
 *Hook params :*
 D y78amodifier/branches/BRANCHE/
 
 *Command result : * A repository hook failed
 svn: Commit blocked by pre-commit hook (exit code 1) with output:
 It's not allowed to rename or delete a branch.
 
 
 *Test 2 : Try to rename a directory BRANCHE to BRANCH*
 
 *Command :*
 svn move --message Rename BRANCHE to BR 
 http://tetris.agora.msanet:16060/svn/METIER/y78amodifier/branches/BRANCHE
 http://tetris.agora.msanet:16060/svn/METIER/y78amodifier/branches/BR
 
 *Hook params :*
 A y78amodifier/branches/BRANCH/
 
 *Command result : * Commit done without error.
 
 Do you think it's a bug ?

I don't know. On the surface this looks like a bug, but we need
to find out what the real problem is. For that, you'll need to
help others reproduce this problem on their own machines.

Can you try to show a list of commands that starts by creating
an empty repository, imports some files or folders, installs
the hook script, and then runs some svn commands to trigger the problem?

Thanks,
Stefan


RE: SVN MOVE don't perform a delete in some case

2010-04-16 Thread Giulio Troccoli



Linedata Services (UK) Ltd
Registered Office: Bishopsgate Court, 4-12 Norton Folgate, London, E1 6DB
Registered in England and Wales No 3027851VAT Reg No 778499447

-Original Message-


 From: Stefan Sperling [mailto:s...@elego.de]
 Sent: 16 April 2010 08:52
 To: Yann Crueghe
 Cc: users@subversion.apache.org
 Subject: Re: SVN MOVE don't perform a delete in some case

 On Fri, Apr 16, 2010 at 09:40:34AM +0200, Yann Crueghe wrote:
  Hi !

 Hi!

  *Test 1 : Try to rename a directory BRANCHE to BRANCHE_1*
 
  *Command :*
  svn move --message Rename BRANCHE to BRANCHE_1
 
 http://tetris.agora.msanet:16060/svn/METIER/y78amodifier/branches/BRAN
  CHE
 
 http://tetris.agora.msanet:16060/svn/METIER/y78amodifier/branches/BRAN
  CHE_1
 
  *Hook params :*
  D y78amodifier/branches/BRANCHE/
 
  *Command result : * A repository hook failed
  svn: Commit blocked by pre-commit hook (exit code 1) with output:
  It's not allowed to rename or delete a branch.
 
 
  *Test 2 : Try to rename a directory BRANCHE to BRANCH*
 
  *Command :*
  svn move --message Rename BRANCHE to BR
 
 http://tetris.agora.msanet:16060/svn/METIER/y78amodifier/branches/BRAN
  CHE
  http://tetris.agora.msanet:16060/svn/METIER/y78amodifier/branches/BR
 
  *Hook params :*
  A y78amodifier/branches/BRANCH/
 
  *Command result : * Commit done without error.
 
  Do you think it's a bug ?

 I don't know. On the surface this looks like a bug, but we
 need to find out what the real problem is. For that, you'll
 need to help others reproduce this problem on their own machines.

 Can you try to show a list of commands that starts by
 creating an empty repository, imports some files or folders,
 installs the hook script, and then runs some svn commands to
 trigger the problem?


I should see the whole pre-commit hook but I think you parse the list of files 
being committed and rely on some kind of order, e.g. the deletion being the 
first of the list.

I had a similar situation and I found out that (and this is documented) you can 
not rely on the order of the output of svnlook changed (or any other commands 
for that matter).

So, I think you will have to parse the whole list of files and if there is a 
delete then exit with an error.

Again, this is just hypothetical, as I don't know your pre-commit hook.

G


Re: SVN MOVE don't perform a delete in some case

2010-04-16 Thread Yann Crueghe

Hi !

Thank you very much for your quick replies !
In fact, the only thing that the hook control is that the user don't try 
to delete a directory (he can delete the content) in an other directory 
called branches


ie : myapp   /branches/my_branch/myfile.txt
/trunk/myfile.txt
/tags

The hook must block the user when he want to delete or rename 
/branches/my_branch

The user can alter the file /branches/my_branch/myfile.txt

The hook work when i try to delete the directory
The hook work when i try to rename the /branches/my_branch to 
/branches/my_branche
The hook work when i try to rename the /branches/my_branch to 
/branches/another_branch
The hook won't work when i try to rename the /branches/my_branch to 
/branches/my_bra (no svn delete perform)


Here is a partial copy of the hook (light from the original which 
control more things)


I prepare the svn commands to reproduce this comportment ASAP

Thank you very much

# sortie en erreur
function exit_error {
   echo $1 2
   exit 1
}

# sortie ok
function exit_success {
   exit 0
}


# parametres d'appels du hook
SVN_REPO_PATH=$1
SVN_TXN_ID=$2

# Binaires et fichiers de configuration du serveur SVN
SVNLOOK=/opt/CollabNet_Subversion/bin/svnlook

# Constantes
STR_BRANCHES=branches
STR_CODE_SVN_DELETE=D

# extraction de l'action et de la ressource cible
CHANGED=$($SVNLOOK changed -t $SVN_TXN_ID $SVN_REPO_PATH)
set -- $CHANGED
ACTION=$1
RESSOURCE=$2

# extraction du repertoire impacte par le commit
PATH_VARS=$(echo $RESSOURCE | tr '[:upper:]' '[:lower:]' | awk -F/ 
'{print $1,$2,$3,$4}')

set -- $PATH_VARS
APPLICATION=$1
REPERTOIRE=$2
ELEMENT=$3
CHEMIN=$4

# Securisation des branches
if [[ $REPERTOIRE = $STR_BRANCHES ]]
then   
   # Suppression sur une branche

   if [[ $ACTION = $STR_CODE_SVN_DELETE ]]
   then
   # Suppression de la branche ou du tag interdite aux dev. metier 
et responsables metier

   if [[ ! $CHEMIN ]]
   then exit_error La suppression d'une BRANCHE ou d'un TAG est 
interdite

   fi
   fi
fi

exit_success


Giulio Troccoli a écrit :



Linedata Services (UK) Ltd
Registered Office: Bishopsgate Court, 4-12 Norton Folgate, London, E1 6DB
Registered in England and Wales No 3027851VAT Reg No 778499447

-Original Message-


  

From: Stefan Sperling [mailto:s...@elego.de]
Sent: 16 April 2010 08:52
To: Yann Crueghe
Cc: users@subversion.apache.org
Subject: Re: SVN MOVE don't perform a delete in some case

On Fri, Apr 16, 2010 at 09:40:34AM +0200, Yann Crueghe wrote:


Hi !
  

Hi!



*Test 1 : Try to rename a directory BRANCHE to BRANCHE_1*

*Command :*
svn move --message Rename BRANCHE to BRANCHE_1

  

http://tetris.agora.msanet:16060/svn/METIER/y78amodifier/branches/BRAN


CHE

  

http://tetris.agora.msanet:16060/svn/METIER/y78amodifier/branches/BRAN


CHE_1

*Hook params :*
D y78amodifier/branches/BRANCHE/

*Command result : * A repository hook failed
svn: Commit blocked by pre-commit hook (exit code 1) with output:
It's not allowed to rename or delete a branch.


*Test 2 : Try to rename a directory BRANCHE to BRANCH*

*Command :*
svn move --message Rename BRANCHE to BR

  

http://tetris.agora.msanet:16060/svn/METIER/y78amodifier/branches/BRAN


CHE
http://tetris.agora.msanet:16060/svn/METIER/y78amodifier/branches/BR

*Hook params :*
A y78amodifier/branches/BRANCH/

*Command result : * Commit done without error.

Do you think it's a bug ?
  

I don't know. On the surface this looks like a bug, but we
need to find out what the real problem is. For that, you'll
need to help others reproduce this problem on their own machines.

Can you try to show a list of commands that starts by
creating an empty repository, imports some files or folders,
installs the hook script, and then runs some svn commands to
trigger the problem?




I should see the whole pre-commit hook but I think you parse the list of files 
being committed and rely on some kind of order, e.g. the deletion being the 
first of the list.

I had a similar situation and I found out that (and this is documented) you can 
not rely on the order of the output of svnlook changed (or any other commands 
for that matter).

So, I think you will have to parse the whole list of files and if there is a 
delete then exit with an error.

Again, this is just hypothetical, as I don't know your pre-commit hook.

G
  



Ce message est protégé par les règles relatives au secret des correspondances. 
Il est donc établi à destination exclusive de son destinataire. Celui-ci peut 
donc contenir des informations confidentielles. La divulgation de ces 
informations est à ce titre rigoureusement interdite. Si vous avez reçu ce 
message par erreur, merci de le renvoyer à l'expéditeur dont l'adresse e-mail 
figure ci-dessus et de détruire le message ainsi que toute pièce jointe.

This message is protected by the secrecy of correspondence rules. Therefore, 
this message is intended solely