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

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

From: Miller, Eric <Eric.Miller_at_amd.com>
Date: Fri, 18 Jan 2008 14:09:14 -0800

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_at_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_at_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_at_subversion.tigris.org
For additional commands, e-mail: dev-help_at_subversion.tigris.org
Received on 2008-01-18 23:19:09 CET

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.