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

Re: restrict copy from to

From: Russell E Glaue <rglaue_at_cait.org>
Date: 2007-05-09 17:03:27 CEST

I discovered the answer to my own question

svnlook changed --copy-info -t <transaction> <repos>

  --copy-info : show details for copies

So I wrote a pre-commit hook to output this information for a transaction in
which I copied from two locations. And here is that output:

==============================
   DATE: 2007/05/09-09:52:09
  REPOS: /data/subversion/testing
    TXN: 2s

--
A + live/banana/tags/1.00.000/
     (from trunk/banana/:r97)
A + live/banana/tags/1.01.000/
     (from live/banana/staged/:r97)
--
So --copy-info tell me where it was copied from while I am still in the 
transaction, and before the actual commit.
So now I just write very something simple to enforce, if content is added to 
live_tag_location, and copy_from_location is not an allowed source_location, 
then do not allow the commit.
-RG
Russell E Glaue wrote:
> Okay, let be a little more descriptive.
> 
> Let's say I create a branch called 'mirrored' with two subbranches 
> 'staged' and 'live'.
> This is in addition to the 'trunk'.
> So I have this:
> 
> /trunk/
> -------RealContent
> -------file1.txt
> /mirrored/
> ----------staged/RealContent
> ----------live/ver-1/RealContent
> ----------live/ver-2/RealContent
> ----------live/ver-3/RealContent
> 
> Now I am going to mirror the branch 'mirrored' to a svn repos on another 
> server.
> And I am going to deploy a 'ver-N' tag in the subbranch 'live' from that 
> remote svn repos using 'svn switch' command.
> '/mirrored/live/ver-N' are tags of various versions of '/mirrored/staged'
> 
> Now everyone knows that 'svn switch' will not work unless there is a 
> common ancestry.
> So, since I am mirroring only '/mirrored/' branch to the remote server, 
> in order to perform 'svn switch' with say '/mirrored/live/ver-1' to 
> '/mirrored/live/ver-2' the common ancestry must be from within 
> '/mirrored/'.
> I have chosen the common ancestry to be '/mirrored/staged' which gets 
> tagged out to an appropriate ver-N tag in '/mirrored/live'.
> 
> This means 'svn switch' will NOT work if the content of 
> '/mirrored/live/ver-N' has an immediate ancestry in '/trunk/'.
> 
> Therefore, I want to restrict any 'svn copy' commands to 
> '/mirrored/live' to only allow a copy from '/mirrored/staged'
> 
> This would force developers to copy/merge/import changes to 
> '/mirrored/staged' in order to tag it out to '/mirrored/live/ver-N'
> 
> 
> I know svn history can be used to find ancestry of a file or directory 
> which you can compare to discover a COPY.
> However, since I want to deny the COPY command to be successful if the 
> ancestry is not from an approved location, I need to know the ancestry 
> of a file as it is found in the transaction.
> 
> What tool command will tell me this?
> 
> looking at the transaction, I could see that the following might be 
> occurring:
>  A  /mirrored/live/ver-5/file1.txt
> But it does not tell me if that file1.txt is new, copied from 
> /mirrored/staged, or copied from /trunk/.
> 
> What tool command can I use to tell me (or help me find out) that this 
> file is being copied from '/mirrored/staged' and not some other 
> location? I want to do this during the transaction, then allow or deny 
> the commit based on this.
> 
> -RG
> 
> 
> 
> Russell E Glaue wrote:
>> Has anyone tried this before?
>>
>> Say I have a svn repos with a branch and trunk like this
>>
>> /repos/
>> -------trunk/calc1/lib/eng1/af
>> -------trunk/calc1/lib/eng1/zz
>> -------branches/calc1-lib-eng-af
>> -------branches/calc1-lib-eng-zz
>>
>> And I want to restrict any "copy" from "branches/calc1-lib-eng-af" to 
>> "trunk/calc1/lib/eng1/af" only.
>>
>> So a committer who has commit access to all of branches and trunk 
>> would not be able to perform this funtion:
>>
>> svn copy branches/calc1-lib-eng-zz/file1.txt 
>> trunk/calc1/lib/eng1/af/file1.txt
>>
>> This is a hypothetical scenerio.
>>
>>
>> What can I use to discover the copy history in a transaction?
>> svnlook?
>> How can this show me it is a copy from an allowed or not allowed source?
>>
>> -RG
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
>> For additional commands, e-mail: users-help@subversion.tigris.org
>>
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
> For additional commands, e-mail: users-help@subversion.tigris.org
> 
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Received on Wed May 9 17:03:55 2007

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.