subversion-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Blair Zajac <bl...@orcaware.com>
Subject Re: Difference between 'svn update' and 'svn checkout'
Date Sat, 12 Nov 2011 06:29:25 GMT

On Nov 11, 2011, at 7:17 PM, Welington Rodrigues Braga wrote:

> 2011/11/12 Blair Zajac <blair@orcaware.com>:
>> On 11/11/2011 06:41 PM, Andy Levy wrote:
>>> 
>>> On Fri, Nov 11, 2011 at 21:12, Welington Rodrigues Braga
>>> <welrbraga@welrbraga.eti.br>  wrote:
>>>> 
>>>> Hi guys,
>>>> 
>>>> I've just started to use Subversion a few months ago and I am really
>>>> are asking me why I had never used it before but it is not the reason
>>>> of my contact. To be honest I am trying to to do a post-commit script
>>>> that automatically sincronizes a given workcopy when any of my users
>>>> commits their modifications to my repository.
>>>> 
>>>> Although it's is ok and working fine (at least in my simples test), I
>>>> did not put in production yet because I have a doubt that neither
>>>> Subversion manual or Google were able to answer me. I didn't find any
>>>> difference beetwen 'svn update' and 'svn checkout' commands which is
>>>> the main function of my post-commit script.
>>>> 
>>>> Nowadays I'm using 'svn checkout' and it is working, like I said, but
>>>> I'm not sure if I'm losing some functionality with this option.
>>>> 
>>>> Can anyone help me and answer my question?
>>> 
>>> svn checkout creates a new working copy.
>>> 
>>> svn update updates an existing working copy.
>> 
>> As Andy said, but there is some special behavior in checkout.  If you run
>> svn checkout on top of an existing working copy it'll work if the URL is the
>> same as the working copy URLs, but otherwise fail, so this may explain the
>> behavior you see.  But if you did
>> 
>> svn co $URL1 dir
>> svn co $URL2 dir
>> 
>> the second one would fail.
>> 
>> It's best to do something like this
>> 
>> if test -d dir; then
>>  svn up dir
>> else
>>  svn co $URL dir
>> fi
>> 
> 
> 
> Thanks Andy and Blair. I've already understood this part explained on
> manual so my doubt is considering that a working copy was created and
> populated before, it will only receive changes (never it will send or
> commit them) and aI will not modify he URL.
> 
> Considering those points. Will the behavious of both be the same or
> there are any risk of happen something wrong?

Yes, generally, there is no subcommand in the Subversion command line client that pulls and
pushes data to the Subversion server, all commands are one way for updates, the either update
the data in the working copy or the data in the repository.  So you have nothing to worry
about inadvertently pushing data to the repository with a "update" or "checkout".

Regards,
Blair


Mime
View raw message