You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Karl Fogel <kf...@newton.ch.collab.net> on 2002/04/05 00:16:39 UTC

Aha! How to have file locking without file locking.

     [Warning: this is a blue-sky, post-1.0 plan.  If you only
      want to read about immediately important stuff, stop now.]

Just had an idea for how to get the advantages of file locking without
having to implement file locking.  More accurately, call it an answer
to cvs watch/edit, but without all the the pain for the user.

(Frankly, I'm taking the time describe it right now in case some bozo
has the same idea and tries to patent it.  I doubt that it's
patentable, but then, I doubted "business methods" were patentable
too.  Can't be too careful these days, sigh.)

Subversion has pristine text-bases of all files, which makes it
efficient to determine local modifications.  No conversation with the
repository is necessary.  So...

Imagine a program "svn-watchd", a watch daemon, that scans all known
working copies (more on that below) in a regular cycle, then sleeps a
bit, then scans again.  Whenever it detects a modification, it
communicates that to a central database in the repos corresponding to
that working copy.  When I say "communicates that", I mean not just
which file, but the modified byte-ranges too, like a skeleton svndiff
without the new_data.

Meanwhile, everyone else's watch daemons are doing the same thing.
Whenever a byte-range overlap in the same file is detected (or perhaps
just a file overlap, depending on the strictness setting), the two
parties are notified by email, and/or by having the file set read-only
along with an explanatory note, by having special ringing on their
cell phones, or whatever.

How does `svn-watchd' get started?  Well, you can start it manually,
but most people who want real-time conflict warnings will have
Subversion itself start the watchd, using the appropriate config
option in ~/.subversion/watches or something.  Perhaps if the
repository knows that people are watching some files already, it
can/should be started on checkout of that project.

How does `svn-watchd' know where the working copies are?  The
subversion client tells it, on checkout and on any other operation.
(Think ssh-agent and ssh-add.)

How does `svn-watchd' know your email address, phone number, etc?
It's in the configuration file :-).  You only have to set that stuff
up once.

IMHO, this is much more in the spirit of the copy-modify-merge
development model than CVS's watch/edit features, because it doesn't
depend on explicitly notifying the revision control system that you're
about to start working on a particular file.  Instead, you just work
in the usual way; it does the noticing behind your back.

I think (hope?) that most teams who want file locking would find their
needs met with watchd.  If the point of file locking is to avoid
wasted time -- that is, to notice conflicts before anyone has spent
too much time on their changes -- then this should solve the problem.

Post-1.0 and all that, I know.  Just wanted to throw the idea out
there.

-Karl

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: Aha! How to have file locking without file locking.

Posted by Karl Fogel <kf...@newton.ch.collab.net>.
Peter Davis <pd...@attbi.com> writes:
> I mentioned something like this in a recent slashdot post 
> (http://slashdot.org/comments.pl?sid=29536&cid=3172558), so I think it's a 
> great idea.  Also, It would be really totally awesome if there were hooks so 
> an IDE (like an Emacs svn module, etc.) could be notified of conflicting 
> changes and flag/color-code/popup-error the conflict.
> 
> Speaking of IDE hooks, has anyone looked at making, for example, an Emacs 
> svn-major-mode?  Is there an API that would make something like that 
> possible?  Personally I don't know LISP at all, so I couldn't be much help, 
> unfortunately -- just wondering if any LISP gurus have tried anything.

Yes, it's possible, and I'm planning to write it. :-)

(Don't ask when, but it will happen, heh.  See tools/dev/svn-dev.el in
the Subversion tree for what exists so far.)

-K

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: Aha! How to have file locking without file locking.

Posted by "Mark C. Chu-Carroll" <mc...@watson.ibm.com>.
On Thu, 2002-04-04 at 19:44, Peter Davis wrote:
> On Thursday 04 April 2002 16:16, Karl Fogel wrote:
> > Meanwhile, everyone else's watch daemons are doing the same thing.
> > Whenever a byte-range overlap in the same file is detected (or perhaps
> > just a file overlap, depending on the strictness setting), the two
> > parties are notified by email, and/or by having the file set read-only
> > along with an explanatory note, by having special ringing on their
> > cell phones, or whatever.
> 
> I mentioned something like this in a recent slashdot post 
> (http://slashdot.org/comments.pl?sid=29536&cid=3172558), so I think it's a 
> great idea.  Also, It would be really totally awesome if there were hooks so 
> an IDE (like an Emacs svn module, etc.) could be notified of conflicting 
> changes and flag/color-code/popup-error the conflict.

In fact, if you take a look at the Eclipse IDE, it provides support for
exactly that, as well as a way to do the kind of pre-conflict detection
that Karl was talking about without using a daemon. (By the way, that
watch daemon has been implemented for clearcase, so you've been beaten 
to the punch on it... but there's no patent on it.)


	-Mark


> Speaking of IDE hooks, has anyone looked at making, for example, an Emacs 
> svn-major-mode?  Is there an API that would make something like that 
> possible?  Personally I don't know LISP at all, so I couldn't be much help, 
> unfortunately -- just wondering if any LISP gurus have tried anything.
> 
> -- 
> Peter Davis
> "I'd never marry a woman who didn't like pizza... I might play
> golf with her, but I wouldn't marry her!"
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
> For additional commands, e-mail: dev-help@subversion.tigris.org
-- 
Mark Craig Chu-Carroll,  IBM T.J. Watson Research Center 
<mc...@watson.ibm.com>
*** The (recently renamed) Stellation project:
***		http://domino.research.ibm.com/synedra/synedra.nsf
*** GPG Public key available at keyserver.net


Re: Aha! How to have file locking without file locking.

Posted by Peter Davis <pd...@attbi.com>.
On Thursday 04 April 2002 16:16, Karl Fogel wrote:
> Meanwhile, everyone else's watch daemons are doing the same thing.
> Whenever a byte-range overlap in the same file is detected (or perhaps
> just a file overlap, depending on the strictness setting), the two
> parties are notified by email, and/or by having the file set read-only
> along with an explanatory note, by having special ringing on their
> cell phones, or whatever.

I mentioned something like this in a recent slashdot post 
(http://slashdot.org/comments.pl?sid=29536&cid=3172558), so I think it's a 
great idea.  Also, It would be really totally awesome if there were hooks so 
an IDE (like an Emacs svn module, etc.) could be notified of conflicting 
changes and flag/color-code/popup-error the conflict.

Speaking of IDE hooks, has anyone looked at making, for example, an Emacs 
svn-major-mode?  Is there an API that would make something like that 
possible?  Personally I don't know LISP at all, so I couldn't be much help, 
unfortunately -- just wondering if any LISP gurus have tried anything.

-- 
Peter Davis
"I'd never marry a woman who didn't like pizza... I might play
golf with her, but I wouldn't marry her!"

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: Aha! How to have file locking without file locking.

Posted by Ben Collins <bc...@debian.org>.
On Thu, Apr 04, 2002 at 06:16:39PM -0600, Karl Fogel wrote:
>      [Warning: this is a blue-sky, post-1.0 plan.  If you only
>       want to read about immediately important stuff, stop now.]
> 
> Just had an idea for how to get the advantages of file locking without
> having to implement file locking.  More accurately, call it an answer
> to cvs watch/edit, but without all the the pain for the user.

I see a few problems with the watchd idea. Consider this:

I checkout a copy of the repo. I apply a patch I want to test. Watchd is
started, and communicates this to the repo. I later reboot or whatever,
and then kill off the test checkout I had, since I wasn't really
interested in it anyway.

Stale "locks" occur.

While I can appreciate the extra help of checking for conflicting
changes, IMO, we only really need a "being edited" state. Anything else
is a bit of overkill. In all honesty, I like the way perforce will only
checkin files that are marked "edit", "add" or "remove". It forces
people to mark files as being edited. Having some lurking daemon that
tracks all your moves just seems like a really bad idea (sorry, it
sounds good, but a daemon just leaves a bad taste in my mouth).
Especially given some of the repos I am working with (> 8000 files).



Ben

-- 
Debian     - http://www.debian.org/
Linux 1394 - http://linux1394.sourceforge.net/
Subversion - http://subversion.tigris.org/

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org