You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Dmitry Pavlenko <pa...@tmatesoft.com> on 2012/04/24 13:55:37 UTC

update without changes: broken lock removed, no notifications generated

Hello.

(Tried with SVN r1297653)

Please, consider the following scenario:
We have a clean working copy at the latest revision (say, r1) with one file.

1. Set lock on a file file locally
wc$ svn lock file
......

2. Unset lock on the file remotely
wc$ svn unlock file:///url/for/file
......

As result the lock is broken

wc$ svn status -u file
     B           1   file                                                                                                                                                                                  
Status against revision:      1 

3. Let's update to the latest revision (r1) now.

wc$ svn update
Updating '.':                                                                                                                                                                                              
At revision 1.

wc$ svn status -u file                                                                                                   
Status against revision:      1



So the lock is removed. Actually "notify" function of SVN was called only twice for update start and 
for update end (both for working copy path, none for path to the file).

Here's why it happens. update_editor.c , function "close_file". Notification condition looks like

if (eb->notify_func && !fb->already_notified && fb->edited) {
...
}

fb->edited is false here because the update didn't change contents or properties, so the notification 
is not generated even though "lock_state" is not unchanged.

For SVN 1.6.9 the same condition looks like


  if (((content_state != svn_wc_notify_state_unchanged) ||
       (prop_state != svn_wc_notify_state_unchanged) ||
       (lock_state != svn_wc_notify_lock_state_unchanged) ||
       (fb->tree_conflicted))
      && eb->notify_func
      /* Supress notifications for files within locally deleted trees,
         we will have already raised a tree conflict notification.
        ### When is FB->PATH absolute? Will we ever use the wrong key? */
      && !in_deleted_tree(eb, fb->path, TRUE, pool))

that seems to be more reasonable with respect to "lock_state" processing.

So I propose to add   (lock_state != svn_wc_notify_lock_state_unchanged) condition somewhere to SVN 
1.7 (maybe not only to close_file but to close_directory too).

RE: update without changes: broken lock removed, no notifications generated

Posted by Bert Huijben <be...@qqmail.nl>.

> -----Original Message-----
> From: MARTIN PHILIP [mailto:codematters@ntlworld.com] On Behalf Of Philip
> Martin
> Sent: dinsdag 24 april 2012 14:48
> To: Dmitry Pavlenko
> Cc: dev@subversion.apache.org
> Subject: Re: update without changes: broken lock removed, no notifications
> generated
> 
> Dmitry Pavlenko <pa...@tmatesoft.com> writes:
> 
> > So I propose to add (lock_state != svn_wc_notify_lock_state_unchanged)
> > condition somewhere to SVN 1.7
> 
> Sounds reasonable.  Are you going to write a patch?  How about extending
> lock_tests.py:defunct_lock, or write a new test, to check the
> notification?
> 
> >(maybe not only to close_file but to close_directory too).
> 
> Does that achieve anything?  Directories can't be locked.  I suppose an
> update could change a locked file into a directory but that gives 'D'
> notification for the file and 'A' for the directory.

This is a specific case where the update editor retrieves just
non-operational changes for the file (if there were operational changes it
would have the edited flag would be true).

I agree that this should have been notified in one way or another. But not
in 100% the same way as 1.6, as that triggered tree conflicts if the node or
a parent was shadowed by a delete or replace. (That was the reason to
introduce the edited flag)

	Bert 


Re: update without changes: broken lock removed, no notifications generated

Posted by Dmitry Pavlenko <pa...@tmatesoft.com>.
No, I'm not going to write a patch. Pointing to a certain line with a problem is the best I can do 
so far.

> Dmitry Pavlenko <pa...@tmatesoft.com> writes:
> > So I propose to add (lock_state != svn_wc_notify_lock_state_unchanged)
> > condition somewhere to SVN 1.7
> 
> Sounds reasonable.  Are you going to write a patch?  How about extending
> lock_tests.py:defunct_lock, or write a new test, to check the
> notification?
> 
> >(maybe not only to close_file but to close_directory too).
> 
> Does that achieve anything?  Directories can't be locked.  I suppose an
> update could change a locked file into a directory but that gives 'D'
> notification for the file and 'A' for the directory.

Re: update without changes: broken lock removed, no notifications generated

Posted by Philip Martin <ph...@wandisco.com>.
Dmitry Pavlenko <pa...@tmatesoft.com> writes:

> So I propose to add (lock_state != svn_wc_notify_lock_state_unchanged)
> condition somewhere to SVN 1.7

Sounds reasonable.  Are you going to write a patch?  How about extending
lock_tests.py:defunct_lock, or write a new test, to check the
notification?

>(maybe not only to close_file but to close_directory too).

Does that achieve anything?  Directories can't be locked.  I suppose an
update could change a locked file into a directory but that gives 'D'
notification for the file and 'A' for the directory.

-- 
uberSVN: Apache Subversion Made Easy
http://www.uberSVN.com