On Apr 21, 2008, at 07:17, <Dominique.Holzwarth ch.delarue.com>
<Dominique.Holzwarth ch.delarue.com> wrote:
> Thank you Barry for that answer!
> I got one more thing for clarification tho:
> Do all the functions in your API return the svn
errors/messages
> (like the one you get when you try to lock a already
locked file)
> as notify events?
pysvn reflects the API of SVN itself.
Most raise an error on failure, but some you need to process
the
results or use call backs to get extra info.
You would need to ask the SVN developers for the reason.
> Maybe this is a dumb question (cause it might be stated
somewhere
> in the documentation) but I assumed that those
functions throw
> exceptions (as some of them do, but I don't think these
are the
> "svn messages"). Thats why I was a bit
confused with lock() not
> throwing an exception =)
The "messages" come from printing the values
passed to the notify
callback.
See the pysvn example client for a python replacement for
the svn
command that uses
almost ever part of pysvn.
> As a work around I'm calling the lock() function now
followed by an
> info2() to test which user is the lock owner of the
file (to see
> whether the lock() of the current user was successfull
)
Please read my previous message again. I gave you the code
to detect
the error from the notify callback.
Barry
>
> Greetings
> Dominique
>
> From: Barry Scott [mailto:barry barrys-emacs.org]
> Sent: Samstag, 19. April 2008 14:21
> To: users pysvn.tigris.org
> Subject: Re: Locking a file
>
>
> On Apr 17, 2008, at 16:12, <Dominique.Holzwarth ch.delarue.com>
> <Dominique.Holzwarth ch.delarue.com> wrote:
>
>> Hi everyone!
>>
>> I want to lock a file within my svn client so that
only one user
>> (client) has write access. I'm a bit confused about
the API
>> description tho:
>>
>> lock( url_or_path,
>> lock_comment,
>> force=False )
>>
>> Does this mean I can pass a URL (to a file on the
repository I
>> guess) OR a path (to a file on the working copy)?
But where's the
>> difference then?
>
> You can lock a file directly in the repos using the URL
without
> needed to checkout a working copy.
>
>>
>> If I give a path to a file in the working copy I
can indeed lock
>> the file (and other clients, like Tortoise for
windows see this
>> file correctly as locked). If I specifiy a URL to a
file in the
>> repo I get the following error:
>>
>> Code: 175002 Message: Lock request failed: 405
Method Not Allowed
>> (http://schbna6001)
>>
>
> You need to ask on the SVN user list what this means. I
can lock
> using PATH of URL to my HTTP server.
> Of course your SVN server needs to be of a new enough
version to
> support locking.
>
>> Another thing is:
>> If I lock the file by giving a path and then
another client
>> attempts to lock that file as well no exception is
thrown for that
>> client!
>>
>
> You need to process the notify messages that lock()
generates. Here
> is an example:
>
> import pysvn
> import pprint
>
> def notify( event ):
> print 'Notify:'
> pprint.pprint( event )
>
> c=pysvn.Client()
> c.callback_notify = notify
> c.lock( 'h
ttp://liara/svn/barrys-test-lib/trunk/fred/Norway/
> testdok.txt', comment='x', force=0 )
>
>
> And here is its output:
>
> : [1] barry emotion $ python2.5 l.py
> Notify:
> {'action': <wc_notify_action.failed_lock>,
> 'content_state': <wc_notify_state.unknown>,
> 'error': ("Path '/trunk/fred/Norway/testdok.txt'
is already locked
> by user 'fred' in filesystem
'/svn-library/barrys-test-lib/db'",
> [("Path
'/trunk/fred/Norway/testdok.txt' is already
> locked by user 'fred' in filesystem
'/svn-library/barrys-test-lib/
> db'",
> 160035)]),
> 'kind': <node_kind.unknown>,
> 'mime_type': None,
> 'path': 'testdok.txt',
> 'prop_state': <wc_notify_state.unknown>,
> 'revision': <Revision kind=number -1>}
>
> See the code that WorkBench uses for a full example:
> http://pysvn.tigris.org/svn/pysvn/trunk/pysvn/Wor
kBench/Source/
> wb_subversion_project_info.py
> around line 147
>
>
>> Would be nice if someone could clarify the lock API
for me
>>
>>
>
> Barry
>
------------------------------------------------------------
---------
To unsubscribe, e-mail: users-unsubscribe pysvn.tigris.org
For additional commands, e-mail: users-help pysvn.tigris.org
|