You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by "Miller, Eric" <Er...@amd.com> on 2008/01/18 22:09:14 UTC

FW: Post-commit script - unlock deleted [PATCH]

I don't know if anyone cares here, but there is a bug in the
remove-zombie-locks.py when the locked file is contained in a deleted
directory (as far as I can tell anyways.)

Here's a crappy patch.  I don't really know python but it seems to work
for me :D

Eric
(c) 2007 Advanced Micro Devices, Inc., all rights reserved.

> -----Original Message-----
> From: Miller, Eric
> Sent: Wednesday, January 16, 2008 9:56 AM
> To: Miller, Eric; 'Nathan Kidd'; 'users@subversion.tigris.org'
> Subject: RE: Post-commit script - unlock deleted [PATCH]
> 
> Here is a quick and dirty attempt at a patch if anyone cares.
> 
> Index: remove-zombie-locks.py
> ===================================================================
> --- remove-zombie-locks.py      (revision 28930)
> +++ remove-zombie-locks.py      (working copy)
> @@ -142,6 +145,14 @@
>      svn.core.svn_pool_destroy(self.pool)
>      svn.core.apr_terminate()
> 
> +  def unlock_nonexistant_files(self, lock, callback_pool):
> +    """check if the file still exists in HEAD, removing the lock if
> not"""
> +    if svn.fs.svn_fs_check_path(self.rev_root, lock.path,
callback_pool)
> \
> +           == svn.core.svn_node_none:
> +      print lock.path
> +      svn.repos.svn_repos_fs_unlock(self.repos_ptr, lock.path,
> lock.token,
> +                                    True, callback_pool)
> +
>    def get_deleted_paths(self):
>      """return list of deleted paths in a revision"""
>      deleted_paths = []
> @@ -157,10 +168,8 @@
>      subpool = svn.core.svn_pool_create(self.pool)
>      for path in deleted_paths:
>        svn.core.svn_pool_clear(subpool)
> -      lock = svn.fs.svn_fs_get_lock(self.fs_ptr, path, subpool)
> -      if lock:
> -        svn.repos.svn_repos_fs_unlock(self.repos_ptr, path,
> -                                      lock.token, True, subpool)
> +      svn.fs.svn_fs_get_locks(self.fs_ptr, path,
> +                              self.unlock_nonexistant_files,
self.pool)
>      svn.core.svn_pool_destroy(subpool)
> 
> > -----Original Message-----
> > From: Miller, Eric
> > Sent: Wednesday, January 16, 2008 9:47 AM
> > To: Miller, Eric; Nathan Kidd; users@subversion.tigris.org
> > Subject: RE: Post-commit script - unlock deleted
> >
> > http://svn.collab.net/repos/svn/trunk/contrib/hook-scripts/remove-
> zombie-
> > locks.py
> >
> > Hmm.. after looking at this a bit I don't think it works as a post-
> commit
> > hook script in all cases.
> >
> > For example:
> >
> > svn lock adir/afile
> > svn rm adir
> > svn ci -m 'removed adir'
> >  D   adir
> > Committed revision N
> >
> > remove-zombie-lock.py /path/to/repos N
> >
> > Does nothing when it should have unlocked adir/afile.
> >
> > It seems to work fine using 'all' though.
> >
> > Eric



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org