cvsimport: rewrite to use cvsps 3.x to fix major bugs
PATCH 1/1 cvsimport: rewrite to use cvsps 3.x to fix major bugs
From: "Eric S. Raymond" <[email protected]>
The combination of git-cvsimport and cvsps had serious problems.
Among these were:
(1) Analysis of branchy repos was buggy in multiple ways in both programs, leading to incorrect repo translations.
(2) Even after a correct branch analysis, extra (redundant) fileops would often be generated on the new-branch side.
(3) Inability to report more than one tag pointing to the same revision.
(4) Failure in certain cases of clock-skew reported by the t9603 test.
(5) Failure to use commitids for changeset ordering in cases were this would have prevented clock skew from causing incorrect grouping.
Problems 2-5 and portions of problem 1 have been solved by a major rewrite of cvsps (the 3.x release series); it now emits a git fast-import stream. Also, the buggy attempt at ancestry-branch tracking previously invoked by -A has been replaced with a simpler and better topo analysis. cvsps is now about 20% smaller than formerly.
All this changed cvsps's interface enough to require a complete rewrite of git-cvsimport (hence this patch). In the process the code size of the wrapper script dropped by about x3 and it can now support alternate conversion engines; the first new engine is cvs2git, with parsecvs expected to follow shortly.
The old Perl git-cvsimport is moved to git-cvsimport-fallback; new git-cvsimport will hand off to the fallback script when it detects that the user has a pre-3.x cvsps. The fallback is only there so that people with simple enough repositories that can be correctly handled by cvsps-2.x but without the bleeding-edge cvsps 3.x installed does not have to be left without any cvsimport that works for them (with the same bugs and all). The fallback support will be removed after cvsps 3.x and the rewritten cvsimport matures and gets widely available.
This patch also removes Michael Haggerty's git-cvsimport tests (t960[123]) from the git tree. These are actually conversion-engine tests and have been merged into a larger cvsps test suite, which I intend to spin out into a general CVS-lifting test that can also be applied to utilities such as cvs2git and parsecvs. The t9604 test will move in a future patch, when I likewise have it integrated into the general test suite.
The following known bug has not been fixed: "If any files were ever "cvs import"ed more than once (e.g., import of more than one vendor release) the HEAD contains the wrong content." However, cvsps now emits a warning in this case. There is also one pathological tagging case that was successful in the former t9602 test that now fails (with a warning).
I plan to address these problems. This patch at least gets the cvsps-3.x/git-cvsimport combination to a state that is not too broken to ship - that is, in all failure cases known to me it now emits useful warnings rather than silently botching the import.
---
* This was (re)sent privately to me; the previous attempt by Eric somehow did not reach the list. Let me see if I have better luck, as we really would want to be reviewing these patches.
I rewrote one paragraph in the log about the fallback, though. For the record the original read like this:
The old Perl git-cvsimport is moved to git-cvsimport-fallback; new git-cvsimport will hand off to the fallback script when it detects that the user has a pre-3.x cvsps. I make no warranties that cvsps-2.x will actually work or do anything more useful than make demons fly out of your nose; the fallback is only there because Junio disliked the idea of a flag day, and should be removed after a decent interval.
which I felt somewhat irresponsible to existing users.
Makefile | 3 +- git-cvsimport.perl => git-cvsimport-fallback.perl | 8 + git-cvsimport.py | 354 +++++++++++++++++++++ t/t9601/cvsroot/.gitattributes | 1 - t/t9601/cvsroot/CVSROOT/.gitignore | 2 - t/t9601/cvsroot/module/added-imported.txt,v | 44 --- t/t9601/cvsroot/module/imported-anonymously.txt,v | 42 --- .../module/imported-modified-imported.txt,v | 76 ----- t/t9601/cvsroot/module/imported-modified.txt,v | 59 ---- t/t9601/cvsroot/module/imported-once.txt,v | 43 --- t/t9601/cvsroot/module/imported-twice.txt,v | 60 ---- t/t9602/README | 62 ---- t/t9602/cvsroot/.gitattributes | 1 - t/t9602/cvsroot/CVSROOT/.gitignore | 2 - t/t9602/cvsroot/module/default,v | 102 ------ t/t9602/cvsroot/module/sub1/default,v | 102 ------ t/t9602/cvsroot/module/sub1/subsubA/default,v | 101 ------ t/t9602/cvsroot/module/sub1/subsubB/default,v | 107 ------- .../module/sub2/Attic/branch_B_MIXED_only,v | 59 ---- t/t9602/cvsroot/module/sub2/default,v | 102 ------ t/t9602/cvsroot/module/sub2/subsubA/default,v | 102 ------ t/t9602/cvsroot/module/sub3/default,v | 102 ------ t/t9603/cvsroot/.gitattributes | 1 - t/t9603/cvsroot/CVSROOT/.gitignore | 2 - t/t9603/cvsroot/module/a,v | 74 ----- t/t9603/cvsroot/module/b,v | 90 ------ 26 files changed, 364 insertions(+), 1337 deletions(-) rename git-cvsimport.perl => git-cvsimport-fallback.perl (98%) create mode 100755 git-cvsimport.py delete mode 100644 t/t9601/cvsroot/.gitattributes delete mode 100644 t/t9601/cvsroot/CVSROOT/.gitignore delete mode 100644 t/t9601/cvsroot/module/added-imported.txt,v delete mode 100644 t/t9601/cvsroot/module/imported-anonymously.txt,v delete mode 100644 t/t9601/cvsroot/module/imported-modified-imported.txt,v delete mode 100644 t/t9601/cvsroot/module/imported-modified.txt,v delete mode 100644 t/t9601/cvsroot/module/imported-once.txt,v delete mode 100644 t/t9601/cvsroot/module/imported-twice.txt,v delete mode 100644 t/t9602/README delete mode 100644 t/t9602/cvsroot/.gitattributes delete mode 100644 t/t9602/cvsroot/CVSROOT/.gitignore delete mode 100644 t/t9602/cvsroot/module/default,v delete mode 100644 t/t9602/cvsroot/module/sub1/default,v delete mode 100644 t/t9602/cvsroot/module/sub1/subsubA/default,v delete mode 100644 t/t9602/cvsroot/module/sub1/subsubB/default,v delete mode 100644 t/t9602/cvsroot/module/sub2/Attic/branch_B_MIXED_only,v delete mode 100644 t/t9602/cvsroot/module/sub2/default,v delete mode 100644 t/t9602/cvsroot/module/sub2/subsubA/default,v delete mode 100644 t/t9602/cvsroot/module/sub3/default,v delete mode 100644 t/t9603/cvsroot/.gitattributes delete mode 100644 t/t9603/cvsroot/CVSROOT/.gitignore delete mode 100644 t/t9603/cvsroot/module/a,v delete mode 100644 t/t9603/cvsroot/module/b,v
Makefile +2 -1
@@ -464,7 +464,7 @@ SCRIPT_PERL += git-add--interactive.perl SCRIPT_PERL += git-difftool.perl SCRIPT_PERL += git-archimport.perl SCRIPT_PERL += git-cvsexportcommit.perl -SCRIPT_PERL += git-cvsimport.perl +SCRIPT_PERL += git-cvsimport-fallback.perl SCRIPT_PERL += git-cvsserver.perl SCRIPT_PERL += git-relink.perl SCRIPT_PERL += git-send-email.perl
@@ -472,6 +472,7 @@ SCRIPT_PERL += git-svn.perl SCRIPT_PYTHON += git-remote-testgit.py SCRIPT_PYTHON += git-p4.py +SCRIPT_PYTHON += git-cvsimport.py SCRIPTS = $(patsubst %.sh,%,$(SCRIPT_SH)) \ $(patsubst %.perl,%,$(SCRIPT_PERL)) \
git-cvsimport-fallback.perl renamed from git-cvsimport.perl +8 -0
@@ -1,4 +1,8 @@ #!/usr/bin/perl +# This code became obsolete in January 2013, and is retained only as a +# fallback from git-cvsimport.py for users who have only cvsps-2.x. +# It (and the code in cvsimport.py that calls it) should be removed +# once the 3.x version has had a reasonable time to propagate. # This tool is copyright (c) 2005, Matthias Urlichs. # It is released under the Gnu Public License, version 2.
@@ -27,6 +31,10 @@ use POSIX qw(strftime tzset dup2 ENOENT); use IPC::Open2; +print(STDERR "You do not appear to have cvsps 3.x.\n"); +print(STDERR "Falling back to unmaintained Perl cvsimport for cvsps 2.x.\n"); +print(STDERR "Upgrade your cvsps for best results.\n"); + $SIG{'PIPE'}="IGNORE"; set_timezone('UTC');
git-cvsimport.py new file +354 -0
354 lines not on this page · raw message
t/t9601/cvsroot/.gitattributes deleted +0 -1
@@ -1 +0,0 @@ -* -whitespace
t/t9601/cvsroot/CVSROOT/.gitignore deleted +0 -2
@@ -1,2 +0,0 @@ -history -val-tags
t/t9601/cvsroot/module/added-imported.txt,v deleted +0 -44
44 lines not on this page · raw message
t/t9601/cvsroot/module/imported-anonymously.txt,v deleted +0 -42
42 lines not on this page · raw message
t/t9601/cvsroot/module/imported-modified-imported.txt,v deleted +0 -76
76 lines not on this page · raw message
t/t9601/cvsroot/module/imported-modified.txt,v deleted +0 -59
59 lines not on this page · raw message
t/t9601/cvsroot/module/imported-once.txt,v deleted +0 -43
43 lines not on this page · raw message
t/t9601/cvsroot/module/imported-twice.txt,v deleted +0 -60
60 lines not on this page · raw message
t/t9602/README deleted +0 -62
62 lines not on this page · raw message
t/t9602/cvsroot/.gitattributes deleted +0 -1
@@ -1 +0,0 @@ -* -whitespace
t/t9602/cvsroot/CVSROOT/.gitignore deleted +0 -2
@@ -1,2 +0,0 @@ -history -val-tags
t/t9602/cvsroot/module/default,v deleted +0 -102
102 lines not on this page · raw message
t/t9602/cvsroot/module/sub1/default,v deleted +0 -102
102 lines not on this page · raw message
t/t9602/cvsroot/module/sub1/subsubA/default,v deleted +0 -101
101 lines not on this page · raw message
t/t9602/cvsroot/module/sub1/subsubB/default,v deleted +0 -107
107 lines not on this page · raw message
t/t9602/cvsroot/module/sub2/Attic/branch_B_MIXED_only,v deleted +0 -59
59 lines not on this page · raw message
t/t9602/cvsroot/module/sub2/default,v deleted +0 -102
102 lines not on this page · raw message
t/t9602/cvsroot/module/sub2/subsubA/default,v deleted +0 -102
102 lines not on this page · raw message
t/t9602/cvsroot/module/sub3/default,v deleted +0 -102
102 lines not on this page · raw message
t/t9603/cvsroot/.gitattributes deleted +0 -1
@@ -1 +0,0 @@ -* -whitespace
t/t9603/cvsroot/CVSROOT/.gitignore deleted +0 -2
@@ -1,2 +0,0 @@ -history -val-tags
t/t9603/cvsroot/module/a,v deleted +0 -74
74 lines not on this page · raw message
t/t9603/cvsroot/module/b,v deleted +0 -90
90 lines not on this page · raw message
Signature · 1 line
1.8.1.407.g59f98af
Quoted 3 lines · Junio C Hamano
From: "Eric S. Raymond" <[email protected]>
The combination of git-cvsimport and cvsps had serious problems.
Agreed.
Quoted 16 lines
[...]
This patch also removes Michael Haggerty's git-cvsimport tests (t960[123]) from the git tree. These are actually conversion-engine tests and have been merged into a larger cvsps test suite, which I intend to spin out into a general CVS-lifting test that can also be applied to utilities such as cvs2git and parsecvs. The t9604 test will move in a future patch, when I likewise have it integrated into the general test suite.The following known bug has not been fixed: "If any files were ever "cvs import"ed more than once (e.g., import of more than one vendor release) the HEAD contains the wrong content." However, cvsps now emits a warning in this case. There is also one pathological tagging case that was successful in the former t9602 test that now fails (with a warning).
Quoted 5 lines
I plan to address these problems. This patch at least gets the cvsps-3.x/git-cvsimport combination to a state that is not too broken to ship - that is, in all failure cases known to me it now emits useful warnings rather than silently botching the import.
I don't understand the logic of removing the cvsimport tests, at least not at this time. It is true that the tests mostly ensure that the conversion engine is working correctly, especially with your new version of cvsps. But I think the git project, by implicitly endorsing the use of cvsps, has some responsibility to verify that the combination cvsps + git-cvsimport continues to work and to document any known breakages via its test suite.
Otherwise, how do we know that cvsps currently works with git-cvsimport?
(OK, you claim that it does, but in the next breath you admit that
there is a new failure in "one pathological tagging case".) How can we understand its strengths/weaknesses? How can we gain confidence that it works on different platforms? How will we find out if a future versions of cvsps stops working (e.g., because of a breakage or a non-backwards-compatible change)?
Normally one would expect an improvement like this to be combined with patches that turn test expected failures into expected successes, not to rip out the very tests that establish the correctness of the change that is being proposed!
Let me describe what I would consider to be the optimum state of the test suite. Maybe your idea of "optimum" differs from mine, or maybe the optimum is unrealistic due to lack of resources or for some other reason. But if so, let's explicitly spell out why we are deviating from whatever optimum we define.
* The old tests should be retained (and possibly new tests added to show off your improvements).
* There should be a way for users to choose which cvsps executable to use when running test suite. (In the future, the selection might be expanded to cover altogether different conversion engines.)
* The tests should determine which version of cvsps has been selected (e.g., by running "cvsps --version").
* The individual tests should be marked expected success/expected failure based on the selected version of cvsps; in other words, some tests might be marked "expected failure" if cvsps 2.x is being used but "expected success" if cvsps 3.x is being used.
Regarding your claim that "within a few months the Perl git-cvsimport is going to cease even pretending to work": It might be that the old git-cvsimport will stop working *for people who upgrade to cvsps 3.x*. But it is not realistic to expect people to synchronize their git and cvsps version upgrades. It is even quite possible that this or that Linux distribution will package incompatible versions of the two packages.
Michael
Signature · 3 lines
Michael Haggerty [email protected] http://softwareswirl.blogspot.com/
Michael Haggerty <[email protected]>:
Quoted 7 lines
Otherwise, how do we know that cvsps currently works with git-cvsimport? (OK, you claim that it does, but in the next breath you admit that there is a new failure in "one pathological tagging case".) How can we understand its strengths/weaknesses? How can we gain confidence that it works on different platforms? How will we find out if a future versions of cvsps stops working (e.g., because of a breakage or a non-backwards-compatible change)?
You can't. But in practice the git crew was going to lose that capability anyway simply because the new wrapper will support three engines rather than just one. It's not practical for the git tests to handle that many variant external dependencies.
However, there is a solution.
The solution is for git to test that the wrapper is *generating the expected commands*. So what the git tree ends up with is conditional assurance; the wrapper will do the right thing if the engine it calls is working correctly. I think that's really all the git-tree tests can hope for.
Michael, the engines are my problem and yours - it's *our* responsibility to develop a (hopefully shared) test suite to verify that they convert repos correctly. I'm working my end as fast as I can; I hope to have the test suite factored out of cvsps and ready to check multiple engines by around Wednesday. I still need to convert t9604, too.
I have parsecvs working since yesterday, so we really are up to three engines.
I have two minor features I need to merge into parsecvs before I can start on splitting out the test suite.
Signature · 1 line
<a href="http://www.catb.org/~esr/">Eric S. Raymond</a>
Hi Eric,
Quoted 4 lines · Eric S. Raymond
But in practice the git crew was going to lose that
capability anyway simply because the new wrapper will support three engines rather than just one. It's not practical for the git tests to handle that many variant external dependencies.
See the git-blame/git-annotate tests for an example of how the testsuite handles "variations on a theme".
It works fine.
Hope that helps,
Jonathan
Quoted 6 lines · Michael Haggerty
Regarding your claim that "within a few months the Perl git-cvsimport is going to cease even pretending to work": It might be that the old git-cvsimport will stop working *for people who upgrade to cvsps 3.x*. But it is not realistic to expect people to synchronize their git and cvsps version upgrades. It is even quite possible that this or that Linux distribution will package incompatible versions of the two packages.
Moreover, I feel an obligation to point the following out:
In a hypothetical world where cvsps 3.x simply breaks "git cvsimport" it is likely that some distributions would just stick to the existing cvsps and not upgrade to 3.x. Maybe that's a wrong choice, but that's a choice some would make. An even more likely outcome in that hypothetical world is that they would ship it renamed to something like "cvsps3" alongside the existing cvsps. Or they could rename the old version to "cvsps2". If we were the last holdout, we could even bundle it as compat/cvsps.
So please do not act as though the cvsps upgrade is a crisis that we need to break ourselves for at threat of no longer working at all. The threat doesn't hold water.
Luckily you have already written patches to make "git cvsimport" work with cvsps 3.x, and through your work you are making a better
argument: "The new cvsimport + cvsps will work better, at least for some users, than the old tool."
Just don't pretend you have the power to force a change for a less sensible reason than that!
Hope that helps,
Jonathan
Quoted 24 lines · Jonathan Nieder
Quoted 6 lines · Michael Haggerty
Regarding your claim that "within a few months the Perl git-cvsimport is going to cease even pretending to work": It might be that the old git-cvsimport will stop working *for people who upgrade to cvsps 3.x*. But it is not realistic to expect people to synchronize their git and cvsps version upgrades. It is even quite possible that this or that Linux distribution will package incompatible versions of the two packages.
Moreover, I feel an obligation to point the following out:
In a hypothetical world where cvsps 3.x simply breaks "git cvsimport" it is likely that some distributions would just stick to the existing cvsps and not upgrade to 3.x. Maybe that's a wrong choice, but that's a choice some would make. An even more likely outcome in that hypothetical world is that they would ship it renamed to something like "cvsps3" alongside the existing cvsps. Or they could rename the old version to "cvsps2". If we were the last holdout, we could even bundle it as compat/cvsps.
So please do not act as though the cvsps upgrade is a crisis that we need to break ourselves for at threat of no longer working at all. The threat doesn't hold water.
Quoted 7 lines
Luckily you have already written patches to make "git cvsimport" work with cvsps 3.x, and through your work you are making a better
argument: "The new cvsimport + cvsps will work better, at least for some users, than the old tool."Just don't pretend you have the power to force a change for a less sensible reason than that!
After a quick survey of various distros, I think it is very unlikely that we will see "distros move on to newer cvsps, leaving cvsimport broken" situation. If anything, it is more like "distros decide to ignore the new cvsps, until it is made to work with cvsimport" [*1*].
I think it is probably sensible to rename the current cvsimport to cvsimport-2, write a small wrapper git-cvsimport.sh which is something like this:
----- >8 -----
#!/bin/sh
if test -z "$GIT_CVSPS_VERSION"
then
case "$(cvsps -h 2>&1 | grep 'cvsps version')" in
2.*)
GIT_CVSPS_VERSION=2
;;
3.*)
GIT_CVSPS_VERSION=3
;;
esacfi
if test -z "$GIT_CVSPS_VERSION"
then
echo >&2 "No supported cvsps available"
exit 1
fi
exec git cvsimport-$GIT_CVSPS_VERSION "$@"
----- 8< -----
and put Eric's one as git-cvsimport-3 (after ripping out the code to fallback to the old cvsimport). The longer term trend will be to move away from cvsimport-2, as it is unlikely cvsps-2.x will gain improvements, if any; keeping fallback code outside cvsimport-3 will be a better first step in the healthier long term code evolution.
We will keep the current t96xx series of tests, and have them export GIT_CVSPS_VERSION=2 at the beginning, protect them with test prereq that requires presence of cvsps 2.x; this will still make sure that the current cvsimport users will not see any regressions.
Eric's one should be polished enough to produce good results on the simpler sample CVS histories t96xx deal with soonish if not right now, so we can use a method similar to how we shared tests between blame and annotate while both were _different_ implementations to make sure the newer blame did not inroduce regression by running the same set of tests. Where the result _ought_ to differ, we should also add tests that work only with the new cvsimport, of course.
I could help getting the ball rolling on this, if everybody agrees that the above is a sensible direction to go, given the real world constraints of distro inertia.
Agreed?
[References]
*1* Fedora, Debian and Ubuntu do not even have cvsps 3.x in their bleeding edges, OpenBSD and NetBSD do not seem to have it either, and Gentoo and ArchLinux have the cvsps 3.x blocked due to incompatiblity.
http://pkgs.fedoraproject.org/cgit/cvsps.git/
http://packages.debian.org/search?keywords=cvsps
http://packages.ubuntu.com/search?keywords=cvsps
http://packages.gentoo.org/package/dev-vcs/cvsps
https://bugs.gentoo.org/show_bug.cgi?id=450424
https://bugs.archlinux.org/task/33363?project=1&cat%5B0%5D=2&string=cvsps
cover A smoother transition plan for cvsimport
So here is a start of how such a transition plan outlined in the previous message may look like.
The first two are preparatory step to allow the current code to still work even when cvsps2 and cvsps3 are both available on the system.
The last patch is mostly for illustration purposes; the cvsimport-3.py script it adds was taken from the patch Eric sent earlier and I relayed to the list, and does not have later improvements in Eric's tree or any of Chris's patches.
Junio C Hamano (3):
cvsimport: allow setting a custom cvsps (2.x) program name
cvsimport: introduce a version-switch wrapper
cvsimport: start adding cvsps 3.x support
.gitignore | 1 + Makefile | 28 +- git-cvsimport-2.perl | 1179 ++++++++++++++++++++++++++++++++++++++++++++++++++ git-cvsimport-3.py | 344 +++++++++++++++ git-cvsimport.perl | 1177 ------------------------------------------------- git-cvsimport.sh | 5 + t/lib-cvs.sh | 4 +- 7 files changed, 1553 insertions(+), 1185 deletions(-) create mode 100755 git-cvsimport-2.perl create mode 100755 git-cvsimport-3.py delete mode 100755 git-cvsimport.perl create mode 100755 git-cvsimport.sh
Signature · 1 line
1.8.1.421.g6236851
PATCH 1/3 cvsimport: allow setting a custom cvsps (2.x) program name
Distros may ship old cvsps under a different name, or the user may install it outside the normal $PATH. Allow setting CVSPS2_PATH from the build environment.
--- Makefile | 9 +++++++-- git-cvsimport.perl | 4 +++- t/lib-cvs.sh | 4 +++- 3 files changed, 13 insertions(+), 4 deletions(-)
Makefile +7 -2
@@ -571,9 +571,11 @@ endif ifndef PYTHON_PATH PYTHON_PATH = /usr/bin/python endif +ifndef CVSPS2_PATH + CVSPS2_PATH = cvsps +endif -export PERL_PATH -export PYTHON_PATH +export PERL_PATH PYTHON_PATH CVSPS2_PATH LIB_FILE = libgit.a XDIFF_LIB = xdiff/lib.a
@@ -1511,6 +1513,7 @@ SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH)) PERL_PATH_SQ = $(subst ','\'',$(PERL_PATH)) PYTHON_PATH_SQ = $(subst ','\'',$(PYTHON_PATH)) TCLTK_PATH_SQ = $(subst ','\'',$(TCLTK_PATH)) +CVSPS2_PATH_SQ = $(subst ','\'',$(CVSPS2_PATH)) DIFF_SQ = $(subst ','\'',$(DIFF)) LIBS = $(GITLIBS) $(EXTLIBS)
@@ -1724,6 +1727,7 @@ $(patsubst %.perl,%,$(SCRIPT_PERL)): % : %.perl GIT-VERSION-FILE -e ' H' \ -e ' x' \ -e '}' \ + -e 's|@@CVSPS2_PATH@@|$(CVSPS2_PATH_SQ)|g' \ -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \ [email protected] >$@+ && \ chmod +x $@+ && \
@@ -2102,6 +2106,7 @@ GIT-LDFLAGS: FORCE GIT-BUILD-OPTIONS: FORCE @echo SHELL_PATH=\''$(subst ','\'',$(SHELL_PATH_SQ))'\' >$@ @echo PERL_PATH=\''$(subst ','\'',$(PERL_PATH_SQ))'\' >>$@ + @echo CVSPS2_PATH=\''$(subst ','\'',$(CVSPS2_PATH_SQ))'\' >>$@ @echo DIFF=\''$(subst ','\'',$(subst ','\'',$(DIFF)))'\' >>$@ @echo PYTHON_PATH=\''$(subst ','\'',$(PYTHON_PATH_SQ))'\' >>$@ @echo TAR=\''$(subst ','\'',$(subst ','\'',$(TAR)))'\' >>$@
git-cvsimport.perl +3 -1
@@ -33,6 +33,8 @@ our ($opt_h,$opt_o,$opt_v,$opt_k,$opt_u,$opt_d,$opt_p,$opt_C,$opt_z,$opt_i,$opt_P, $opt_s,$opt_m,@opt_M,$opt_A,$opt_S,$opt_L, $opt_a, $opt_r, $opt_R); my (%conv_author_name, %conv_author_email, %conv_author_tz); +my $cvsps2 = "@@CVSPS2_PATH@@"; + sub usage(;$) { my $msg = shift; print(STDERR "Error: $msg\n") if $msg;
@@ -751,7 +753,7 @@ sub munge_user_filename { unless (defined($opt_p) && $opt_p =~ m/--no-cvs-direct/) { push @opt, '--cvs-direct'; } - exec("cvsps","--norc",@opt,"-u","-A",'--root',$opt_d,$cvs_tree); + exec($cvsps2,"--norc",@opt,"-u","-A",'--root',$opt_d,$cvs_tree); die "Could not start cvsps: $!\n"; } ($cvspsfh, $cvspsfile) = tempfile('gitXXXXXX', SUFFIX => '.cvsps',
t/lib-cvs.sh +3 -1
@@ -13,7 +13,9 @@ fi CVS="cvs -f" export CVS -cvsps_version=`cvsps -h 2>&1 | sed -ne 's/cvsps version //p'` +CVSPS="$CVSPS2_PATH" + +cvsps_version=`$CVSPS -h 2>&1 | sed -ne 's/cvsps version //p'` case "$cvsps_version" in 2.1 | 2.2*) ;;
Signature · 1 line
1.8.1.421.g6236851
PATCH 2/3 cvsimport: introduce a version-switch wrapper
In reply to Junio C HamanoIn preparation to have both old and new cvsimport during the transition period, rename the cvsimport script to cvsimport-2 and introduce a small wrapper that we can later change it to allow users to run either frontend (with their corresponding cvsps backends).
--- .gitignore | 1 + Makefile | 3 +- git-cvsimport-2.perl | 1179 ++++++++++++++++++++++++++++++++++++++++++++++++++ git-cvsimport.perl | 1179 -------------------------------------------------- git-cvsimport.sh | 5 + 5 files changed, 1187 insertions(+), 1180 deletions(-) create mode 100755 git-cvsimport-2.perl delete mode 100755 git-cvsimport.perl create mode 100755 git-cvsimport.sh
.gitignore +1 -0
@@ -40,6 +40,7 @@ /git-credential-store /git-cvsexportcommit /git-cvsimport +/git-cvsimport-2 /git-cvsserver /git-daemon /git-diff
Makefile +2 -1
@@ -435,6 +435,7 @@ unexport CDPATH SCRIPT_SH += git-am.sh SCRIPT_SH += git-bisect.sh +SCRIPT_SH += git-cvsimport.sh SCRIPT_SH += git-difftool--helper.sh SCRIPT_SH += git-filter-branch.sh SCRIPT_SH += git-lost-found.sh
@@ -463,7 +464,7 @@ SCRIPT_PERL += git-add--interactive.perl SCRIPT_PERL += git-difftool.perl SCRIPT_PERL += git-archimport.perl SCRIPT_PERL += git-cvsexportcommit.perl -SCRIPT_PERL += git-cvsimport.perl +SCRIPT_PERL += git-cvsimport-2.perl SCRIPT_PERL += git-cvsserver.perl SCRIPT_PERL += git-relink.perl SCRIPT_PERL += git-send-email.perl
git-cvsimport-2.perl new file +1179 -0
1,179 lines not on this page · raw message
git-cvsimport.perl deleted +0 -1179
1,179 lines not on this page · raw message
git-cvsimport.sh new file +5 -0
@@ -0,0 +1,5 @@ +#!/bin/sh + +GIT_CVSPS_VERSION=2 + +exec git cvsimport-$GIT_CVSPS_VERSION "$@"
Signature · 1 line
1.8.1.421.g6236851
Re: [PATCH 2/3] cvsimport: introduce a version-switch wrapper
Quoted 6 lines · Junio C Hamano
In preparation to have both old and new cvsimport during the transition period, rename the cvsimport script to cvsimport-2 and introduce a small wrapper that we can later change it to allow users to run either frontend (with their corresponding cvsps backends).
Quoted 6 lines
Signed-off-by Junio C Hamano <[email protected]>--- .gitignore | 1 + Makefile | 3 +- git-cvsimport-2.perl | 1179 ++++++++++++++++++++++++++++++++++++++++++++++++++ git-cvsimport.perl | 1179 --------------------------------------------------
Sorry, I should have done "format-patch -M" for this one.
PATCH 3/3 cvsimport: start adding cvsps 3.x support
In reply to Junio C HamanoThe new cvsps 3.x series lacks support of some options cvsps 2.x series had and used by cvsimport-2; add a replacement program from the author of cvsps 3.x and allow users to choose it by setting the GIT_CVSPS_VERSION environment variable to 3. We would later add support to auto-detect the version of installed cvsps to this code when the environment variable is not set.
Note that in this step, cvsimport-3 that relies on cvsps 3.x does not have any test coverage. As cvsimport-3 supports most of the command line options cvsimport-2, we should be able to tweak some of t96xx tests and run them with GIT_CVSPS_VERSION set to both 2 and 3, but that is a topic of later patches that should come on top.
--- Makefile | 18 ++- git-cvsimport-3.py | 344 +++++++++++++++++++++++++++++++++++++++++++++++++++++ git-cvsimport.sh | 4 +- 3 files changed, 359 insertions(+), 7 deletions(-) create mode 100755 git-cvsimport-3.py
Makefile +13 -5
@@ -470,8 +470,9 @@ SCRIPT_PERL += git-relink.perl SCRIPT_PERL += git-send-email.perl SCRIPT_PERL += git-svn.perl -SCRIPT_PYTHON += git-remote-testpy.py +SCRIPT_PYTHON += git-cvsimport-3.py SCRIPT_PYTHON += git-p4.py +SCRIPT_PYTHON += git-remote-testpy.py SCRIPTS = $(patsubst %.sh,%,$(SCRIPT_SH)) \ $(patsubst %.perl,%,$(SCRIPT_PERL)) \
@@ -575,8 +576,11 @@ endif ifndef CVSPS2_PATH CVSPS2_PATH = cvsps endif +ifndef CVSPS3_PATH + CVSPS3_PATH = cvsps +endif -export PERL_PATH PYTHON_PATH CVSPS2_PATH +export PERL_PATH PYTHON_PATH CVSPS2_PATH CVSPS3_PATH LIB_FILE = libgit.a XDIFF_LIB = xdiff/lib.a
@@ -1515,6 +1519,7 @@ PERL_PATH_SQ = $(subst ','\'',$(PERL_PATH)) PYTHON_PATH_SQ = $(subst ','\'',$(PYTHON_PATH)) TCLTK_PATH_SQ = $(subst ','\'',$(TCLTK_PATH)) CVSPS2_PATH_SQ = $(subst ','\'',$(CVSPS2_PATH)) +CVSPS3_PATH_SQ = $(subst ','\'',$(CVSPS3_PATH)) DIFF_SQ = $(subst ','\'',$(DIFF)) LIBS = $(GITLIBS) $(EXTLIBS)
@@ -1757,12 +1762,15 @@ ifndef NO_PYTHON $(patsubst %.py,%,$(SCRIPT_PYTHON)): GIT-CFLAGS GIT-PREFIX GIT-PYTHON-VARS $(patsubst %.py,%,$(SCRIPT_PYTHON)): % : %.py $(QUIET_GEN)$(RM) $@ $@+ && \ - INSTLIBDIR=`MAKEFLAGS= $(MAKE) -C git_remote_helpers -s \ + INSTLIBDIR_SQ=`MAKEFLAGS= $(MAKE) -C git_remote_helpers -s \ --no-print-directory prefix='$(prefix_SQ)' DESTDIR='$(DESTDIR_SQ)' \ - instlibdir` && \ + instlibdir | \ + sed -e "s/'/'\''/g"` && \ + echo "InstLibDir is <$$INSTLIBDIR_SQ>" && \ sed -e '1s|#!.*python|#!$(PYTHON_PATH_SQ)|' \ -e 's|\(os\.getenv("GITPYTHONLIB"\)[^)]*)|\1,"@@INSTLIBDIR@@")|' \ - -e 's|@@INSTLIBDIR@@|'"$$INSTLIBDIR"'|g' \ + -e 's|@@CVSPS3_PATH@@|$(CVSPS3_PATH_SQ)|g' \ + -e 's|@@INSTLIBDIR@@|'"$$INSTLIBDIR_SQ"'|g' \ [email protected] >$@+ && \ chmod +x $@+ && \ mv $@+ $@
git-cvsimport-3.py new file +344 -0
344 lines not on this page · raw message
git-cvsimport.sh +2 -2
@@ -1,5 +1,5 @@ #!/bin/sh -GIT_CVSPS_VERSION=2 +: ${GIT_CVSPS_VERSION=2} -exec git cvsimport-$GIT_CVSPS_VERSION "$@" +exec git "cvsimport-$GIT_CVSPS_VERSION" "$@"
Signature · 1 line
1.8.1.421.g6236851
Re: [PATCH 3/3] cvsimport: start adding cvsps 3.x support
Quoted 169 lines · Junio C Hamano
The new cvsps 3.x series lacks support of some options cvsps 2.x series had and used by cvsimport-2; add a replacement program from the author of cvsps 3.x and allow users to choose it by setting the
GIT_CVSPS_VERSIONenvironment variable to 3. We would later add support to auto-detect the version of installed cvsps to this code when the environment variable is not set.Note that in this step, cvsimport-3 that relies on cvsps 3.x does not have any test coverage. As cvsimport-3 supports most of the command line options cvsimport-2, we should be able to tweak some of t96xx tests and run them with
GIT_CVSPS_VERSIONset to both 2 and 3, but that is a topic of later patches that should come on top.Signed-off-by Junio C Hamano <[email protected]>--- Makefile | 18 ++- git-cvsimport-3.py | 344 +++++++++++++++++++++++++++++++++++++++++++++++++++++ git-cvsimport.sh | 4 +- 3 files changed, 359 insertions(+), 7 deletions(-) create mode 100755 git-cvsimport-3.pyMakefile +13
-5@@ -470,8 +470,9 @@ SCRIPT_PERL += git-relink.perl SCRIPT_PERL += git-send-email.perl SCRIPT_PERL += git-svn.perl -SCRIPT_PYTHON += git-remote-testpy.py +SCRIPT_PYTHON += git-cvsimport-3.py SCRIPT_PYTHON += git-p4.py +SCRIPT_PYTHON += git-remote-testpy.py SCRIPTS = $(patsubst %.sh,%,$(SCRIPT_SH)) \ $(patsubst %.perl,%,$(SCRIPT_PERL)) \@@ -575,8 +576,11 @@ endif ifndef CVSPS2_PATH CVSPS2_PATH = cvsps endif +ifndef CVSPS3_PATH + CVSPS3_PATH = cvsps +endif -export PERL_PATH PYTHON_PATH CVSPS2_PATH +export PERL_PATH PYTHON_PATH CVSPS2_PATH CVSPS3_PATH LIB_FILE = libgit.a XDIFF_LIB = xdiff/lib.a@@ -1515,6 +1519,7 @@ PERL_PATH_SQ = $(subst ','\'',$(PERL_PATH)) PYTHON_PATH_SQ = $(subst ','\'',$(PYTHON_PATH)) TCLTK_PATH_SQ = $(subst ','\'',$(TCLTK_PATH)) CVSPS2_PATH_SQ = $(subst ','\'',$(CVSPS2_PATH)) +CVSPS3_PATH_SQ = $(subst ','\'',$(CVSPS3_PATH)) DIFF_SQ = $(subst ','\'',$(DIFF)) LIBS = $(GITLIBS) $(EXTLIBS)@@ -1757,12 +1762,15 @@ ifndef NO_PYTHON $(patsubst %.py,%,$(SCRIPT_PYTHON)): GIT-CFLAGS GIT-PREFIX GIT-PYTHON-VARS $(patsubst %.py,%,$(SCRIPT_PYTHON)): % : %.py $(QUIET_GEN)$(RM) $@ $@+ && \ - INSTLIBDIR=`MAKEFLAGS= $(MAKE) -C git_remote_helpers -s \ + INSTLIBDIR_SQ=`MAKEFLAGS= $(MAKE) -C git_remote_helpers -s \ --no-print-directory prefix='$(prefix_SQ)' DESTDIR='$(DESTDIR_SQ)' \ - instlibdir` && \ + instlibdir | \ + sed -e "s/'/'\''/g"` && \ + echo "InstLibDir is <$$INSTLIBDIR_SQ>" && \ sed -e '1s|#!.*python|#!$(PYTHON_PATH_SQ)|' \ -e 's|\(os\.getenv("GITPYTHONLIB"\)[^)]*)|\1,"@@INSTLIBDIR@@")|' \ - -e 's|@@INSTLIBDIR@@|'"$$INSTLIBDIR"'|g' \ + -e 's|@@CVSPS3_PATH@@|$(CVSPS3_PATH_SQ)|g' \ + -e 's|@@INSTLIBDIR@@|'"$$INSTLIBDIR_SQ"'|g' \ [email protected] >$@+ && \ chmod +x $@+ && \ mv $@+ $@git-cvsimport-3.py new file +87
-0@@ -0,0 +1,344 @@ +#!/usr/bin/env python +# +# Import CVS history into git +# +# Intended to be a near-workalike of Matthias Urlichs's Perl implementation. +# +# By Eric S. Raymond <[email protected]>, December 2012 +# May be redistributed under the license of the git project. + +import sys + +if sys.hexversion < 0x02060000: + sys.stderr.write("git cvsimport: requires Python 2.6 or later.\n") + sys.exit(1) + +import os, getopt, subprocess, tempfile, shutil + +DEBUG_COMMANDS = 1 + +class Fatal(Exception): + "Unrecoverable error." + def __init__(self, msg): + Exception.__init__(self) + self.msg = msg + +def do_or_die(dcmd, legend=""): + "Either execute a command or raise a fatal exception." + if legend: + legend = " " + legend + if verbose >= DEBUG_COMMANDS: + sys.stdout.write("git cvsimport: executing '%s'%s\n" % (dcmd, legend)) + try: + retcode = subprocess.call(dcmd, shell=True) + if retcode < 0: + raise Fatal("git cvsimport: child was terminated by signal %d." % -retcode) + elif retcode != 0: + raise Fatal("git cvsimport: child returned %d." % retcode) + except (OSError, IOError) as e: + raise Fatal("git cvsimport: execution of %s%s failed: %s" % (dcmd, legend, e)) + +def capture_or_die(dcmd, legend=""): + "Either execute a command and capture its output or die." + if legend: + legend = " " + legend + if verbose >= DEBUG_COMMANDS: + sys.stdout.write("git cvsimport: executing '%s'%s\n" % (dcmd, legend)) + try: + return subprocess.check_output(dcmd, shell=True) + except subprocess.CalledProcessError as e: + if e.returncode < 0: + sys.stderr.write("git cvsimport: child was terminated by signal %d." % -e.returncode) + elif e.returncode != 0: + sys.stderr.write("git cvsimport: child returned %d." % e.returncode) + sys.exit(1) + +class cvsps: + "Method class for cvsps back end." + + cvsps = "@@CVSPS3_PATH@@" + def __init__(self): + self.opts = "" + self.revmap = None + def set_repo(self, val): + "Set the repository root option." + if not val.startswith(":"): + if not val.startswith(os.sep): + val = os.path.abspath(val) + val = ":local:" + val + self.opts += " --root '%s'" % val + def set_authormap(self, val): + "Set the author-map file." + self.opts += " -A '%s'" % val + def set_fuzz(self, val): + "Set the commit-similarity window." + self.opts += " -z %s" % val + def set_nokeywords(self): + "Suppress CVS keyword expansion." + self.opts += " -k" + def add_opts(self, val): + "Add options to the engine command line." + self.opts += " " + val + def set_exclusion(self, val): + "Set a file exclusion regexp." + self.opts += " -n -f '%s'" % val + def set_after(self, val): + "Set a date threshold for incremental import." + self.opts += " -d '%s'" % val
git-cvsimport-3.py line 97
Quoted 10 lines
git-cvsimport-3.py new file +10
-0+ def set_revmap(self, val): + "Set the file to which the engine should dump a reference map." + self.revmap = val + self.opts += " -R '%s'" % self.revmap + def set_module(self, val): + "Set the module to query." + self.opts += " " + val + def command(self): + "Emit the command implied by all previous options." + return self.cvsps + "--fast-export " + self.opts
"--fast-export" string is missing a leading space. With this fix and the latest cvsps build I'm seeing 6 of 15 failures for t9650 which is what I was getting out of the patched t9600.
Chris
Re: [PATCH 3/3] cvsimport: start adding cvsps 3.x support
Chris Rorvick <[email protected]> writes:
[jc: please elide parts you are not responding to, leaving enough lines to understand the context]
Quoted 7 lines
git-cvsimport-3.py line 97
Quoted 3 lines
git-cvsimport-3.py new file +3
-0+ def command(self): + "Emit the command implied by all previous options." + return self.cvsps + "--fast-export " + self.opts"--fast-export" string is missing a leading space. With this fix and the latest cvsps build I'm seeing 6 of 15 failures for t9650 which is what I was getting out of the patched t9600.
Thanks; I'll amend it and push the result out, but I think we will need to rip this part out and form the command string in a saner way (e.g. if the path needs to have SP in it, e.g. "/Program Files/cvsps3", the above would not work correctly anyway).
Quoted 73 lines · Junio C Hamano
Quoted 24 lines · Jonathan Nieder
Quoted 6 lines · Michael Haggerty
Regarding your claim that "within a few months the Perl git-cvsimport is going to cease even pretending to work": It might be that the old git-cvsimport will stop working *for people who upgrade to cvsps 3.x*. But it is not realistic to expect people to synchronize their git and cvsps version upgrades. It is even quite possible that this or that Linux distribution will package incompatible versions of the two packages.
Moreover, I feel an obligation to point the following out:
In a hypothetical world where cvsps 3.x simply breaks "git cvsimport" it is likely that some distributions would just stick to the existing cvsps and not upgrade to 3.x. Maybe that's a wrong choice, but that's a choice some would make. An even more likely outcome in that hypothetical world is that they would ship it renamed to something like "cvsps3" alongside the existing cvsps. Or they could rename the old version to "cvsps2". If we were the last holdout, we could even bundle it as compat/cvsps.
So please do not act as though the cvsps upgrade is a crisis that we need to break ourselves for at threat of no longer working at all. The threat doesn't hold water.
Quoted 7 lines
Luckily you have already written patches to make "git cvsimport" work with cvsps 3.x, and through your work you are making a better
argument: "The new cvsimport + cvsps will work better, at least for some users, than the old tool."Just don't pretend you have the power to force a change for a less sensible reason than that!
After a quick survey of various distros, I think it is very unlikely that we will see "distros move on to newer cvsps, leaving cvsimport broken" situation. If anything, it is more like "distros decide to ignore the new cvsps, until it is made to work with cvsimport" [*1*].
I think it is probably sensible to rename the current cvsimport to cvsimport-2, write a small wrapper
git-cvsimport.shwhich is something like this:----- >8 -----
#!/bin/shif test -z "$GIT_CVSPS_VERSION"
thencase "$(cvsps -h 2>&1 | grep 'cvsps version')" in 2.*) GIT_CVSPS_VERSION=2 ;; 3.*) GIT_CVSPS_VERSION=3 ;; esacfi
if test -z "$GIT_CVSPS_VERSION"
then
echo >&2 "No supported cvsps available"
exit 1
fiexec git cvsimport-$GIT_CVSPS_VERSION "$@"
----- 8< -----and put Eric's one as git-cvsimport-3 (after ripping out the code to fallback to the old cvsimport). The longer term trend will be to move away from cvsimport-2, as it is unlikely cvsps-2.x will gain improvements, if any; keeping fallback code outside cvsimport-3 will be a better first step in the healthier long term code evolution.
Quoted 6 lines
We will keep the current t96xx series of tests, and have them export GIT_CVSPS_VERSION=2 at the beginning, protect them with test prereq that requires presence of cvsps 2.x; this will still make sure that the current cvsimport users will not see any regressions.
Eric's one should be polished enough to produce good results on the
s/should be polished enough/should be in a polished enough state/ that is. Also "if not right now" may better convey what I meant if written "if not already".
Quoted 29 lines
simpler sample CVS histories t96xx deal with soonish if not right now, so we can use a method similar to how we shared tests between blame and annotate while both were _different_ implementations to make sure the newer blame did not inroduce regression by running the same set of tests. Where the result _ought_ to differ, we should also add tests that work only with the new cvsimport, of course.
I could help getting the ball rolling on this, if everybody agrees that the above is a sensible direction to go, given the real world constraints of distro inertia.
Agreed?
[References]
*1* Fedora, Debian and Ubuntu do not even have cvsps 3.x in their bleeding edges, OpenBSD and NetBSD do not seem to have it either, and Gentoo and ArchLinux have the cvsps 3.x blocked due to incompatiblity.
http://pkgs.fedoraproject.org/cgit/cvsps.git/
http://packages.debian.org/search?keywords=cvsps
http://packages.ubuntu.com/search?keywords=cvspshttp://packages.gentoo.org/package/dev-vcs/cvsps
https://bugs.gentoo.org/show_bug.cgi?id=450424https://bugs.archlinux.org/task/33363?project=1&cat%5B0%5D=2&string=cvsps
v2 cover A smoother transition plan for cvsimport
In reply to Junio C HamanoThe theme is the same as the previous 3-patch series ($gmane/213415).
The first one is unrelated.
The last two are new, adding the "dual-use test" framework hinted at the end of the previous round.
Oh, also this time the series is formatted with "format-patch -M", to avoid overwhelming the readers with the rename.
Junio C Hamano (6):
Makefile: add description on PERL/PYTHON_PATH
cvsimport: allow setting a custom cvsps (2.x) program name
cvsimport: introduce a version-switch wrapper
cvsimport: start adding cvsps 3.x support
cvsimport: make tests reusable for cvsimport-3
cvsimport-3: add a sample test
.gitignore | 1 + Makefile | 43 +++- git-cvsimport.perl => git-cvsimport-2.perl | 4 +- git-cvsimport-3.py | 344 +++++++++++++++++++++++++++++ git-cvsimport.sh | 5 + t/lib-cvs.sh | 55 ++++- t/t9650-cvsimport3.sh | 4 + 7 files changed, 440 insertions(+), 16 deletions(-) rename git-cvsimport.perl => git-cvsimport-2.perl (99%) create mode 100755 git-cvsimport-3.py create mode 100755 git-cvsimport.sh create mode 100755 t/t9650-cvsimport3.sh
Signature · 1 line
1.8.1.421.g6236851
PATCH v2 1/6 Makefile: add description on PERL/PYTHON_PATH
--- Makefile | 5 +++++ 1 file changed, 5 insertions(+)
Makefile +5 -0
@@ -241,11 +241,16 @@ all:: # apostrophes to be ASCII so that cut&pasting examples to the shell # will work. # +# Define PERL_PATH to the path of your Perl binary (usually /usr/bin/perl). +# # Define NO_PERL_MAKEMAKER if you cannot use Makefiles generated by perl's # MakeMaker (e.g. using ActiveState under Cygwin). # # Define NO_PERL if you do not want Perl scripts or libraries at all. # +# Define PYTHON_PATH to the path of your Python binary (often /usr/bin/python +# but /usr/bin/python2.7 on some platforms). +# # Define NO_PYTHON if you do not want Python scripts or libraries at all. # # Define NO_TCLTK if you do not want Tcl/Tk GUI.
Signature · 1 line
1.8.1.421.g6236851
PATCH v2 2/6 cvsimport: allow setting a custom cvsps (2.x) program name
In reply to Junio C HamanoDistros may ship old cvsps under a different name, or the user may install it outside the normal $PATH. Allow setting CVSPS2_PATH from the build environment.
--- Makefile | 9 +++++++-- git-cvsimport.perl | 4 +++- t/lib-cvs.sh | 4 +++- 3 files changed, 13 insertions(+), 4 deletions(-)
Makefile +7 -2
@@ -576,9 +576,11 @@ endif ifndef PYTHON_PATH PYTHON_PATH = /usr/bin/python endif +ifndef CVSPS2_PATH + CVSPS2_PATH = cvsps +endif -export PERL_PATH -export PYTHON_PATH +export PERL_PATH PYTHON_PATH CVSPS2_PATH LIB_FILE = libgit.a XDIFF_LIB = xdiff/lib.a
@@ -1516,6 +1518,7 @@ SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH)) PERL_PATH_SQ = $(subst ','\'',$(PERL_PATH)) PYTHON_PATH_SQ = $(subst ','\'',$(PYTHON_PATH)) TCLTK_PATH_SQ = $(subst ','\'',$(TCLTK_PATH)) +CVSPS2_PATH_SQ = $(subst ','\'',$(CVSPS2_PATH)) DIFF_SQ = $(subst ','\'',$(DIFF)) LIBS = $(GITLIBS) $(EXTLIBS)
@@ -1729,6 +1732,7 @@ $(patsubst %.perl,%,$(SCRIPT_PERL)): % : %.perl GIT-VERSION-FILE -e ' H' \ -e ' x' \ -e '}' \ + -e 's|@@CVSPS2_PATH@@|$(CVSPS2_PATH_SQ)|g' \ -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \ [email protected] >$@+ && \ chmod +x $@+ && \
@@ -2107,6 +2111,7 @@ GIT-LDFLAGS: FORCE GIT-BUILD-OPTIONS: FORCE @echo SHELL_PATH=\''$(subst ','\'',$(SHELL_PATH_SQ))'\' >$@ @echo PERL_PATH=\''$(subst ','\'',$(PERL_PATH_SQ))'\' >>$@ + @echo CVSPS2_PATH=\''$(subst ','\'',$(CVSPS2_PATH_SQ))'\' >>$@ @echo DIFF=\''$(subst ','\'',$(subst ','\'',$(DIFF)))'\' >>$@ @echo PYTHON_PATH=\''$(subst ','\'',$(PYTHON_PATH_SQ))'\' >>$@ @echo TAR=\''$(subst ','\'',$(subst ','\'',$(TAR)))'\' >>$@
git-cvsimport.perl +3 -1
@@ -33,6 +33,8 @@ our ($opt_h,$opt_o,$opt_v,$opt_k,$opt_u,$opt_d,$opt_p,$opt_C,$opt_z,$opt_i,$opt_P, $opt_s,$opt_m,@opt_M,$opt_A,$opt_S,$opt_L, $opt_a, $opt_r, $opt_R); my (%conv_author_name, %conv_author_email, %conv_author_tz); +my $cvsps2 = "@@CVSPS2_PATH@@"; + sub usage(;$) { my $msg = shift; print(STDERR "Error: $msg\n") if $msg;
@@ -751,7 +753,7 @@ sub munge_user_filename { unless (defined($opt_p) && $opt_p =~ m/--no-cvs-direct/) { push @opt, '--cvs-direct'; } - exec("cvsps","--norc",@opt,"-u","-A",'--root',$opt_d,$cvs_tree); + exec($cvsps2,"--norc",@opt,"-u","-A",'--root',$opt_d,$cvs_tree); die "Could not start cvsps: $!\n"; } ($cvspsfh, $cvspsfile) = tempfile('gitXXXXXX', SUFFIX => '.cvsps',
t/lib-cvs.sh +3 -1
@@ -13,7 +13,9 @@ fi CVS="cvs -f" export CVS -cvsps_version=`cvsps -h 2>&1 | sed -ne 's/cvsps version //p'` +CVSPS="$CVSPS2_PATH" + +cvsps_version=`$CVSPS -h 2>&1 | sed -ne 's/cvsps version //p'` case "$cvsps_version" in 2.1 | 2.2*) ;;
Signature · 1 line
1.8.1.421.g6236851
PATCH v2 3/6 cvsimport: introduce a version-switch wrapper
In reply to Junio C HamanoIn preparation to have both old and new cvsimport during the transition period, rename the cvsimport script to cvsimport-2 and introduce a small wrapper that we can later change it to allow users to run either frontend (with their corresponding cvsps backends).
--- .gitignore | 1 + Makefile | 9 ++++++++- git-cvsimport.perl => git-cvsimport-2.perl | 0 git-cvsimport.sh | 5 +++++ 4 files changed, 14 insertions(+), 1 deletion(-) rename git-cvsimport.perl => git-cvsimport-2.perl (100%) create mode 100755 git-cvsimport.sh
.gitignore +1 -0
@@ -40,6 +40,7 @@ /git-credential-store /git-cvsexportcommit /git-cvsimport +/git-cvsimport-2 /git-cvsserver /git-daemon /git-diff
Makefile +8 -1
@@ -253,6 +253,9 @@ all:: # # Define NO_PYTHON if you do not want Python scripts or libraries at all. # +# Define CVSPS2_PATH if you cannot invoke cvsps (version 2.x) as "cvsps" +# using your $PATH; if you do not have any, define CVSPS2_PATH=NoThanks. +# # Define NO_TCLTK if you do not want Tcl/Tk GUI. # # The TCL_PATH variable governs the location of the Tcl interpreter
@@ -440,6 +443,7 @@ unexport CDPATH SCRIPT_SH += git-am.sh SCRIPT_SH += git-bisect.sh +SCRIPT_SH += git-cvsimport.sh SCRIPT_SH += git-difftool--helper.sh SCRIPT_SH += git-filter-branch.sh SCRIPT_SH += git-lost-found.sh
@@ -468,12 +472,15 @@ SCRIPT_PERL += git-add--interactive.perl SCRIPT_PERL += git-difftool.perl SCRIPT_PERL += git-archimport.perl SCRIPT_PERL += git-cvsexportcommit.perl -SCRIPT_PERL += git-cvsimport.perl +ifneq ($(CVSPS2_PATH),NoThanks) +SCRIPT_PERL += git-cvsimport-2.perl +endif SCRIPT_PERL += git-cvsserver.perl SCRIPT_PERL += git-relink.perl SCRIPT_PERL += git-send-email.perl SCRIPT_PERL += git-svn.perl +SCRIPT_PYTHON += git-p4.py SCRIPT_PYTHON += git-remote-testpy.py SCRIPT_PYTHON += git-p4.py
git-cvsimport-2.perl renamed from git-cvsimport.perl +0 -0
git-cvsimport.sh new file +5 -0
@@ -0,0 +1,5 @@ +#!/bin/sh + +GIT_CVSPS_VERSION=2 + +exec git cvsimport-$GIT_CVSPS_VERSION "$@"
Signature · 1 line
1.8.1.421.g6236851
PATCH v2 4/6 cvsimport: start adding cvsps 3.x support
In reply to Junio C HamanoThe new cvsps 3.x series lacks support of some options cvsps 2.x series had and used by cvsimport-2; add a replacement program from the author of cvsps 3.x and allow users to choose it by setting the GIT_CVSPS_VERSION environment variable to 3. We would later add support to auto-detect the version of installed cvsps to this code when the environment variable is not set.
Note that in this step, cvsimport-3 that relies on cvsps 3.x does not have any test coverage. As cvsimport-3 supports most of the command line options cvsimport-2, we should be able to tweak some of the t96?? tests and run them with GIT_CVSPS_VERSION set to both 2 and 3, but that is a topic of later patches that should come on top.
--- Makefile | 22 +++- git-cvsimport-3.py | 344 +++++++++++++++++++++++++++++++++++++++++++++++++++++ git-cvsimport.sh | 4 +- 3 files changed, 363 insertions(+), 7 deletions(-) create mode 100755 git-cvsimport-3.py
Makefile +17 -5
@@ -256,6 +256,9 @@ all:: # Define CVSPS2_PATH if you cannot invoke cvsps (version 2.x) as "cvsps" # using your $PATH; if you do not have any, define CVSPS2_PATH=NoThanks. # +# Define CVSPS3_PATH if you cannot invoke cvsps (version 3.x) as "cvsps" +# using your $PATH; if you do not have any, define CVSPS3_PATH=NoThanks. +# # Define NO_TCLTK if you do not want Tcl/Tk GUI. # # The TCL_PATH variable governs the location of the Tcl interpreter
@@ -480,9 +483,11 @@ SCRIPT_PERL += git-relink.perl SCRIPT_PERL += git-send-email.perl SCRIPT_PERL += git-svn.perl +ifneq ($(CVSPS3_PATH),NoThanks) +SCRIPT_PYTHON += git-cvsimport-3.py +endif SCRIPT_PYTHON += git-p4.py SCRIPT_PYTHON += git-remote-testpy.py -SCRIPT_PYTHON += git-p4.py SCRIPTS = $(patsubst %.sh,%,$(SCRIPT_SH)) \ $(patsubst %.perl,%,$(SCRIPT_PERL)) \
@@ -586,8 +591,11 @@ endif ifndef CVSPS2_PATH CVSPS2_PATH = cvsps endif +ifndef CVSPS3_PATH + CVSPS3_PATH = cvsps +endif -export PERL_PATH PYTHON_PATH CVSPS2_PATH +export PERL_PATH PYTHON_PATH CVSPS2_PATH CVSPS3_PATH LIB_FILE = libgit.a XDIFF_LIB = xdiff/lib.a
@@ -1526,6 +1534,7 @@ PERL_PATH_SQ = $(subst ','\'',$(PERL_PATH)) PYTHON_PATH_SQ = $(subst ','\'',$(PYTHON_PATH)) TCLTK_PATH_SQ = $(subst ','\'',$(TCLTK_PATH)) CVSPS2_PATH_SQ = $(subst ','\'',$(CVSPS2_PATH)) +CVSPS3_PATH_SQ = $(subst ','\'',$(CVSPS3_PATH)) DIFF_SQ = $(subst ','\'',$(DIFF)) LIBS = $(GITLIBS) $(EXTLIBS)
@@ -1768,12 +1777,14 @@ ifndef NO_PYTHON $(patsubst %.py,%,$(SCRIPT_PYTHON)): GIT-CFLAGS GIT-PREFIX GIT-PYTHON-VARS $(patsubst %.py,%,$(SCRIPT_PYTHON)): % : %.py $(QUIET_GEN)$(RM) $@ $@+ && \ - INSTLIBDIR=`MAKEFLAGS= $(MAKE) -C git_remote_helpers -s \ + INSTLIBDIR_SQ=`MAKEFLAGS= $(MAKE) -C git_remote_helpers -s \ --no-print-directory prefix='$(prefix_SQ)' DESTDIR='$(DESTDIR_SQ)' \ - instlibdir` && \ + instlibdir | \ + sed -e "s/'/'\''/g"` && \ sed -e '1s|#!.*python|#!$(PYTHON_PATH_SQ)|' \ -e 's|\(os\.getenv("GITPYTHONLIB"\)[^)]*)|\1,"@@INSTLIBDIR@@")|' \ - -e 's|@@INSTLIBDIR@@|'"$$INSTLIBDIR"'|g' \ + -e 's|@@CVSPS3_PATH@@|$(CVSPS3_PATH_SQ)|g' \ + -e 's|@@INSTLIBDIR@@|'"$$INSTLIBDIR_SQ"'|g' \ [email protected] >$@+ && \ chmod +x $@+ && \ mv $@+ $@
@@ -2119,6 +2130,7 @@ GIT-BUILD-OPTIONS: FORCE @echo SHELL_PATH=\''$(subst ','\'',$(SHELL_PATH_SQ))'\' >$@ @echo PERL_PATH=\''$(subst ','\'',$(PERL_PATH_SQ))'\' >>$@ @echo CVSPS2_PATH=\''$(subst ','\'',$(CVSPS2_PATH_SQ))'\' >>$@ + @echo CVSPS3_PATH=\''$(subst ','\'',$(CVSPS3_PATH_SQ))'\' >>$@ @echo DIFF=\''$(subst ','\'',$(subst ','\'',$(DIFF)))'\' >>$@ @echo PYTHON_PATH=\''$(subst ','\'',$(PYTHON_PATH_SQ))'\' >>$@ @echo TAR=\''$(subst ','\'',$(subst ','\'',$(TAR)))'\' >>$@
git-cvsimport-3.py new file +344 -0
344 lines not on this page · raw message
git-cvsimport.sh +2 -2
@@ -1,5 +1,5 @@ #!/bin/sh -GIT_CVSPS_VERSION=2 +: ${GIT_CVSPS_VERSION=2} -exec git cvsimport-$GIT_CVSPS_VERSION "$@" +exec git "cvsimport-$GIT_CVSPS_VERSION" "$@"
Signature · 1 line
1.8.1.421.g6236851
PATCH v2 5/6 cvsimport: make tests reusable for cvsimport-3
In reply to Junio C HamanoThis way, a dual-use test can be dot-sourced into a new test script after defining GIT_CVSPS_VERSION=3 to test that the new cvsimport with cvsps (3.x) works on simple test histories that old cvsimport can grok correctly.
Also allow CVSPS2_PATH and CVSPS3_PATH to be defined as "NoThanks" to cause the tests in t96?? series to be skipped.
--- t/lib-cvs.sh | 57 +++++++++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 47 insertions(+), 10 deletions(-)
t/lib-cvs.sh +47 -10
@@ -1,5 +1,8 @@ #!/bin/sh +: ${TEST_CVSPS_VERSION=2} +export TEST_CVSPS_VERSION + . ./test-lib.sh unset CVS_SERVER
@@ -13,22 +16,56 @@ fi CVS="cvs -f" export CVS -CVSPS="$CVSPS2_PATH" - -cvsps_version=`$CVSPS -h 2>&1 | sed -ne 's/cvsps version //p'` -case "$cvsps_version" in -2.1 | 2.2*) +skip_all= +case "$TEST_CVSPS_VERSION" in +2) + if test "$CVSPS2_PATH" = NoThanks + then + skip_all='skipping cvsimport tests, cvsps(2) not used' + else + case $($CVSPS2_PATH -h 2>&1 | sed -ne 's/cvsps version //p') in + 2.1 | 2.2*) + ;; + '') + skip_all='skipping cvsimport tests, cvsps(2) not found' + ;; + *) + skip_all='skipping cvsimport tests, unsupported cvsps(2)' + ;; + esac + fi ;; -'') - skip_all='skipping cvsimport tests, cvsps not found' - test_done +3) + if test "$CVSPS3_PATH" = NoThanks + then + skip_all='skipping cvsimport tests, cvsps(3) not used' + else + case $($CVSPS3_PATH -h 2>&1 | sed -ne 's/cvsps version //p') in + 3.*) + ;; + '') + skip_all='skipping cvsimport tests, cvsps(3) not found' + ;; + *) + skip_all='skipping cvsimport tests, unsupported cvsps(3)' + ;; + esac + fi ;; *) - skip_all='skipping cvsimport tests, unsupported cvsps version' - test_done + echo >&2 "Bug in test: set TEST_CVSPS_VESION to either 2 or 3" + exit 1 ;; esac +GIT_CVSPS_VERSION=$TEST_CVSPS_VERSION +export GIT_CVSPS_VERSION + +if test -n "$skip_all" +then + test_done +fi + setup_cvs_test_repository () { CVSROOT="$(pwd)/.cvsroot" && cp -r "$TEST_DIRECTORY/$1/cvsroot" "$CVSROOT" &&
Signature · 1 line
1.8.1.421.g6236851
PATCH v2 6/6 cvsimport-3: add a sample test
In reply to Junio C HamanoThis is primarily for illustration to show how the support introduced by the previous step can be used.
Some parts of t9600 needs to be made conditional to the value of TEST_CVSPS_VERSION to avoid passing options the new cvsimport does not need or understand, before this can become usable as a real test.
--- t/t9650-cvsimport3.sh | 4 ++++ 1 file changed, 4 insertions(+) create mode 100755 t/t9650-cvsimport3.sh
t/t9650-cvsimport3.sh new file +4 -0
@@ -0,0 +1,4 @@ +#!/bin/sh + +TEST_CVSPS_VERSION=3 +. ./t9600-cvsimport.sh
Signature · 1 line
1.8.1.421.g6236851
Re: [PATCH v2 0/6] A smoother transition plan for cvsimport
In reply to Junio C HamanoQuoted 7 lines · Junio C Hamano
Junio C Hamano (6):
Makefile: add description on PERL/PYTHON_PATH
cvsimport: allow setting a custom cvsps (2.x) program name
cvsimport: introduce a version-switch wrapper
cvsimport: start adding cvsps 3.x support
cvsimport: make tests reusable for cvsimport-3
cvsimport-3: add a sample test
Looks very sane.
[PATCH v2 8/6] t9600: adjust for new cvsimport
In reply to Junio C HamanoThe rewritten cvsimport does not skip the latest 10 minutes worth of CVS commits by default, so there is no need to pass the "-a" option; it will barf if it sees "-a".
Also it will do the merge itself, so there is no need to merge "origin" ourselves, either.
---
* This is still untested and primarily to illustrate the concept introduced by the 5/6 patch, together with 6/6. Testing by interested parties with a working cvsps 3 may be nice. Something like:
$ make CVSPS3_PATH=/path/to/your/cvsps3/bin/cvsps
$ cd t && sh t9650-cvsimport3.sht/t9600-cvsimport.sh | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-)
t/t9600-cvsimport.sh +17 -7
@@ -42,9 +42,13 @@ EOF ) ' -test_expect_success 'import a trivial module' ' +case "$TEST_CVSPS_VERSION" in +3) import_all= ;; +*) import_all=-a ;; +esac && - git cvsimport -a -R -z 0 -C module-git module && +test_expect_success 'import a trivial module' ' + git cvsimport $import_all -R -z 0 -C module-git module && test_cmp module-cvs/o_fortuna module-git/o_fortuna '
@@ -90,8 +94,11 @@ test_expect_success 'update git module' ' (cd module-git && git config cvsimport.trackRevisions true && - git cvsimport -a -z 0 module && - git merge origin + git cvsimport $import_all -z 0 module && + if test "$TEST_CVSPS_VERSION" = 2 + then + git merge origin + fi ) && test_cmp module-cvs/o_fortuna module-git/o_fortuna
@@ -119,8 +126,11 @@ test_expect_success 'cvsimport.module config works' ' (cd module-git && git config cvsimport.module module && git config cvsimport.trackRevisions true && - git cvsimport -a -z0 && - git merge origin + git cvsimport $import_all -z0 && + if test "$TEST_CVSPS_VERSION" = 2 + then + git merge origin + fi ) && test_cmp module-cvs/tick module-git/tick
@@ -140,7 +150,7 @@ test_expect_success 'import from a CVS working tree' ' $CVS co -d import-from-wt module && (cd import-from-wt && git config cvsimport.trackRevisions false && - git cvsimport -a -z0 && + git cvsimport $import_all -z0 && echo 1 >expect && git log -1 --pretty=format:%s%n >actual && test_cmp actual expect
Signature · 1 line
1.8.1.421.g6236851
[PATCH v2 7/6] t9600: further prepare for sharing
In reply to Junio C HamanoWhen t9650, which dot-sources this script, really becomes ready to test the new cvsimport, we no longer depend on having PERL to run this test through it. Move the PERL dependency to lib-cvs.sh instead.
--- t/lib-cvs.sh | 7 +++++++ t/t9600-cvsimport.sh | 30 +++++++++++++++--------------- 2 files changed, 22 insertions(+), 15 deletions(-)
t/lib-cvs.sh +7 -0
@@ -22,6 +22,9 @@ case "$TEST_CVSPS_VERSION" in if test "$CVSPS2_PATH" = NoThanks then skip_all='skipping cvsimport tests, cvsps(2) not used' + elif ! test_have_prereq PERL + then + skip_all='skipping cvsimport tests, Perl not available' else case $($CVSPS2_PATH -h 2>&1 | sed -ne 's/cvsps version //p') in 2.1 | 2.2*)
@@ -39,6 +42,10 @@ case "$TEST_CVSPS_VERSION" in if test "$CVSPS3_PATH" = NoThanks then skip_all='skipping cvsimport tests, cvsps(3) not used' + elif ! test_have_prereq PYTHON + then + # NEEDSWORK: we may need Python lower-bound prerequisite + skip_all='skipping cvsimport tests, Python not available' else case $($CVSPS3_PATH -h 2>&1 | sed -ne 's/cvsps version //p') in 3.*)
t/t9600-cvsimport.sh +15 -15
@@ -3,14 +3,14 @@ test_description='git cvsimport basic tests' . ./lib-cvs.sh -test_expect_success PERL 'setup cvsroot environment' ' +test_expect_success 'setup cvsroot environment' ' CVSROOT=$(pwd)/cvsroot && export CVSROOT ' -test_expect_success PERL 'setup cvsroot' '$CVS init' +test_expect_success 'setup cvsroot' '$CVS init' -test_expect_success PERL 'setup a cvs module' ' +test_expect_success 'setup a cvs module' ' mkdir "$CVSROOT/module" && $CVS co -d module-cvs module &&
@@ -42,23 +42,23 @@ EOF ) ' -test_expect_success PERL 'import a trivial module' ' +test_expect_success 'import a trivial module' ' git cvsimport -a -R -z 0 -C module-git module && test_cmp module-cvs/o_fortuna module-git/o_fortuna ' -test_expect_success PERL 'pack refs' '(cd module-git && git gc)' +test_expect_success 'pack refs' '(cd module-git && git gc)' -test_expect_success PERL 'initial import has correct .git/cvs-revisions' ' +test_expect_success 'initial import has correct .git/cvs-revisions' ' (cd module-git && git log --format="o_fortuna 1.1 %H" -1) > expected && test_cmp expected module-git/.git/cvs-revisions ' -test_expect_success PERL 'update cvs module' ' +test_expect_success 'update cvs module' ' (cd module-cvs && cat <<EOF >o_fortuna && O Fortune,
@@ -86,7 +86,7 @@ EOF ) ' -test_expect_success PERL 'update git module' ' +test_expect_success 'update git module' ' (cd module-git && git config cvsimport.trackRevisions true &&
@@ -97,7 +97,7 @@ test_expect_success PERL 'update git module' ' ' -test_expect_success PERL 'update has correct .git/cvs-revisions' ' +test_expect_success 'update has correct .git/cvs-revisions' ' (cd module-git && git log --format="o_fortuna 1.1 %H" -1 HEAD^ &&
@@ -105,7 +105,7 @@ test_expect_success PERL 'update has correct .git/cvs-revisions' ' test_cmp expected module-git/.git/cvs-revisions ' -test_expect_success PERL 'update cvs module' ' +test_expect_success 'update cvs module' ' (cd module-cvs && echo 1 >tick &&
@@ -114,7 +114,7 @@ test_expect_success PERL 'update cvs module' ' ) ' -test_expect_success PERL 'cvsimport.module config works' ' +test_expect_success 'cvsimport.module config works' ' (cd module-git && git config cvsimport.module module &&
@@ -126,7 +126,7 @@ test_expect_success PERL 'cvsimport.module config works' ' ' -test_expect_success PERL 'second update has correct .git/cvs-revisions' ' +test_expect_success 'second update has correct .git/cvs-revisions' ' (cd module-git && git log --format="o_fortuna 1.1 %H" -1 HEAD^^ &&
@@ -135,7 +135,7 @@ test_expect_success PERL 'second update has correct .git/cvs-revisions' ' test_cmp expected module-git/.git/cvs-revisions ' -test_expect_success PERL 'import from a CVS working tree' ' +test_expect_success 'import from a CVS working tree' ' $CVS co -d import-from-wt module && (cd import-from-wt &&
@@ -148,12 +148,12 @@ test_expect_success PERL 'import from a CVS working tree' ' ' -test_expect_success PERL 'no .git/cvs-revisions created by default' ' +test_expect_success 'no .git/cvs-revisions created by default' ' ! test -e import-from-wt/.git/cvs-revisions ' -test_expect_success PERL 'test entire HEAD' 'test_cmp_branch_tree master' +test_expect_success 'test entire HEAD' 'test_cmp_branch_tree master' test_done
Signature · 1 line
1.8.1.421.g6236851
Quoted 4 lines · Junio C Hamano
After a quick survey of various distros, I think it is very unlikely that we will see "distros move on to newer cvsps, leaving cvsimport broken" situation. If anything, it is more like "distros decide to ignore the new cvsps, until it is made to work with cvsimport" [*1*].
A better predictor of the distros' decisions is probably which other packages depend on cvsps. As one data point: on Debian squeeze and on Ubuntu precise, only two packages depend on cvsps (git-cvs and bzr-cvsps-import) and one suggests it (chora2, "a code repository viewing component for horde framework"). So also by this standard they are unlikely to feel a lot of pressure to update quickly to cvsps3.
Quoted 3 lines
I think it is probably sensible to [...]
Agreed?
Yes, I agree that what you propose is a good strategy.
Michael
Signature · 3 lines
Michael Haggerty [email protected] http://softwareswirl.blogspot.com/
I cloned git://gitorious.org/cvsps/cvsps.git and installed cvsps-3.7 at c2ce6cc (More fun with test loads, sigh. Timezones suck., 2013-01-09) earlier on my $PATH, and tried to run t96xx series with this patch applied on top of Git 1.8.1.
The first thing I noticed was that all the tests were skipped. A patch to t/lib-cvs.sh might be sufficient,
--------------------- >8 -------------------------
t/lib-cvs.sh +2 -0
@@ -17,6 +17,8 @@ cvsps_version=`cvsps -h 2>&1 | sed -ne 's/cvsps version //p'` case "$cvsps_version" in 2.1 | 2.2*) ;; +3.*) + ;; '') skip_all='skipping cvsimport tests, cvsps not found' test_done
--------------------- 8< -------------------------
but I didn't check more than "now it seems not to skip them". And here is what I got:
--------------------- >8 -------------------------
Test Summary Report
-------------------t9600-cvsimport.sh (Wstat: 256 Tests: 15 Failed: 9)
Failed tests: 4-6, 8-9, 11-13, 15
Non-zero exit status: 1t9601-cvsimport-vendor-branch.sh (Wstat: 256 Tests: 9 Failed: 8)
Failed tests: 1-4, 6-9
Non-zero exit status: 1t9602-cvsimport-branches-tags.sh (Wstat: 256 Tests: 11 Failed: 5)
Failed tests: 1-3, 7, 9
Non-zero exit status: 1t9604-cvsimport-timestamps.sh (Wstat: 256 Tests: 2 Failed: 2)
Failed tests: 1-2
Non-zero exit status: 1
Files=5, Tests=38, 5 wallclock secs ( 0.05 usr 0.01 sys + 0.49
cusr 0.16 csys = 0.71 CPU)
Result: FAIL
--------------------- 8< -------------------------
A funny thing was that without cvsps-3.7 on $PATH (which means I am getting distro packaged cvsps 2.1), I got identical errors. Looking at the log message, it seems that you meant to remove t960[123], so perhaps the patch simply forgot to remove 9601 and 9602?
As neither test runs "git cvsimport" with -o/-m/-M options, ideally we should be able to pass them with and without having cvsps-3.x. Not passing them without cvsps-3.x would mean that the fallback mode of rewritten cvsimport is not working as expected. Not passing them with cvsps-3.x may mean the tests were expecting a wrong conversion result, or they uncover bugs in the replacement cvsimport.
t9600 fails with "-a is no longer supported", even without having cvsps-3.x on the $PATH (i.e. attempting to use the fallback). I wonder if this is an option the updated cvsimport would want to simply ignore?
It is a way to tell the old cvsps/cvsimport to disable its heuristics to ignore commits made within the last 10 minutes (this is done in the hope of waiting for the per-file nature of CVS commits to stabilize, IIUC); the user tells the command that he knows that the CVS repository is now quiescent and it is safe to import the whole thing.
If the updated cvsps can identify the changeset more reliably and it no longer needs "-a" option, it may be more helpful to the users to migrate their script if it allowed, warned and then ignored the option. It certainly would help sharing of this test script between runs that use the old and new cvsps as backends.
t9601 (after resurrecting the t/t9601/cvsroot directory) fails in an interesting way.
--------------------- >8 -------------------------
$ sh t9601-cvsimport-vendor-branch.sh -i -v Initialized empty Git repository in /git/git.build/t/trash directory.t9601-cvsimport-vendor-branch/.git/ expecting success:
git cvsimport -C module-git module
Traceback (most recent call last):
File "/git/git.build/git-cvsimport", line 262, in <module>
subprocess.check_output("cvsps -V 2>/dev/null", shell=True)
AttributeError: 'module' object has no attribute 'check_output' not ok - 1 import a module with a vendor branch --------------------- 8< -------------------------
Apparently, the copy of "subprocess.py" I have does not give us the check_output thing:
--------------------- >8 -------------------------
$ python Python 2.6.6 (r266:84292, Dec 26 2010, 22:31:48) [GCC 4.4.5] on linux2 Type "help", "copyright", "credits" or "license" for more information.
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
import subprocess
dir(subprocess)
['CalledProcessError', 'MAXFD', 'PIPE', 'Popen', 'STDOUT', '__all__', '__builtins__', '__doc__', '__file__', '__name__', '__package__', '_active', '_cleanup', '_demo_posix', '_demo_windows', '_eintr_retry_call', 'call', 'check_call', 'errno', 'fcntl', 'gc', 'list2cmdline', 'mswindows', 'os', 'pickle', 'select', 'signal', 'sys', 'traceback', 'types'] --------------------- 8< -------------------------
The story is the same for t9602 and t9603 (again after resurrecting the necessary files).
http://docs.python.org/2/library/subprocess.html tells me that check_output has first become available in 2.7.
So... does this mean that we now set the minimum required version of Python to 2.7? I dunno.
Junio C Hamano <[email protected]>:
Quoted 1 line
And here is what I got:
Hm. In my version of these tests, I only have one regression from the old combo (in the pathological tags test, t9602). You're seeing more breakage than that, obviously.
Quoted 2 lines
A funny thing was that without cvsps-3.7 on $PATH (which means I am getting distro packaged cvsps 2.1), I got identical errors.
That suggests that something in your test setup has gone bad and is introducing spurious errors. Which would be consistent with the above.
Quoted 3 lines
Looking
at the log message, it seems that you meant to remove t960[123], so perhaps the patch simply forgot to remove 9601 and 9602?
Yes.
Quoted 6 lines
As neither test runs "git cvsimport" with -o/-m/-M options, ideally we should be able to pass them with and without having cvsps-3.x. Not passing them without cvsps-3.x would mean that the fallback mode of rewritten cvsimport is not working as expected. Not passing them with cvsps-3.x may mean the tests were expecting a wrong conversion result, or they uncover bugs in the replacement cvsimport.
That's possible, but seems unlikely. Because the new cvsimport is such a thin wrapper around the conversion engine, bugs in it should lead to obvious crashes or failure to run the engine rather than the sort of conversion error the t960* tests are designed to check. Really all it does is assemble options to pass to the conversion engines.
My test strategy is aimed at the engine, not the wrapper. I took the repos from t960* and wrote a small Python framework to check the same assertions as the git-tree tests do, but using the engine. For example, here's how my t9602 looks:
import os, cvspstest
cc = cvspstest.ConvertComparison("t9602", "module") cc.cmp_branch_tree("test of branch", "master", True) cc.cmp_branch_tree("test of branch", "vendorbranch", True) cc.cmp_branch_tree("test of branch", "B_FROM_INITIALS", False) cc.cmp_branch_tree("test of branch", "B_FROM_INITIALS_BUT_ONE", False) cc.cmp_branch_tree("test of branch", "B_MIXED", False) cc.cmp_branch_tree("test of branch", "B_SPLIT", True) cc.cmp_branch_tree("test of tag", "vendortag", False)
# This is the only test new cvsps fails that old git-cvsimport passed. cc.cmp_branch_tree("test of tag", "T_ALL_INITIAL_FILES", True) cc.cmp_branch_tree("test of tag", "T_ALL_INITIAL_FILES_BUT_ONE", False) cc.cmp_branch_tree("test of tag", "T_MIXED", False) cc.cleanup()
Quoted 4 lines
t9600 fails with "-a is no longer supported", even without having cvsps-3.x on the $PATH (i.e. attempting to use the fallback). I wonder if this is an option the updated cvsimport would want to simply ignore?
Probably. But I don't think you should keep these tests in the git tree. That wasn't a great idea even when you were supporting just one engine; with two (and soon three) it's going to be just silly. Let sanity-checking the engines be *my* problem, since I have to do it anyway.
(I'm working towards the generalized test suite as fast as I can. First results probably in four days or so.)
Quoted 6 lines
It is a way to tell the old cvsps/cvsimport to disable its heuristics to ignore commits made within the last 10 minutes (this is done in the hope of waiting for the per-file nature of CVS commits to stabilize, IIUC); the user tells the command that he knows that the CVS repository is now quiescent and it is safe to import the whole thing.
Yes, that's just what -a is supposed to do. But is should be irrelevant for testing - in the test framework CVS is running locally, so there's no network lag.
Quoted 2 lines
So... does this mean that we now set the minimum required version of Python to 2.7? I dunno.
That would be bad, IMO. I'll put backporting to 2.6 high on my to-do list.
Signature · 1 line
<a href="http://www.catb.org/~esr/">Eric S. Raymond</a>
PATCH 1/1 t/t960[123]: remove leftover scripts
In reply to Junio C HamanoThe rewrite patch was supposed to remove these scripts, but somehow we ended up removing only the supporting files for them but not the test script themselves. Remove them for real.
---
* I'll queue this on top of your patch together with a few fix-up patches from Chris Rorvick. This may have been caused by your private patch e-mail mangled somewhere between us before I resent your patch, or perhaps you simply may have forgot to remove them, but at this point I do not really care where these deletions were lost---the only thing I care about is to make sure that you _meant_ to remove them in your patch (i.e. if you didn't mean to, then I am further breaking the tests in a way you did not intend to), so I'd appreciate either "Yup, these three files should be removed", or "No, they should stay; removal of their supporting data is no longer needed" from you (I and this patch expect the former, of course).
By the way, Chris, we'll need your Sign-off on the three paches (t/lib-cvs.sh fix to allow cvsps v3, t9600 fix and t9604 fix).
t/t9601-cvsimport-vendor-branch.sh | 85 -------------------------------------- t/t9602-cvsimport-branches-tags.sh | 78 ---------------------------------- t/t9603-cvsimport-patchsets.sh | 39 ----------------- 3 files changed, 202 deletions(-) delete mode 100755 t/t9601-cvsimport-vendor-branch.sh delete mode 100755 t/t9602-cvsimport-branches-tags.sh delete mode 100755 t/t9603-cvsimport-patchsets.sh
t/t9601-cvsimport-vendor-branch.sh deleted +0 -85
@@ -1,85 +0,0 @@ -#!/bin/sh - -# Description of the files in the repository: -# -# imported-once.txt: -# -# Imported once. 1.1 and 1.1.1.1 should be identical. -# -# imported-twice.txt: -# -# Imported twice. HEAD should reflect the contents of the -# second import (i.e., have the same contents as 1.1.1.2). -# -# imported-modified.txt: -# -# Imported, then modified on HEAD. HEAD should reflect the -# modification. -# -# imported-modified-imported.txt: -# -# Imported, then modified on HEAD, then imported again. -# -# added-imported.txt,v: -# -# Added with 'cvs add' to create 1.1, then imported with -# completely different contents to create 1.1.1.1, therefore the -# vendor branch was never the default branch. -# -# imported-anonymously.txt: -# -# Like imported-twice.txt, but with a vendor branch whose branch -# tag has been removed. - -test_description='git cvsimport handling of vendor branches' -. ./lib-cvs.sh - -setup_cvs_test_repository t9601 - -test_expect_success PERL 'import a module with a vendor branch' ' - - git cvsimport -C module-git module - -' - -test_expect_success PERL 'check HEAD out of cvs repository' 'test_cvs_co master' - -test_expect_success PERL 'check master out of git repository' 'test_git_co master' - -test_expect_success PERL 'check a file that was imported once' ' - - test_cmp_branch_file master imported-once.txt - -' - -test_expect_failure PERL 'check a file that was imported twice' ' - - test_cmp_branch_file master imported-twice.txt - -' - -test_expect_success PERL 'check a file that was imported then modified on HEAD' ' - - test_cmp_branch_file master imported-modified.txt - -' - -test_expect_success PERL 'check a file that was imported, modified, then imported again' ' - - test_cmp_branch_file master imported-modified-imported.txt - -' - -test_expect_success PERL 'check a file that was added to HEAD then imported' ' - - test_cmp_branch_file master added-imported.txt - -' - -test_expect_success PERL 'a vendor branch whose tag has been removed' ' - - test_cmp_branch_file master imported-anonymously.txt - -' - -test_done
t/t9602-cvsimport-branches-tags.sh deleted +0 -78
78 lines not on this page · raw message
t/t9603-cvsimport-patchsets.sh deleted +0 -39
@@ -1,39 +0,0 @@ -#!/bin/sh - -# Structure of the test cvs repository -# -# Message File:Content Commit Time -# Rev 1 a: 1.1 2009-02-21 19:11:43 +0100 -# Rev 2 a: 1.2 b: 1.1 2009-02-21 19:11:14 +0100 -# Rev 3 b: 1.2 2009-02-21 19:11:43 +0100 -# -# As you can see the commit of Rev 3 has the same time as -# Rev 1 this leads to a broken import because of a cvsps -# bug. - -test_description='git cvsimport testing for correct patchset estimation' -. ./lib-cvs.sh - -setup_cvs_test_repository t9603 - -test_expect_failure 'import with criss cross times on revisions' ' - - git cvsimport -p"-x" -C module-git module && - (cd module-git && - git log --pretty=format:%s > ../actual-master && - git log A~2..A --pretty="format:%s %ad" -- > ../actual-A && - echo "" >> ../actual-master && - echo "" >> ../actual-A - ) && - echo "Rev 4 -Rev 3 -Rev 2 -Rev 1" > expect-master && - test_cmp actual-master expect-master && - - echo "Rev 5 Branch A Wed Mar 11 19:09:10 2009 +0000 -Rev 4 Branch A Wed Mar 11 19:03:52 2009 +0000" > expect-A && - test_cmp actual-A expect-A -' - -test_done
Signature · 1 line
1.8.1.421.g6236851
Re: [PATCH] t/t960[123]: remove leftover scripts
Quoted 2 lines · Junio C Hamano
By the way, Chris, we'll need your Sign-off on the three paches (
t/lib-cvs.shfix to allow cvsps v3, t9600 fix and t9604 fix).
Sure. I was just maintaining them for myself but thought I'd share when I saw the follow-up patch. Didn't think to amend them.
Chris
PATCH 1/1 t/lib-cvs: cvsimport no longer works without Python >= 2.7
In reply to Junio C HamanoThe new cvsimport requires at least Python 2.7 to work; do not fail the cvsimport tests on platforms without one.
---
Quoted 5 lines · Junio C Hamano
http://docs.python.org/2/library/subprocess.html tells me that
check_outputhas first become available in 2.7.So... does this mean that we now set the minimum required version of Python to 2.7? I dunno.
Even if we were to rip out the fallback code that uses the 2.7-only subprocess.check_output() on "cvsps -V", the function is also used for doing the real work interacting with cvsps-3.x, so I think this patch will be necessary. Unless new cvsimport is tweaked not to use the method, that is.
A suggestion for a better alternative is of course very much appreciated.
I do not want to keep pushing integration results that do not pass tests even for myself for too many integration cycles, so I'll keep this patch at the tip of the topic, at least for now.
t/lib-cvs.sh | 15 +++++++++++++++ 1 file changed, 15 insertions(+)
t/lib-cvs.sh +15 -0
@@ -27,6 +27,21 @@ case "$cvsps_version" in ;; esac +if ! test_have_prereq PYTHON +then + skipall='skipping cvsimport tests, no python' + test_done +fi + +python -c ' +import sys +if sys.hexversion < 0x02070000: + sys.exit(1) +' || { + skip_all='skipping cvsimport tests, python too old (< 2.7)' + test_done +} + setup_cvs_test_repository () { CVSROOT="$(pwd)/.cvsroot" && cp -r "$TEST_DIRECTORY/$1/cvsroot" "$CVSROOT" &&
Signature · 1 line
1.8.1.421.g6236851
Re: [PATCH] t/lib-cvs: cvsimport no longer works without Python >= 2.7
I have the feeling I'm only seeing one side of this conversation...
Quoted 13 lines · Junio C Hamano
The new cvsimport requires at least Python 2.7 to work; do not fail the cvsimport tests on platforms without one.
Signed-off-by Junio C Hamano <[email protected]>---
Quoted 5 lines · Junio C Hamano
http://docs.python.org/2/library/subprocess.html tells me that
check_outputhas first become available in 2.7.So... does this mean that we now set the minimum required version of Python to 2.7? I dunno.
It would be unfortunate to set the minimum Python version to 2.7 if "git cvsimport" is considered an integral part of git.
Quoted 8 lines
Even if we were to rip out the fallback code that uses the 2.7-only
subprocess.check_output()on "cvsps -V", the function is also used for doing the real work interacting with cvsps-3.x, so I think this patch will be necessary. Unless new cvsimport is tweaked not to use the method, that is.A suggestion for a better alternative is of course very much appreciated.
If the only reason to require Python 2.7 is subprocess.check_output(), it would be easy to reimplement it (it is only 12 lines of straightforward code, plus a few lines to define the exception type CalledProcessError). According to [1], the Python license is GPL-compatible; therefore these lines could even be copied into git-cvsimport.
Michael
[1] http://www.gnu.org/licenses/license-list.html#Python
Signature · 3 lines
Michael Haggerty [email protected] http://softwareswirl.blogspot.com/
Re: [PATCH] t/lib-cvs: cvsimport no longer works without Python >= 2.7
Quoted 9 lines · Michael Haggerty
Quoted 8 lines
Even if we were to rip out the fallback code that uses the 2.7-only
subprocess.check_output()on "cvsps -V", the function is also used for doing the real work interacting with cvsps-3.x, so I think this patch will be necessary. Unless new cvsimport is tweaked not to use the method, that is.A suggestion for a better alternative is of course very much appreciated.
Quoted 6 lines
If the only reason to require Python 2.7 is
subprocess.check_output(), it would be easy to reimplement it (it is only 12 lines of straightforward code, plus a few lines to define the exception type CalledProcessError). According to [1], the Python license is GPL-compatible; therefore these lines could even be copied into git-cvsimport.
Note that this has already be done in git_remote_helpers.util. Is there any reason not to just reference that?
John
Quoted 19 lines
From: "Eric S. Raymond" <[email protected]>
...git-cvsimport-fallback.perl renamed from git-cvsimport.perl +4
-0@@ -1,4 +1,8 @@ #!/usr/bin/perl +# This code became obsolete in January 2013, and is retained only as a +# fallback from git-cvsimport.py for users who have only cvsps-2.x. +# It (and the code in cvsimport.py that calls it) should be removed +# once the 3.x version has had a reasonable time to propagate. # This tool is copyright (c) 2005, Matthias Urlichs. # It is released under the Gnu Public License, version 2.
git-cvsimport-fallback.perl line 36
Quoted 6 lines
git-cvsimport-fallback.perl renamed from git-cvsimport.perl +3
-0@@ -27,6 +31,10 @@ use POSIX qw(strftime tzset dup2 ENOENT); use IPC::Open2; +print(STDERR "You do not appear to have cvsps 3.x.\n"); +print(STDERR "Falling back to unmaintained Perl cvsimport for cvsps 2.x.\n"); +print(STDERR "Upgrade your cvsps for best results.\n");
I think the prevalent style in this script is to write "print" without parentheses:
print STDERR "msg\n";
Quoted 14 lines
git-cvsimport.py new file +7
-0@@ -0,0 +1,354 @@ +#!/usr/bin/env python +# +# Import CVS history into git +# +# Intended to be a near-workalike of Matthias Urlichs's Perl implementation. +class cvsps: + "Method class for cvsps back end."
git-cvsimport.py line 67
Quoted 10 lines
git-cvsimport.py new file +10
-0+ def __init__(self): + self.opts = "" + self.revmap = None + def set_repo(self, val): + "Set the repository root option." + if not val.startswith(":"): + if not val.startswith(os.sep): + val = os.path.abspath(val) + val = ":local:" + val + self.opts += " --root '%s'" % val
This looks lazy and unsafe quoting. Is there anything that makes sure repository path does not contain a single quote?
git-cvsimport.py line 79
Quoted 12 lines
git-cvsimport.py new file +12
-0+ def set_authormap(self, val): + "Set the author-map file." + self.opts += " -A '%s'" % val + def set_fuzz(self, val): + "Set the commit-similarity window." + self.opts += " -z %s" % val + def set_nokeywords(self): + "Suppress CVS keyword expansion." + self.opts += " -k" + def add_opts(self, val): + "Add options to the engine command line." + self.opts += " " + val
... especially for callers of this method.
The same comment applies to many uses of "val" in the method implementations of this class and the cvs2git class.
git-cvsimport.py line 136
Quoted 3 lines
git-cvsimport.py new file +3
-0+ def command(self): + "Emit the command implied by all previous options." + return "(cvs2git --username=git-cvsimport --quiet --quiet --blobfile={0} --dumpfile={1} {2} {3} && cat {0} {1} && rm {0} {1})".format(tempfile.mkstemp()[1], tempfile.mkstemp()[1], self.opts, self.modulepath)
Could we do something better with this overlong source line?
Quoted 14 lines
git-cvsimport.py new file +13
-0+if __name__ == '__main__': + for (opt, val) in options: + if opt == '-v': + verbose += 1 + elif opt == '-b': + bare = True + elif opt == '-e': + for cls in (cvsps, cvs2git): + if cls.__name__ == val: + backend = cls() + break + else: + sys.stderr.write("git cvsimport: unknown engine %s.\n" % val)
git-cvsimport.py line 215
Quoted 10 lines
git-cvsimport.py new file +10
-0+ sys.exit(1) + elif opt == '-d': + backend.set_repo(val) + elif opt == '-C': + outdir = val + elif opt == '-r': + remotize = True + elif opt == '-o': + sys.stderr.write("git cvsimport: -o is no longer supported.\n") + sys.exit(1)
Isn't this a regression?
Quoted 5 lines
git-cvsimport.py new file +5
-0+ elif opt == '-i': + import_only = True + elif opt == '-k': + backend.set_nokeywords() + elif opt == '-u':
git-cvsimport.py line 230
Quoted 10 lines
git-cvsimport.py new file +9
-0+ underscore_to_dot = True + elif opt == '-s': + slashsubst = val + elif opt == '-p': + backend.add_opts(val.replace(",", " ")) + elif opt == '-z': + elif opt == '-P': + backend = filesource(val) + sys.exit(1)
???
git-cvsimport.py line 233
Quoted 3 lines
git-cvsimport.py new file +3
-0+ elif opt in ('-m', '-M'): + sys.stderr.write("git cvsimport: -m and -M are no longer supported: use reposurgeon instead.\n") + sys.exit(1)
I wonder if it is better to ignore these options with a warning but still let the command continue; cvsps-3.x was supposed to get merges right without the help of these ad-hoc options, no?
Otherwise it looks like a regression to me.
Quoted 26 lines
git-cvsimport.py new file +26
-0+ elif opt == '-S': + backend.set_exclusion(val) + elif opt == '-a': + sys.stderr.write("git cvsimport: -a is no longer supported.\n") + sys.exit(1) + elif opt == '-L': + sys.stderr.write("git cvsimport: -L is no longer supported.\n") + sys.exit(1) + elif opt == '-A': + authormap = os.path.abspath(val) + elif opt == '-R': + revisionmap = True + else: + print """\ +git cvsimport [-A <author-conv-file>] [-C <git_repository>] [-b] [-d <CVSROOT>] + [-e engine] [-h] [-i] [-k] [-p <options-for-cvsps>] [-P <source-file>] + [-r <remote>] [-R] [-s <subst>] [-S <regex>] [-u] [-v] [-z <fuzz>] + [<CVS_module>] +""" + def metadata(fn, outdir='.'): + if bare: + return os.path.join(outdir, fn) + else: + return os.path.join(outdir, ".git", fn) + # Ugly fallback code for people with only cvsps-2.x + # Added January 2013 - should be removed after a decent interval.
git-cvsimport.py line 269
Quoted 10 lines
git-cvsimport.py new file +10
-0+ if backend.__class__.__name__ == "cvsps": + try: + subprocess.check_output("cvsps -V 2>/dev/null", shell=True) + except subprocess.CalledProcessError as e: + if e.returncode == 1: + sys.stderr.write("cvsimport: falling back to old version...\n") + sys.exit(os.system("git-cvsimport-fallback " + " ".join(sys.argv[1:]))) + else: + sys.stderr.write("cvsimport: cannot execute cvsps.\n") + sys.exit(1)
Having the code to die when it sees options the rewritten version does not yet support before it calls the fallback makes the fallback much less effective, no?
git-cvsimport.py line 277
Quoted 8 lines
git-cvsimport.py new file +8
-0+ # Real mainline code begins here + try: + if outdir: + try: + # If the output directory does not exist, create it + # and initialize it as a git repository. + os.mkdir(outdir) + do_or_die("git init --quiet " + outdir)
Did anything made sure outdir is without $IFS chars up to this point?
Not very impressed (yet). The advertised "fix major bugs" sounds more like "trade major bugs with different ones with a couple of feature removals" at this point.
Junio C Hamano <[email protected]>:
Quoted 4 lines
I think the prevalent style in this script is to write "print" without parentheses:
print STDERR "msg\n";
That can be easily fixed.
Quoted 2 lines
This looks lazy and unsafe quoting. Is there anything that makes sure repository path does not contain a single quote?
No. But...wait, checking...the Perl code didn't have the analogous check, so there's no increased vulnerability here. I'll put it on the to-do list for after I ship parsecvs.
Quoted 5 lines
git-cvsimport.py line 136
Quoted 3 lines
git-cvsimport.py new file +3
-0+ def command(self): + "Emit the command implied by all previous options." + return "(cvs2git --username=git-cvsimport --quiet --quiet --blobfile={0} --dumpfile={1} {2} {3} && cat {0} {1} && rm {0} {1})".format(tempfile.mkstemp()[1], tempfile.mkstemp()[1], self.opts, self.modulepath)Could we do something better with this overlong source line?
Yes. The correct fix is to simplify cvs2git's rather baroque command-line interface. Michael Haggerty has accepted that patch. Soon that line will look like this:
return "cvs2git --quiet --quiet {0} {1}".format(self.opts, self.modulepath)Older versions of cvs2git will terminate cleanly with an error message when called this way.
Quoted 5 lines
git-cvsimport.py line 215
Quoted 3 lines
git-cvsimport.py new file +3
-0+ elif opt == '-o': + sys.stderr.write("git cvsimport: -o is no longer supported.\n") + sys.exit(1)Isn't this a regression?
It would be if the -o behavior were consistent and decently documented. When I tested this option with the Perl version I got no result. Possibly my usage was incorrect; if anyone can be found who actually understands how it's supposed to work in detail and will tell me, I can probably support it.
Quoted 7 lines
git-cvsimport.py line 233
Quoted 3 lines
git-cvsimport.py new file +3
-0+ elif opt in ('-m', '-M'): + sys.stderr.write("git cvsimport: -m and -M are no longer supported: use reposurgeon instead.\n") + sys.exit(1)I wonder if it is better to ignore these options with a warning but still let the command continue; cvsps-3.x was supposed to get merges right without the help of these ad-hoc options, no?
Sorry, I don't know where you got that idea. I don't think the general merge detection that would need is possible even in principle.
Quoted 1 line
Otherwise it looks like a regression to me.
There are two reasons -m and -M aren't supported.
One is implementation-level. The wrapper script no longer deals with individual files or changesets or branches; it relies on the conversion engine to do all that. (As it should - the old design was a mess with lots of stuff being done at the wrong level.) But the conversion engines don't implement -m or -M, and aren't ever going to (see next paragraph).
The other is a design-level problem - these options were a bad idea to begin with. In earlier list mail I said
An example of the batchiness mistake close to home is the -m and -M options in the old version of cvsimport. It takes human judgment looking at the whole commit DAG in gitspace to decide what merge points would best express the (as you say, sometimes ambiguous) CVS history - what's needed is a scalpel and sutures in a surgeon's hand, not a regexp hammer.
One specific problem with the regexp hammer is false-positive matches leading to unintended merges.
That's why I won't implement these in cvsps or parsecvs. Instead I've just added DAG visualization via graphviz in reposurgeon, so a human can quickly see candidate merges in the visualization and do them by hand. This is better and safer.
Quoted 3 lines
Having the code to die when it sees options the rewritten version does not yet support before it calls the fallback makes the fallback much less effective, no?
Only to the extent that -o/-m/-M are really important, which I doubt. But that might be fixable, and I'll put it on the to-do list.
Quoted 3 lines
Not very impressed (yet). The advertised "fix major bugs" sounds more like "trade major bugs with different ones with a couple of feature removals" at this point.
If you think that, you have failed to understand just how broken and dangerous the old combination is. None of the details you've called out are "major" by any stretch of the imagination compared to it silently botching the translation of repositories.
Also bear in mind that leaving the old Perl code in place is not going to be a viable option for more than a few months out. As cvsps-3.x propagates to the distros what you have is going to stop even its current pretense of working.
Finally...my own purposes are fulfilled by having CVS exporters that can do a decent job of front-ending for reposurgeon. Rewriting git's wrapper script was extra work that I took on only because I wanted to be friendly to the git project, *but*...
...there is a limit to the amount of what I consider pointless hoop-jumping that friendliness will buy you, and the 2.x fallback eas already pushing that limit. Tread a little more gently, Junio; I've put in a lot of hard, boring work on git-cvsimport over the last two weeks when I would rather have been doing other things, and my patience for being nit-picked without appreciation or reward has a correspondingly low limit. We'll both be happier if you don't reach it.
Signature · 1 line
<a href="http://www.catb.org/~esr/">Eric S. Raymond</a>
Quoted 12 lines · Eric S. Raymond
Junio C Hamano <[email protected]>:
...
The other is a design-level problem - these options were a bad idea to begin with. In earlier list mail I saidAn example of the batchiness mistake close to home is the -m and -M options in the old version of cvsimport. It takes human judgment looking at the whole commit DAG in gitspace to decide what merge points would best express the (as you say, sometimes ambiguous) CVS history - what's needed is a scalpel and sutures in a surgeon's hand, not a regexp hammer.
Quoted 2 lines
One specific problem with the regexp hammer is false-positive matches leading to unintended merges.
Yeah, it is OK to _discourage_ its use, but to me it looks like that the above is a fairly subjective policy decision, not something I should let you impose on the users of the old cvsimport, which you do not seem to even treat as your users.
Quoted 7 lines
Quoted 3 lines
Having the code to die when it sees options the rewritten version does not yet support before it calls the fallback makes the fallback much less effective, no?
Only to the extent that -o/-m/-M are really important, which I doubt. But that might be fixable, and I'll put it on the to-do list.
Quoted 8 lines
Quoted 3 lines
Not very impressed (yet). The advertised "fix major bugs" sounds more like "trade major bugs with different ones with a couple of feature removals" at this point.
If you think that, you have failed to understand just how broken and dangerous the old combination is. None of the details you've called out are "major" by any stretch of the imagination compared to it silently botching the translation of repositories.
The "major" in my sentence was from your description (the bugs you fixed), and not about the new ones you still have in this draft. I did not mean to say that you are trading fixes to "major" bugs with different "major" bugs.
Insecure quoting of parameters is much easier to fix; it does need to be addressed, though.
It is just that looking at the state of the patch as submitted left me with a feeling that this topic needs a lot more time to mature than I previously was led to believe by your earlier messages, which made me someaht sad.
Junio C Hamano <[email protected]>:
Quoted 4 lines
Yeah, it is OK to _discourage_ its use, but to me it looks like that the above is a fairly subjective policy decision, not something I should let you impose on the users of the old cvsimport, which you do not seem to even treat as your users.
Er. You still don't seem to grasp the fundamentals of this situation. I'm not imposing any damn thing on the users. What's imposing is the fact that cvsps-2.x and the Perl cvsimport are both individually and collectively *broken right now*, and within a few months the Perl git-cvsimport is going to cease even pretending to work. I'm trying to *fix that problem* as best I can, fixing it required two radical rewrites, and criticizing me for not emulating every last detail and misfeature immediately is every bit as pointless and annoying as arguing about the fabric on the deck chairs while the ship is sinking.
To put it bluntly, you should be grateful to be getting back any functionality at all - because the alternative is that the Perl git-cvsimport will hang out in your tree as a dead piece of cruft. Your choice is between making it easy for me replace it with minimum disruption now and hoping for someone else to replace it months from now after you've had a bunch of unhappy users bitching at you.
So let me be more direct. I think the -M and -m options are sufficiently bad ideas that I am *not willing* to put in the quite large amount of effort that would be required to implement them in cvsps or parsecvs. That would be a bad use of my time.
This is not the case with -o; that might be a good idea if I understood it. This is also not like the 2.x fallback; I thought that was a bad idea (because it would be better for users that the combination break in an obvious way than continue breaking in a silent one), but it was a small enough effort that I was willing to do it anyway to keep the git maintainer happy. The effort to fix the quoting bugs is even easier for me to justify; they are actual bugs.
Those are my engineering judgments; go ahead and call them "subjective" if you like, but neither the facts nor my judgment will change on that account.
Quoted 4 lines
The "major" in my sentence was from your description (the bugs you fixed), and not about the new ones you still have in this draft. I did not mean to say that you are trading fixes to "major" bugs with different "major" bugs.
OK, thank you. In the future I will try to bear in mind that English is not your primary language when I evaluate statements that seems a bit offensive.
So what's your next bid? Note that you can't increase my friction and hassle costs much more before I give up and let you deal with the consequences without me. I want to do the right thing, but I have more other projects clamoring for my attention than you could easily guess. I need to get git-cvsimport *finished* and off my hands - I may already have given it more time than I really should have.
So give me your minimum list of deliverables before you'll merge, please, and then stick to it. I assume fixes for the quoting bugs will be on that list.
Signature · 1 line
<a href="http://www.catb.org/~esr/">Eric S. Raymond</a>
Quoted 6 lines · Eric S. Raymond
Junio C Hamano <[email protected]>:
Quoted 4 lines
I think the prevalent style in this script is to write "print" without parentheses:
print STDERR "msg\n";
Quoted 8 lines
That can be easily fixed.
Quoted 2 lines
This looks lazy and unsafe quoting. Is there anything that makes sure repository path does not contain a single quote?
No. But...wait, checking...the Perl code didn't have the analogous check, so there's no increased vulnerability here. I'll put it on the to-do list for after I ship parsecvs.
I checked before I sent that review, and as far as I could tell, it was fairly consistently avoiding the lazy and insecure forms, e.g.
system("com mand " . $param);
open($fh, "com mand " . $param . " |"); while (<$fh>) { ... }but used the more sequre list form, e.g.
system(qw(com mand), $param);
open($fh, "-|", qw(com mand), $param); while (<$fh>) { ... }But of course there may be some places that were careless that I didn't spot (and previous reviewers of the current cvsimport didn't).