git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 0/3] fixup remaining cvsimport tests

From
Michael Haggerty <mhagger@alum.mit.edu>
Date
Jan 23, 2013, 09:54 UTC
Message-ID
<50FFB35C.7070809@alum.mit.edu>
In-Reply-To
<CAEUsAPaw8EUcZFbODDj9Z-=3Ppd1CC=jvYDvuyntFkX_3V0ynQ@mail.gmail.com>
On 01/20/2013 09:17 PM, Chris Rorvick wrote:
Show 24 quoted lines
> I probably won't be sending any more patches on this.  My hope was to
> get cvsimport-3 (w/ cvsps as the engine) in a state such that one
> could transition from the previous version seamlessly.  But the break
> in t9605 has convinced me this is not worth the effort--even in this
> trivial case cvsps is broken.  The fuzzing logic aggregates commits
> into patch sets that have timestamps within a specified window and
> otherwise matching attributes.  This aggregation causes file-level
> commit timestamps to be lost and we are left with a single timestamp
> for the patch set: the minimum for all contained CVS commits.  When
> all commits have been processed, the patch sets are ordered
> chronologically and printed.
> 
> The problem is that is that a CVS commit is rolled into a patch set
> regardless of whether the patch set's timestamp falls within the
> adjacent CVS file-level commits.  Even worse, since the patch set
> timestamp changes as subsequent commits are added (i.e., it's always
> picking the earliest) it is potentially indeterminate at the time a
> commit is added.  The result is that file revisions can be reordered
> in resulting Git import (see t9605.)  I spent some time last week
> trying to solve this but I coudln't think of anything that wasn't a
> substantial re-work of the code.
> 
> I have never used cvs2git, but I suspect Eric's efforts in making it a
> potential backend for cvsimport are a better use of time.
Thanks for your explanation of how cvsps works.

This is roughly how cvs2svn used to work years ago, prior to release 2.x. In addition it did a number of things to try to tweak the timestamp ordering to avoid committing file-level commits in the wrong order. It never worked 100%; each tweak that was made to fix one problem created another problem in another scenario.

cvs2svn/cvs2git 2.x takes a very different approach. It uses a timestamp threshold along with author and commit-message matching to find the biggest set of file-level commits that might constitute a repository-level commit. But then it checks the proto-commits to see if they violate the ordering constraints imposed by the individual file-level commits. For example, if the initial grouping gives the following proto-commits:

proto-commit 1: a.txt 1.1        b.txt 1.2
proto-commit 2: a.txt 1.2        b.txt 1.1

then it is apparent that something is wrong, because a.txt 1.1 necessarily comes before a.txt 1.2 whereas b.txt 1.1 necessarily comes before b.txt 1.2 (CVS can at least be relied on to get this right!) and therefore there is no consistent ordering of the two proto-commits. More generally, the proto-commits have to form a directed acyclic graph, whereas this graph has a cycle 1 -> 2 -> 1. When cvs2svn/cvs2git finds a cycle, it uses heuristics to break up one or more of the proto-commits to break the cycle. In this case it might break proto-commit 1 into two commits:

proto-commit 1a: a.txt 1.1
proto-commit 2:  a.txt 1.2        b.txt 1.1
proto-commit 1b:                  b.txt 1.2

Now it is possible to commit them in the order 1a,2,1b. (Exactly this scenario is tested in t9603.)

Of course a typical proto-commit graph often contains far more complicated cycles, but the approach remains the same: split proto-commits up as necessary until the graph is acyclic. One can quibble about the heuristics that cvs2svn/cvs2git uses to break up proto-commits. But the final result of the algorithm is *guaranteed* to be consistent with the file-level CVS history and also self-consistent.

I am skeptical that a simpler approach will ever work 100%.
Michael
-- 
Michael Haggerty
mhagger@alum.mit.edu
http://softwareswirl.blogspot.com/
Previous: Eric S. RaymondNext: John Keeping
Message 14 of 16 in “fixup remaining cvsimport tests”
  1. 0/3 fixup remaining cvsimport testsChris Rorvick, Jan 11, 2013
  2. 1/3 t/lib-cvs.sh: allow cvsps version 3.x.Chris Rorvick, Jan 11, 2013
  3. 2/3 t9600: fixup for new cvsimportChris Rorvick, Jan 11, 2013
  4. 3/3 t9604: fixup for new cvsimportChris Rorvick, Jan 11, 2013
  5. John KeepingJan 20, 2013
  6. Chris RorvickJan 20, 2013
  7. John KeepingJan 20, 2013
  8. Junio C HamanoJan 20, 2013
  9. John KeepingJan 20, 2013
  10. Chris RorvickJan 20, 2013
  11. Chris RorvickJan 20, 2013
  12. Chris RorvickJan 21, 2013
  13. Eric S. RaymondJan 21, 2013
  14. Michael HaggertyJan 23, 2013
  15. John KeepingJan 23, 2013
  16. Michael HaggertyJan 24, 2013

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.