You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by "Miller, Eric" <Er...@amd.com> on 2008/01/15 16:31:55 UTC
Post-commit script - unlock deleted
I know there is something floating around out there that releases locks
on deleted files using a post-commit script - can someone give me a
pointer to it?
Basically upon commit I want the ability to retain locks on files that
were modified, but release locks on files that have been deleted.
Thanks,
Eric
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
RE: Post-commit script - unlock deleted [PATCH]
Posted by "Miller, Eric" <Er...@amd.com>.
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: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
RE: Post-commit script - unlock deleted
Posted by "Miller, Eric" <Er...@amd.com>.
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@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
RE: Post-commit script - unlock deleted
Posted by "Miller, Eric" <Er...@amd.com>.
> -----Original Message-----
> From: Nathan Kidd [mailto:nathan-svn@spicycrypto.ca]
> Sent: Tuesday, January 15, 2008 10:18 AM
> To: users@subversion.tigris.org
> Subject: Re: Post-commit script - unlock deleted
>
> Miller, Eric wrote:
> > I know there is something floating around out there that releases
locks
> > on deleted files using a post-commit script - can someone give me a
> > pointer to it?
>
>
http://svn.collab.net/repos/svn/trunk/contrib/hook-scripts/remove-zombie
-
> locks.py
>
> > Basically upon commit I want the ability to retain locks on files
that
> > were modified, but release locks on files that have been deleted.
>
> Which it does.
>
> -Nathan
Thanks Nathan - I know you've sent me that link before but I couldn't
remember the name and couldn't locate it via google.
Eric
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Re: Post-commit script - unlock deleted
Posted by Nathan Kidd <na...@spicycrypto.ca>.
Miller, Eric wrote:
> I know there is something floating around out there that releases locks
> on deleted files using a post-commit script - can someone give me a
> pointer to it?
http://svn.collab.net/repos/svn/trunk/contrib/hook-scripts/remove-zombie-locks.py
> Basically upon commit I want the ability to retain locks on files that
> were modified, but release locks on files that have been deleted.
Which it does.
-Nathan
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org