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

Re: Since there's a resurgence of interest in cvs2svn...

From: Greg Stein <gstein_at_lyra.org>
Date: 2002-10-23 03:41:52 CEST

On Tue, Oct 22, 2002 at 10:20:27PM +0200, Marko Macek wrote:
>...
> + def has_file(self, fname):
> + for f, r in self.changes:
> + if f == fname:
> + return 1
> + for f, r in self.deletes:
> + if f == fname:
> + return 1
> + return 0

Ah! That is good... I noticed a couple times where somebody was committing
with an empty message (same author, no message... same id), that it would
attempt to add/modify/delete a file multiple times. Not good :-)

The concept is good, but...

> @@ -569,10 +578,12 @@
>
> # scan for commits to process
> process = [ ]
> - for id, c in commits.items():
> - if c.t_max + COMMIT_THRESHOLD < timestamp:
> + for xid, c in commits.items():
> + if c.t_max + COMMIT_THRESHOLD < timestamp or \
> + c.has_file(fname) or \
> + xid != id:

I don't think that will work. It is possible to have interleaved commits.
For example, the sorted revs file could contain:

time-1 id-A ...
time-1 id-A ...
time-1.1 id-B ...
time-1.2 id-A ...
time-1.2 id-B ...
time-1.3 id-A ...

Just because you hit an interleaved commit (id-B) doesn't mean that you
should immediately process id-A.

Also, note that c.has_file(fname) is not necessarily a proper condition for
processing a commit either. In the above example, it is possible that id-A
changes a file in the first two lines, and then id-B deletes the file (but
id-A is not complete).

That said, if you're about to put a file into a Commit object and it is
*already* present, then you want to close out that commit first. This
scenario will happen when somebody commits using the same message in rapid
succession. It is still possible that the commits were interleaved, but
since the commit message is the same, then we just have to break them up,
even though that may not reflect what *really* happened. I would state that
we should issue a warning so that a human can investigate. Ideally, we could
provide controls so that a human could separate an interleaved commit from
the same user/message.

In any case... the patch is interesting, but it doesn't properly handle
interleaved commits. (and yes, cvs2svn has to do that... sucks that CVS
isn't atomic...)

Cheers,
-g

-- 
Greg Stein, http://www.lyra.org/
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Wed Oct 23 03:43:13 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.