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

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

From: Miller, Eric <Eric.Miller_at_amd.com>
Date: Wed, 16 Jan 2008 08:56:00 -0800

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: users-unsubscribe_at_subversion.tigris.org
For additional commands, e-mail: users-help_at_subversion.tigris.org
Received on 2008-01-16 18:04:13 CET

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

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