I exported my CVS repo to git using cvs2git (version 2.4.0-dev), and ingested the resulting git repo into fossil according to the instructions on the fossil web site, using fossil 1.26. My git version is 1.7.7.6.
This failed to preserve the original CVS user names. The reason is that git assumes a null email address for the incoming CVS user names, so that the git export file has records like this: author eas <> 1368997852 +0000 committer eas <> 1368997852 +0000 where "eas" is my CVS user name, and the null email address is between the angle brackets. The fossil importer ignores the first user name, going only for whatever's in the angle brackets: if( memcmp(zLine, "tagger ", 7)==0 || memcmp(zLine, "committer ",10)==0 ){ sqlite3_int64 secSince1970; for(i=0; zLine[i] && zLine[i]!='<'; i++){} if( zLine[i]==0 ) goto malformed_line; z = &zLine[i+1]; for(i=i+1; zLine[i] && zLine[i]!='>'; i++){} if( zLine[i]==0 ) goto malformed_line; zLine[i] = 0; fossil_free(gg.zUser); gg.zUser = fossil_strdup(z); secSince1970 = 0; for(i=i+2; fossil_isdigit(zLine[i]); i++){ secSince1970 = secSince1970*10 + zLine[i] - '0'; } fossil_free(gg.zDate); gg.zDate = db_text(0, "SELECT datetime(%lld, 'unixepoch')", secSince1970); gg.zDate[10] = 'T'; I made a quick-and-dirty hack to use the first user name in the case where the email address is empty. I thought I'd post it in case someone in the future finds it helpful. The patch comes with a long list of caveats*, and I'm not suggesting it be adopted into the fossil trunk at this time. Just posting it for the narrow purpose of possibly helping other users who are having the same issue getting their CVS repos into fossil. --- import.c.orig 2013-07-22 16:24:26.305215527 -0400 +++ import.c 2013-07-27 10:49:29.894610274 -0400 @@ -471,21 +471,21 @@ zName[i] = 0; } /* ** Read the git-fast-import format from pIn and insert the corresponding ** content into the database. */ static void git_fast_import(FILE *pIn){ ImportFile *pFile, *pNew; - int i, mx; + int i, j, k, mx; char *z; char *zUuid; char *zName; char *zPerm; char *zFrom; char *zTo; char zLine[1000]; gg.xFinish = finish_noop; while( fgets(zLine, sizeof(zLine), pIn) ){ @@ -569,27 +569,41 @@ }else if( memcmp(zLine, "author ", 7)==0 ){ /* No-op */ }else if( memcmp(zLine, "mark ", 5)==0 ){ trim_newline(&zLine[5]); fossil_free(gg.zMark); gg.zMark = fossil_strdup(&zLine[5]); }else if( memcmp(zLine, "tagger ", 7)==0 || memcmp(zLine, "committer ",10)==0 ){ + /* Try first to use the email address that is in angle brackets. If + ** that is empty, then use the user name that precedes it. + */ + j = (zLine[0]=='t' ? 7 : 10); /* Index the first char of the user name. */ sqlite3_int64 secSince1970; for(i=0; zLine[i] && zLine[i]!='<'; i++){} if( zLine[i]==0 ) goto malformed_line; + k = i-1; /* Index the character just after the user name. */ z = &zLine[i+1]; for(i=i+1; zLine[i] && zLine[i]!='>'; i++){} if( zLine[i]==0 ) goto malformed_line; - zLine[i] = 0; + if( &z[0]==&zLine[i] ){ + /* The email address is empty. Use the user name instead of the + ** email address. + */ + if( k<j ) goto malformed_line; + z=&zLine[j]; + zLine[k] = 0; + }else{ + zLine[i] = 0; + } fossil_free(gg.zUser); gg.zUser = fossil_strdup(z); secSince1970 = 0; for(i=i+2; fossil_isdigit(zLine[i]); i++){ secSince1970 = secSince1970*10 + zLine[i] - '0'; } fossil_free(gg.zDate); gg.zDate = db_text(0, "SELECT datetime(%lld, 'unixepoch')", secSince1970); gg.zDate[10] = 'T'; }else Eric * This solution is not the right approach overall -- it's probably better to permit command-line options altering the behavior here. I tested it only one time, on my one well-formed repo export file, using a different version of the patch. All my CVS usernames are just lowercase alphabet characters (with no spaces or funny characters that one of the tools in question might want to escape or parse differently). I had been using git and fossil for a total of one calendar day when I made the hack. I have no idea if git promises to retain their export format. I was born yesterday, as a fledgling greenhorn tenderfoot newbie fish-face bush leaguer, on the back of a turnip truck. Etc etc etc. YMMV.
_______________________________________________ fossil-users mailing list fossil-users@lists.fossil-scm.org http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users