"git cvsimport"
Ok,
here's something for testers and/or documentation people: I wrapped a
little script around cvs2git (which I imported from the git tools thing), and now you can do
git cvsimport <cvsroot> <modulename>
and it might all "just work".
Right now the little sript is actually being anal and checking that CVSROOT is a directory, even though I think it all _should_ work even if CVSROOT is remote too. But I don't have any remote things to test, and for all I know maybe performance is horrible, so for now it artificially limits it to locally accessible CVS repos.
I'd love it if somebody tested the remote case (and, if it works, sends me a patch that just removes the anal tests in git-cvsimport-script), and maybe even updated the information a bit more.. As it is, that Documentation/cvs-migration.txt file is a bit on the light side.
Finally, I don't know what to do about cvsps options. It seems that the default time-fuzz is a bit too long for some projects, so at least that one should be overridable. So my silly script is not exactly wonderful, but I think it's more approachable than people doing the magic by hand (and forgetting to set TZ to UTC and the "-A" flag etc etc).
Linus
Quoted 21 lines · Linus Torvalds
Ok,
here's something for testers and/or documentation people: I wrapped a
little script around cvs2git (which I imported from the git tools thing), and now you can dogit cvsimport <cvsroot> <modulename>
and it might all "just work".
Right now the little sript is actually being anal and checking that CVSROOT is a directory, even though I think it all _should_ work even if CVSROOT is remote too. But I don't have any remote things to test, and for all I know maybe performance is horrible, so for now it artificially limits it to locally accessible CVS repos.
I'd love it if somebody tested the remote case (and, if it works, sends me a patch that just removes the anal tests in git-cvsimport-script), and maybe even updated the information a bit more.. As it is, that
Documentation/cvs-migration.txtfile is a bit on the light side.
Quoted 7 lines
Finally, I don't know what to do about cvsps options. It seems that the default time-fuzz is a bit too long for some projects, so at least that one should be overridable. So my silly script is not exactly wonderful, but I think it's more approachable than people doing the magic by hand (and forgetting to set TZ to UTC and the "-A" flag etc etc).
Linus
It seems to work for me. I'm still sanity checking the results.
Performance is indeed horrible for the remote case. I don't know how horrible it would be for someone in a sane environment, since I'm behind one of SBC's DSL gateways, which thinks (emphasis on "thinks") it is a nameserver.
The script produced by cvs2git checks out every revision of every file, right? Would "cvsps -g -p<dir>" improve cvs2git? I don't think it would help performance (it checks out the files to generate the patchset diffs (?)), but making the ugly someone else's problem is always good. Also, what about -x, to force cvsps to regenerate it's cached idea of the repository's patchsets?
cvsps seems a little weak on the whole error message idea (misspelling cvsroot leads to complaints about CVS versions).
Signature · 1 line
Tommy McGuire
Quoted 5 lines · Linus Torvalds
I'd love it if somebody tested the remote case (and, if it works, sends me a patch that just removes the anal tests in git-cvsimport-script), and maybe even updated the information a bit more.. As it is, that
Documentation/cvs-migration.txtfile is a bit on the light side.
Quoted 7 lines
Finally, I don't know what to do about cvsps options. It seems that the default time-fuzz is a bit too long for some projects, so at least that one should be overridable. So my silly script is not exactly wonderful, but I think it's more approachable than people doing the magic by hand (and forgetting to set TZ to UTC and the "-A" flag etc etc).
Linus
This is the first of a short sequence of patches, which just removes the tests in in git-cvs-import-script. It does, indeed, just work.
Remove unneeded sanity tests, allowing remote CVS repos.
---
commit 21b4b44a5deee7985f14d0f4776ad0d489092a96
tree a48fbf33e90511554077f2c18053f1c000c2edb5
parent 98a96b00b88ee35866cd0b1e94697db76bd5ddf9
author Tommy M. McGuire <[email protected]> Thu, 09 Jun 2005 13:12:25 -0500 committer Tommy M. McGuire <[email protected]> Thu, 09 Jun 2005 13:12:25 -0500
git-cvsimport-script | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
git-cvsimport-script +1 -1
@@ -7,7 +7,7 @@ fi export CVSROOT="$1" export MODULE="$2" -if [ ! "$CVSROOT" ] || [ ! "$MODULE" ] || [ ! -d $CVSROOT ] || [ ! -d $CVSROOT/CVSROOT ] || [ ! -d $CVSROOT/$MODULE ] ; then +if [ ! "$CVSROOT" ] || [ ! "$MODULE" ] ; then echo "Usage: git cvsimport <cvsroot> <module>" exit 1 fi
!-------------------------------------------------------------flip-
PATCH 1/1 git cvsimport sanity checking
This patch adds some sanity checking to git-cvsimport-script, specifically forcing the use of cvsps -x (to get the latest information from the repository, rather than whatever is in the cache) and aborting early if cvsps does not produce any output.
I debated removing the $MODULE directory following an abort, but I eventually decided leaving stuff behind would make debugging easier. On the other hand, this patch should help with the "cvsimport left me with an empty repository" complaints.
Call cvsps with the -x flag, to get the current state of the repository, and abort the cvs import early if cvsps does not produce any output.
---
commit 2e670826cec5642a11e2e7d6adcb48e02225ba6d
tree 25e4f590772b9c0bc8ac37f8a57f4a08435ed5c6
parent 21b4b44a5deee7985f14d0f4776ad0d489092a96
author Tommy M. McGuire <[email protected]> Fri, 10 Jun 2005 01:38:42 -0500 committer Tommy M. McGuire <[email protected]> Fri, 10 Jun 2005 01:38:42 -0500
git-cvsimport-script | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-)
git-cvsimport-script +3 -1
@@ -20,6 +20,8 @@ cvsps -h 2>&1 | grep -q "cvsps version 2 mkdir "$MODULE" || exit 1 cd "$MODULE" -TZ=UTC cvsps -A $MODULE | git-cvs2git $ARGS --cvsroot="$CVSROOT" --module="$MODULE" > .git-create-script || exit 1 +TZ=UTC cvsps -x -A $MODULE > .git-cvsps-result +[ -s .git-cvsps-result ] || exit 1 +git-cvs2git $ARGS --cvsroot="$CVSROOT" --module="$MODULE" < .git-cvsps-result > .git-create-script || exit 1 sh .git-create-script
!-------------------------------------------------------------flip-
Signature · 1 line
Tommy McGuire
PATCH 1/1 cvs-migration.txt
In reply to Tommy M. McGuireThe way I figure it, telling someone why cvsimport is taking so long will improve their overall user experience. :-)
Slightly expand the cvsimport description, and make a couple of syntax edits.
---
commit 9a861c244e79634abf3c8436d720e77140d0e0e3
tree 32155e131933b2e48383644a3e3198f541f6d4b8
parent 2e670826cec5642a11e2e7d6adcb48e02225ba6d
author Tommy M. McGuire <[email protected]> Fri, 10 Jun 2005 02:11:14 -0500 committer Tommy M. McGuire <[email protected]> Fri, 10 Jun 2005 02:11:14 -0500
Documentation/cvs-migration.txt | 12 +++++++----- 1 files changed, 7 insertions(+), 5 deletions(-)
Documentation/cvs-migration.txt +7 -5
@@ -14,7 +14,7 @@ does a lot of things differently. One particular suckage of CVS is very hard to work around: CVS is basically a tool for tracking _file_ history, while git is a tool for tracking _project_ history. This sometimes causes problems if you are -used to doign very strange things in CVS, in particular if you're doing +used to doing very strange things in CVS, in particular if you're doing things like making branches of just a subset of the project. Git can't track that, since git never tracks things on the level of an individual file, only on the whole project level.
@@ -35,8 +35,8 @@ that you're actually working in (your wo working directories _are_ the repositories. However, you can easily emulate the CVS model by having one special "global repository", which people can synchronize with. See details later, but in the meantime -just keep in mind that with git, every checked out working tree will be -a full revision control of its own. +just keep in mind that with git, every checked out working tree will +have a full revision control history of its own. Importing a CVS archive
@@ -69,10 +69,12 @@ which will do exactly what you'd think i archive of the named CVS module. The new archive will be created in a subdirectory named <module>. -It can take some time to actually do the conversion for a large archive, +It can take some time to actually do the conversion for a large archive +since it involves checking out from CVS every revision of every file, and the conversion script can be reasonably chatty, but on some not very scientific tests it averaged about eight revisions per second, so a -medium-sized project should not take more than a couple of minutes. +medium-sized project should not take more than a couple of minutes. For +larger projects or remote repositories, the process may take longer. Emulating CVS behaviour
!-------------------------------------------------------------flip-
Signature · 1 line
Tommy McGuire
PATCH 1/1 git cvsimport fuzz argument
In reply to Tommy M. McGuireGive the user the option of specifying the timestamp fuzz passed to cvsps. Looking at the other arguments to it, I can't see anything else that would be sane to play with. Also, use --cvs-direct, which speeds up cvsps for remote repositories and doesn't seem to do anything bad to local repositories.
Add "-z fuzz" argument, passed to cvsps, and clean up argument processing. Also, use "cvsps --cvs-direct", which is is somewhat faster.
---
commit 018aee88d1b71f96ce9ecdfba77608566f51c860
tree 623c7a40ea20ef8b68cf896605d55432cd0469ac
parent 9a861c244e79634abf3c8436d720e77140d0e0e3
author Tommy M. McGuire <[email protected]> Fri, 10 Jun 2005 02:51:34 -0500 committer Tommy M. McGuire <[email protected]> Fri, 10 Jun 2005 02:51:34 -0500
git-cvsimport-script | 27 +++++++++++++++++++-------- 1 files changed, 19 insertions(+), 8 deletions(-)
git-cvsimport-script +19 -8
@@ -1,15 +1,26 @@ #!/bin/sh -ARGS="" -if [ "$1" == "-v" ]; then - ARGS=$1 + +usage () { + echo "Usage: git cvsimport [-v] [-z fuzz] <cvsroot> <module>" + exit 1 +} + +CVS2GIT="" +CVSPS="--cvs-direct -x -A" +while true; do + case "$1" in + -v) CVS2GIT="$1" ;; + -z) shift; CVSPS="$CVSPS -z $1" ;; + -*) usage ;; + *) break ;; + esac shift -fi +done export CVSROOT="$1" export MODULE="$2" if [ ! "$CVSROOT" ] || [ ! "$MODULE" ] ; then - echo "Usage: git cvsimport <cvsroot> <module>" - exit 1 + usage fi cvsps -h 2>&1 | grep -q "cvsps version 2.1" >& /dev/null || {
@@ -20,8 +31,8 @@ cvsps -h 2>&1 | grep -q "cvsps version 2 mkdir "$MODULE" || exit 1 cd "$MODULE" -TZ=UTC cvsps -x -A $MODULE > .git-cvsps-result +TZ=UTC cvsps $CVSPS $MODULE > .git-cvsps-result [ -s .git-cvsps-result ] || exit 1 -git-cvs2git $ARGS --cvsroot="$CVSROOT" --module="$MODULE" < .git-cvsps-result > .git-create-script || exit 1 +git-cvs2git $CVS2GIT --cvsroot="$CVSROOT" --module="$MODULE" < .git-cvsps-result > .git-create-script || exit 1 sh .git-create-script
!-------------------------------------------------------------flip-
Signature · 1 line
Tommy McGuire