You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by kf...@collab.net on 2005/03/13 02:28:05 UTC
'svn unlock URL' auto-force behavior
kfogel@tigris.org writes:
> Log:
> Locking branch: Support lock/unlock on URLs.
>
> * subversion/clients/cmdline/lock-cmd.c
> (svn_cl__lock): Be more flexible about finding a temp dir, now that
> we can't unconditionally depend on targets being local.
>
> * subversion/libsvn_client/locking_commands.c
> (store_head_revision): New static helper function.
> (struct lock_baton): Reorder fields to be more intuitive.
> (store_locks_callback): Handle the no-working-copy case, redocument,
> and rearrange the code a bit.
> (open_lock_targets): Renamed to...
> (organize_lock_targets): ...here, and rewritten.
> (svn_client_lock, svn_client_unlock): Handle the URL case.
Please note the following about 'svn unlock URL' below...
> --- branches/locking/subversion/libsvn_client/locking_commands.c
> +++ branches/locking/subversion/libsvn_client/locking_commands.c
> @@ -324,19 +409,34 @@
> apr_pool_t *pool)
> {
> svn_wc_adm_access_t *adm_access;
> + const char *common_parent;
> const svn_wc_entry_t *entry;
> + const char *url;
> svn_ra_session_t *ra_session;
> apr_hash_t *path_tokens;
> struct lock_baton cb;
>
> - SVN_ERR (open_lock_targets (&entry, &adm_access, &path_tokens,
> - targets, FALSE, force, ctx, pool));
> + SVN_ERR (organize_lock_targets (&common_parent, &entry, &adm_access,
> + &path_tokens, targets, FALSE, force, ctx,
> + pool));
> +
> + if (svn_path_is_url (common_parent))
> + {
> + url = common_parent;
> + /* Unlocking a URL is pointless with the 'force' flag anyway, so
> + just set it if we're operating on URLs. */
> + force = TRUE;
> + }
> + else
> + {
> + url = entry->url;
> + }
Because 'svn unlock URL' would never work without the 'force' flag
anyway, I just made that code run with 'force = TRUE' automatically.
My reasoning was that if someone types 'svn unlock URL', then they
know what they meant to do, and there's no point making them type
'--force' every time (which of course they'd eventually habituate to).
If consensus is that this is a bad idea, then it's easy to change:
just make the obvious tweak in the above code.
-Karl
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Re: 'svn unlock URL' auto-force behavior
Posted by Julian Foad <ju...@btopenworld.com>.
Peter N. Lundblad wrote:
> On Sun, 12 Mar 2005 kfogel@collab.net wrote:
>>>+ if (svn_path_is_url (common_parent))
>>>+ {
>>>+ url = common_parent;
>>>+ /* Unlocking a URL is pointless with the 'force' flag anyway, so
>>>+ just set it if we're operating on URLs. */
I think that comment was meant to say, "Trying to unlock a URL is pointless
_without_ the 'force' flag anyway, so just set it if we're operating on URLs."
Peter, if you're going to modify this code, perhaps you could fix the comment
at the same time.
>>>+ force = TRUE;
>>>+ }
>>
>>Because 'svn unlock URL' would never work without the 'force' flag
>>anyway, I just made that code run with 'force = TRUE' automatically.
>>
>>My reasoning was that if someone types 'svn unlock URL', then they
>>know what they meant to do, and there's no point making them type
>>'--force' every time (which of course they'd eventually habituate to).
>>
>
> OTOH, it will break other peoples' locks. Therefore, this usage should be
> uncommon enough that it isn't worht this inconsistency IMO. If I don't get
> objections, I may do that obvious tweak (probably before Karl gets
> back:-).
- Julian
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Re: 'svn unlock URL' auto-force behavior
Posted by "Peter N. Lundblad" <pe...@famlundblad.se>.
On Sun, 13 Mar 2005, Greg Hudson wrote:
> On Sun, 2005-03-13 at 05:42, Peter N. Lundblad wrote:
> > OTOH, it will break other peoples' locks. Therefore, this usage should be
> > uncommon enough that it isn't worht this inconsistency IMO. If I don't get
> > objections, I may do that obvious tweak (probably before Karl gets
> > back:-).
>
> Can we have it do a username match, and require --force if the unlocker
> has a different username?
This sounds like a good compromise. And it is probably not hard, just ask
the RA layers for the lock tokesn if !force. Then the FS will have the
correct tokens and just do a username check.
Thanks for pointing this out,
//Peter
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Re: 'svn unlock URL' auto-force behavior
Posted by Greg Hudson <gh...@MIT.EDU>.
On Sun, 2005-03-13 at 05:42, Peter N. Lundblad wrote:
> OTOH, it will break other peoples' locks. Therefore, this usage should be
> uncommon enough that it isn't worht this inconsistency IMO. If I don't get
> objections, I may do that obvious tweak (probably before Karl gets
> back:-).
Can we have it do a username match, and require --force if the unlocker
has a different username?
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Re: 'svn unlock URL' auto-force behavior
Posted by "Peter N. Lundblad" <pe...@famlundblad.se>.
On Sun, 12 Mar 2005 kfogel@collab.net wrote:
> kfogel@tigris.org writes:
> Please note the following about 'svn unlock URL' below...
>
> > --- branches/locking/subversion/libsvn_client/locking_commands.c
> > +++ branches/locking/subversion/libsvn_client/locking_commands.c
> > @@ -324,19 +409,34 @@
> > apr_pool_t *pool)
> > {
> > svn_wc_adm_access_t *adm_access;
> > + const char *common_parent;
> > const svn_wc_entry_t *entry;
> > + const char *url;
> > svn_ra_session_t *ra_session;
> > apr_hash_t *path_tokens;
> > struct lock_baton cb;
> >
> > - SVN_ERR (open_lock_targets (&entry, &adm_access, &path_tokens,
> > - targets, FALSE, force, ctx, pool));
> > + SVN_ERR (organize_lock_targets (&common_parent, &entry, &adm_access,
> > + &path_tokens, targets, FALSE, force, ctx,
> > + pool));
> > +
> > + if (svn_path_is_url (common_parent))
> > + {
> > + url = common_parent;
> > + /* Unlocking a URL is pointless with the 'force' flag anyway, so
> > + just set it if we're operating on URLs. */
> > + force = TRUE;
> > + }
> > + else
> > + {
> > + url = entry->url;
> > + }
>
> Because 'svn unlock URL' would never work without the 'force' flag
> anyway, I just made that code run with 'force = TRUE' automatically.
>
> My reasoning was that if someone types 'svn unlock URL', then they
> know what they meant to do, and there's no point making them type
> '--force' every time (which of course they'd eventually habituate to).
>
OTOH, it will break other peoples' locks. Therefore, this usage should be
uncommon enough that it isn't worht this inconsistency IMO. If I don't get
objections, I may do that obvious tweak (probably before Karl gets
back:-).
Regards,
//Peter
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org