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

Re: How to lock a file?

From: Peter N. Lundblad <peter_at_famlundblad.se>
Date: 2005-10-08 22:22:07 CEST

On Sat, 8 Oct 2005, Andreas Podgurski wrote:

> svn_error_t *pError = NULL;
> apr_array_header_t *pTargets;
> const char *pUTF8File;
> svn_path_cstring_to_utf8(&pUTF8File,pFile,pLocalPool);
> pTargets = apr_array_make(pLocalPool,1,sizeof(const char *));
> APR_ARRAY_PUSH(pTargets,const char *) = pUTF8File;
> if((pError =
> svn_client_lock(pTargets,pComment,bSteal,pRuntime->pContext,pLocalPool)) !=
> throw CollectError(pError,__FILE__,__LINE__);
> Calling this throws an error "Working copy
> 'C:\Development\Subversion\VAGE\Testdaten\Mauscursor' locked". Funnily, the
> path is truncated by its suffix. So, now my questions are:

That's normal. IN the working copy, only directories are locked for
serialized access to the admin directory.

> - Why does it return this error message?

Hard to say without knowing what else your program is doing. Is it doing
something else before this svn_client_lock call that might keep a
write-lock on the WC. (You add a breakpoint in a debugger and run svn
status right before this call).

> - In the SDK-manual, it reads about paths only, but locks are possible to
> files only. Do paths mean file-paths and not directory-paths in this case?

When we say "path" that doesn't imply a directory. A path is a sequence of
names pointing at a directory entry; file or directory. For locks, this
only applies to files.

> - Have I missed something to get it correctly working? In the cmdline tool,
> it pushes the options on the array, while I'm building it by hand.
Your way of building up the array should be fine AFAICT.

Hope this helps,

To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Sat Oct 8 22:25:35 2005

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.