Re: gitweb wishlist
- From
Linus Torvalds <torvalds@osdl.org>
- Date
- May 21, 2005, 00:50 UTC
- Message-ID
- <Pine.LNX.4.58.0505201702170.2206@ppc970.osdl.org>
- In-Reply-To
- <428E745C.30304@zytor.com>
[ Thomas added to cc, since he seems to have also worked on this ]
On Fri, 20 May 2005, H. Peter Anvin wrote:
> > Here is my "main" OSS CVS repository; look at the syslinux module. It > has at least some minor branching.
Ok, "cvsps" output scares me. I wonder what
WARNING: Invalid PatchSet 775, Tag syslinux-2_12-pre7: memdisk/init32.asm:1.3=after, memdisk/Makefile:1.26=before. Treated as 'before' WARNING: Invalid PatchSet 775, Tag syslinux-2_12-pre7: memdisk/init32.asm:1.3=after, memdisk/e820test.c:1.7=before. Treated as 'before' ...
means..
Also, your syslinux repo is interesting and shows another thing: doing a
cvsps -g -p separate
ends badly with
Directing PatchSet 938 to file separate/938.patch cvs rdiff: failed to read diff file header /tmp/cvso8PswZ for mdiskchk.com,v: end of file system command returned non-zero exit status: 1: aborting
which doesn't look very promising and causes an empty diff for mdiskck.com. Trying with --cvs-direct shows the reason:
Index: syslinux/sample/mdiskchk.com =================================================================== RCS file: /home/torvalds/src/osscvs/cvsroot/syslinux/sample/mdiskchk.com,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 Binary files /tmp/cvsU6MGU0 and /tmp/cvsiskFVR differ
which shows that anything that bases itself of diffs (ie uses "-g" with cvsps) is just doomed to failure, since there's no good way to handle binary data. Both Kay's and Thomas' scripts try to do the "-g" thing, that's just not right.
So the cvs->git thing would need to be based on the actual objects, which obviously fits git quite well, but I was really hoping to have cvsps give some nice intermediate format..
So it looks like we should avoid the diff format, and instead use
cvsps -p separate
and then just parse the "Members" thing and turning each of them either into a "delete" (for ->.*DEAD) or "cvs checkout -rxxx" (for ".*->xxx").
Handling branches by literally treating them as different heads in git sounds quite simple, and indeed it looks like the basic logic for cvs->git translation would be
for-each-patch-from-cvsps do git-read-tree -m branchname-from-patch git-update-cache -f -u -q -a for-each-member-in-patch do if [ DEAD ]; then rm member git-update-cache --remove member else cvs co -rREV member git-update-cache --add member fi cat commit-message-from-patch | git-commit-tree $(git-write-tree) -p branchname-from-patch > .git/revs/heads/branchname-from-patch done done
which looks like it should work, and handle binary files right.
There seems to be two questions:
- what to do about branch creation (ie a branch name we haven't seen before): it looks like cvsps doesn't tell you what the _originating_ branch was for a new branch (that may be my confusion - maybe you can't create branches off branches in CVS?)
For syslinux, it looks like you can always base it on HEAD, or possibly just the previous patch (which looks like it is always HEAD). The above pseudo-script will actually do that automatically, simply by virtue of the "git-read-tree -m" at the top of the loop failing when the branchname doesn't exist yet.
- whether to bother to create merge entries for when somebody tried to merge a branch back or forth in CVS.
CVS fundamentally doesn't have the notion of such a thing, and cvsps can't either. But we could try to guess, based on the commit message, perhaps.
NOTE! Such a "merge" would not have any real GIT merge functionality what-so-ever. It would just introduce a second parent into the commit, nothing more.
Bah. What crud.
Linus