You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by Larry Martell <la...@gmail.com> on 2007/05/21 23:37:54 UTC
Allowing checkout of a file, but preventing checking
We have a situation where we need to keep a template version of
a file under SVN control, and allow users to checkout this template
into their working copy. We want them to be able to modify this
file in their working copy, but we do not want them to be able to
check their changes to this file back in. Is there any way to
achieve this with SVN? (We can't set svn:needs-lock and then
lock the file because then it gets checked out read-only).
Thanks!
-larry
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Re: Allowing checkout of a file, but preventing checking
Posted by Hari Kodungallur <hk...@gmail.com>.
Either way works. It could be that File.txt is user specific, in which case
there is no point in allowing a user to check that in.
Also, I presume you meant pre-commit and not post-commit. By the time
post-commit is called, file is already committed.
On 5/21/07, Matt Sickler <cr...@gmail.com> wrote:
>
> The correct way to do a one-time-commit (so to speak) of File.txt is
> to commit the default version as File.txt.tmpl and then not allow any
> commits to it with a post-commit hook.
> Then allow the users to copy File.txt.tmpl to File.txt and then modify
> that.
>
> On 5/21/07, Hari Kodungallur <hk...@gmail.com> wrote:
> >
> > On 5/21/07, Larry Martell <la...@gmail.com> wrote:
> > > We have a situation where we need to keep a template version of
> > > a file under SVN control, and allow users to checkout this template
> > > into their working copy. We want them to be able to modify this
> > > file in their working copy, but we do not want them to be able to
> > > check their changes to this file back in. Is there any way to
> > > achieve this with SVN? (We can't set svn:needs-lock and then
> > > lock the file because then it gets checked out read-only).
> >
> >
> > You can do this in a the pre-commit hook. If the template file is in
> > /trunk/mytemplates/file.tmpl, then you can reject a check-in if the
> incoming
> > file list has the path /trunk/mytemplates/file.tmpl.
> >
> > You could possibly also include a check to see if the 'author' of the
> > transaction is a certain user who is 'privileged. And that user may be
> able
> > to check-in the file. Without this check, if the user who controls the
> > template file has to check-in a modification, that will be rejected as
> well.
>
rgds
-Hari Kodungallur
Re: Allowing checkout of a file, but preventing checking
Posted by Matt Sickler <cr...@gmail.com>.
The correct way to do a one-time-commit (so to speak) of File.txt is
to commit the default version as File.txt.tmpl and then not allow any
commits to it with a post-commit hook.
Then allow the users to copy File.txt.tmpl to File.txt and then modify that.
On 5/21/07, Hari Kodungallur <hk...@gmail.com> wrote:
>
> On 5/21/07, Larry Martell <la...@gmail.com> wrote:
> > We have a situation where we need to keep a template version of
> > a file under SVN control, and allow users to checkout this template
> > into their working copy. We want them to be able to modify this
> > file in their working copy, but we do not want them to be able to
> > check their changes to this file back in. Is there any way to
> > achieve this with SVN? (We can't set svn:needs-lock and then
> > lock the file because then it gets checked out read-only).
>
>
> You can do this in a the pre-commit hook. If the template file is in
> /trunk/mytemplates/file.tmpl, then you can reject a check-in if the incoming
> file list has the path /trunk/mytemplates/file.tmpl.
>
> You could possibly also include a check to see if the 'author' of the
> transaction is a certain user who is 'privileged. And that user may be able
> to check-in the file. Without this check, if the user who controls the
> template file has to check-in a modification, that will be rejected as well.
>
> regards,
> -Hari Kodungallur
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Re: Allowing checkout of a file, but preventing checking
Posted by Chaim Keren Tzion <ch...@intercomp.co.il>.
On Tuesday 22 May 2007 15:31, Larry Martell wrote:
> On 5/21/07, Hari Kodungallur <hk...@gmail.com> wrote:
> > On 5/21/07, Larry Martell <la...@gmail.com> wrote:
> > > We have a situation where we need to keep a template version of
> > > a file under SVN control, and allow users to checkout this template
> > > into their working copy. We want them to be able to modify this
> > > file in their working copy, but we do not want them to be able to
> > > check their changes to this file back in. Is there any way to
> > > achieve this with SVN? (We can't set svn:needs-lock and then
> > > lock the file because then it gets checked out read-only).
> >
> > You can do this in a the pre-commit hook. If the template file is in
> > /trunk/mytemplates/file.tmpl, then you can reject a check-in if the
> > incoming file list has the path /trunk/mytemplates/file.tmpl.
> >
> > You could possibly also include a check to see if the 'author' of the
> > transaction is a certain user who is 'privileged. And that user may be
> > able to check-in the file. Without this check, if the user who controls
> > the template file has to check-in a modification, that will be rejected
> > as well.
>
> Thanks. That is what we ended up doing.
>
> -larry
Similar to the solution in the FAQ:
http://subversion.tigris.org/faq.html#ignore-commit
>
> ---------------------------------------------------------------------
> 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
Re: Allowing checkout of a file, but preventing checking
Posted by Larry Martell <la...@gmail.com>.
On 5/21/07, Hari Kodungallur <hk...@gmail.com> wrote:
>
>
> On 5/21/07, Larry Martell <la...@gmail.com> wrote:
> > We have a situation where we need to keep a template version of
> > a file under SVN control, and allow users to checkout this template
> > into their working copy. We want them to be able to modify this
> > file in their working copy, but we do not want them to be able to
> > check their changes to this file back in. Is there any way to
> > achieve this with SVN? (We can't set svn:needs-lock and then
> > lock the file because then it gets checked out read-only).
>
>
> You can do this in a the pre-commit hook. If the template file is in
> /trunk/mytemplates/file.tmpl, then you can reject a check-in if the incoming
> file list has the path /trunk/mytemplates/file.tmpl.
>
> You could possibly also include a check to see if the 'author' of the
> transaction is a certain user who is 'privileged. And that user may be able
> to check-in the file. Without this check, if the user who controls the
> template file has to check-in a modification, that will be rejected as well.
Thanks. That is what we ended up doing.
-larry
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Re: Allowing checkout of a file, but preventing checking
Posted by Hari Kodungallur <hk...@gmail.com>.
On 5/21/07, Larry Martell <la...@gmail.com> wrote:
>
> We have a situation where we need to keep a template version of
> a file under SVN control, and allow users to checkout this template
> into their working copy. We want them to be able to modify this
> file in their working copy, but we do not want them to be able to
> check their changes to this file back in. Is there any way to
> achieve this with SVN? (We can't set svn:needs-lock and then
> lock the file because then it gets checked out read-only).
You can do this in a the pre-commit hook. If the template file is in
/trunk/mytemplates/file.tmpl, then you can reject a check-in if the incoming
file list has the path /trunk/mytemplates/file.tmpl.
You could possibly also include a check to see if the 'author' of the
transaction is a certain user who is 'privileged. And that user may be able
to check-in the file. Without this check, if the user who controls the
template file has to check-in a modification, that will be rejected as well.
regards,
-Hari Kodungallur
RE: Re: Allowing checkout of a file, but preventing checking
Posted by Andrew R Feller <af...@lsu.edu>.
Larry,
Just store the files that fall within this situation in a special
directory and apply read-only permission to it. If you are using Apache
to serve Subversion, then it should deny any request to write to the
directory and any of the files in it.
Otherwise, you will need to either implement the start-commit or
pre-commit hooks to refuse committing changes to a set of files or a
directory.
Hope this helps,
A-
Andrew R Feller, Analyst
Subversion Administrator
University Information Systems
Louisiana State University
afelle1@lsu.edu
(office) 225.578.3737
-----Original Message-----
From: Larry Martell [mailto:larry.martell@gmail.com]
Sent: Tuesday, May 22, 2007 7:33 AM
To: Subversion List
Subject: Re: Allowing checkout of a file, but preventing checking
Please reply to the list and not to me directly.
On 5/21/07, Kevin Grover <ke...@kevingrover.net> wrote:
>
>
> On 5/21/07, Larry Martell <la...@gmail.com> wrote:
> > We have a situation where we need to keep a template version of
> > a file under SVN control, and allow users to checkout this template
> > into their working copy. We want them to be able to modify this
> > file in their working copy, but we do not want them to be able to
> > check their changes to this file back in. Is there any way to
> > achieve this with SVN? (We can't set svn:needs-lock and then
> > lock the file because then it gets checked out read-only).
> >
> > Thanks!
> > -larry
> >
>
> The normal way of doing this is to check in a template file and
instruct
> users to copy that to the actual name when they check out for the
first
> time, then ignore that name.
>
> Example
> .../svn/repo/conf/myapp.conf.tmpl
> .../svn/repo/conf[svn:ignore contains 'myapp.conf']
>
> When they first check it out, they manually copy the myapp.conf.tmpl
to
> myapp.conf and modify it all they want. Since it's ignored, it will
not be
> included on check-ins**
>
> ** It can still be checked in/committed if explicitly asked for (on
the
> command line for example). You could prevent this with hook scripts.
If I could get the users to follow directions this would work, but
unfortunately they don't, so this needs to be an automatic solution.
-larry
---------------------------------------------------------------------
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
Re: Allowing checkout of a file, but preventing checking
Posted by Larry Martell <la...@gmail.com>.
Please reply to the list and not to me directly.
On 5/21/07, Kevin Grover <ke...@kevingrover.net> wrote:
>
>
> On 5/21/07, Larry Martell <la...@gmail.com> wrote:
> > We have a situation where we need to keep a template version of
> > a file under SVN control, and allow users to checkout this template
> > into their working copy. We want them to be able to modify this
> > file in their working copy, but we do not want them to be able to
> > check their changes to this file back in. Is there any way to
> > achieve this with SVN? (We can't set svn:needs-lock and then
> > lock the file because then it gets checked out read-only).
> >
> > Thanks!
> > -larry
> >
>
> The normal way of doing this is to check in a template file and instruct
> users to copy that to the actual name when they check out for the first
> time, then ignore that name.
>
> Example
> .../svn/repo/conf/myapp.conf.tmpl
> .../svn/repo/conf[svn:ignore contains 'myapp.conf']
>
> When they first check it out, they manually copy the myapp.conf.tmpl to
> myapp.conf and modify it all they want. Since it's ignored, it will not be
> included on check-ins**
>
> ** It can still be checked in/committed if explicitly asked for (on the
> command line for example). You could prevent this with hook scripts.
If I could get the users to follow directions this would work, but
unfortunately they don't, so this needs to be an automatic solution.
-larry
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org