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

Aha! How to have file locking without file locking.

From: Karl Fogel <kfogel_at_newton.ch.collab.net>
Date: 2002-04-05 02:16:39 CEST

     [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
Received on Fri Apr 5 02:10:49 2002

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

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