I just got my machine blocked from a CVS server which didn't like
to get hammered with connections.
That was cvs2git's shell script. Which, by the way, is slow as hell.
Appended: a git-cvsimport script, written in Perl, which directly talks
to the CVS server. If the repository is local, it runs a "cvs server"
child. It produces the same git repository as Linus' version. It can do
incremental imports. And it's 20 times faster (on my system, with a
local CVS repository).
cvs2git is thus obsolete; this patch deletes it.
Signed-Off-By: Matthias Urlichs <redacted>
---
@@ -63,18 +63,38 @@ Once you've gotten (and installed) cvsps any more familiar with it, but make sure it is in your path. After that, the magic command line is- git cvsimport <cvsroot> <module>+ git cvsimport -v -d <cvsroot> <module> <destination> which will do exactly what you'd think it does: it will create a git-archive of the named CVS module. The new archive will be created in a-subdirectory named <module>.+archive of the named CVS module. The new archive will be created in the+subdirectory named <destination>; it'll be created if it doesn't exist.+Default is the local directory. It can take some time to actually do the conversion for a large archive since it involves checking out from CVS every revision of every file,-and the conversion script can be reasonably chatty, but on some not very-scientific tests it averaged about eight revisions per second, so a-medium-sized project should not take more than a couple of minutes. For-larger projects or remote repositories, the process may take longer.+and the conversion script is reasonably chatty unless you omit the '-v'+option, but on some not very scientific tests it averaged about twenty+revisions per second, so a medium-sized project should not take more+than a couple of minutes. For larger projects or remote repositories,+the process may take longer.++After the (initial) import is done, the CVS archive's current head+revision will be checked out -- thus, you can start adding your own+changes right away.++The import is incremental, i.e. if you call it again next month it'll+fetch any CVS updates that have been happening in the meantime. The+cut-off is date-based, so don't change the branches that were imported+from CVS.++You can merge those updates (or, in fact, a different CVS branch) into+your main branch:++ cg-merge <branch>++The HEAD revision from CVS is named "origin", not "HEAD", because git+already uses "HEAD". (If you don't like 'origin', use cvsimport's+'-o' option to change it.) Emulating CVS behaviour
From: Nicolas Pitre <hidden> Date: 2016-06-15 22:42:01
On Tue, 28 Jun 2005, Matthias Urlichs wrote:
I just got my machine blocked from a CVS server which didn't like
to get hammered with connections.
That was cvs2git's shell script. Which, by the way, is slow as hell.
Appended: a git-cvsimport script, written in Perl, which directly talks
to the CVS server. If the repository is local, it runs a "cvs server"
child. It produces the same git repository as Linus' version. It can do
incremental imports. And it's 20 times faster (on my system, with a
local CVS repository).
Tried it on the bkcvs repository from
ftp.kernel.org/pub/scm/linux/kernel/bkcvs/linux-2.5/
(it can be retrieved with rsync as well)
Your script died after about 30 seconds with:
[...]
New scripts/lxdialog/Makefile: 0 bytes.
New scripts/lxdialog/checklist.c: 0 bytes.
New scripts/lxdialog/colors.h: 0 bytes.
New scripts/lxdialog/dialog.h: 0 bytes.
New scripts/lxdialog/inputbox.c: 0 bytes.
New scripts/lxdialog/lxdialog.c: 0 bytes.
New scripts/lxdialog/menubox.c: 0 bytes.
New scripts/lxdialog/msgbox.c: 0 bytes.
New scripts/lxdialog/textbox.c: 0 bytes.
New scripts/lxdialog/util.c: 0 bytes.
New scripts/lxdialog/yesno.c: 0 bytes.
Can't exec "git-update-cache": Argument list too long at /home/nico/bin/git-cvsimport-script line 402, <CVS> line 8254.
Cannot add files: -1
The original Linus version, although painfully slow, successfully
converts the whole thing after a couple hours.
Also aren't those "0 bytes" a bit suspicious?
Nicolas
Oh well, I'll have a look. (I never bothered with bk2cvs; there's a
better tool which does bk2git directly.)
New scripts/lxdialog/yesno.c: 0 bytes.
0-byte files are quite common in real-world repositories, so
throwing an error when I see one won't work.
Can't exec "git-update-cache": Argument list too long at
/home/nico/bin/git-cvsimport-script line 402, <CVS> line 8254.
That, at least, is easily fixable, I'll do a followup patch.
--
Matthias Urlichs | {M:U} IT Design @ m-u-it.de | smurf@smurf.noris.de
Disclaimer: The quote was selected randomly. Really. | http://smurf.noris.de
- -
"A 'meaning of life' removes the overriding fear that existance is
useless -- while denying the fact that living is its own greatest reward."
[Fredric Rice, HolySmoke, December 1996]
Oh well, I'll have a look. (I never bothered with bk2cvs; there's a
better tool which does bk2git directly.)
OK -- pulled, tested.
... though why you'd want the kernel via CVS instead of by direct
BK->GIT import is beyond me. ;-)
quoted
New scripts/lxdialog/yesno.c: 0 bytes.
That's a feature. All the r1.1 CVS versions are zero-byte files, because
they're copied from BK/SCCS 1.0 versions, which are empty too (BK adds
the actual content in revision 1.1).
quoted
Can't exec "git-update-cache": Argument list too long at
/home/nico/bin/git-cvsimport-script line 402, <CVS> line 8254.
Fixed; patch mailed separately.
--
Matthias Urlichs | {M:U} IT Design @ m-u-it.de | smurf@smurf.noris.de
Disclaimer: The quote was selected randomly. Really. | http://smurf.noris.de
- -
My mother had a baby once.
-- Jigger
A small fix to git-cvsimport-script:
Limit the number of arguments to git-update-cache.
(Limiting their length may make a bit more sense, but I'm lazy.)
Signed-Off-By: Matthias Urlichs <redacted>
---
@@ -395,14 +395,32 @@ my $state = 0; my($patchset,$date,$author,$branch,$ancestor,$tag,$logmsg); my(@old,@new); my $commit = sub { my $pid;- system("git-update-cache","--force-remove","--",@old) if @old;- die "Cannot remove files: $?\n" if $?;- system("git-update-cache","--add","--",@new) if @new;- die "Cannot add files: $?\n" if $?;+ while(@old) {+ my @o2;+ if(@old > 55) {+ @o2 = splice(@old,0,50);+ } else {+ @o2 = @old;+ @old = ();+ }+ system("git-update-cache","--force-remove","--",@o2);+ die "Cannot remove files: $?\n" if $?;+ }+ while(@new) {+ my @n2;+ if(@new > 55) {+ @n2 = splice(@new,0,50);+ } else {+ @n2 = @new;+ @new = ();+ }+ system("git-update-cache","--add","--",@n2);+ die "Cannot add files: $?\n" if $?;+ } $pid = open(C,"-|"); die "Cannot fork: $!" unless defined $pid; unless($pid) { exec("git-write-tree");
@@ -478,13 +496,10 @@ my $commit = sub { or die "Cannot write tag $branch: $!\n"; close(C) or die "Cannot write tag $branch: $!\n"; print "Created tag '$tag' on '$branch'\n" if $opt_v; }-- @old = ();- @new = (); }; while(<CVS>) { chomp; if($state == 0 and /^-+$/) {
From: Sven Verdoolaege <hidden> Date: 2016-06-15 22:42:01
On Tue, Jun 28, 2005 at 09:23:23PM +0200, Matthias Urlichs wrote:
I just got my machine blocked from a CVS server which didn't like
to get hammered with connections.
That was cvs2git's shell script. Which, by the way, is slow as hell.
Appended: a git-cvsimport script, written in Perl, which directly talks
to the CVS server. If the repository is local, it runs a "cvs server"
child. It produces the same git repository as Linus' version. It can do
incremental imports. And it's 20 times faster (on my system, with a
local CVS repository).
Could you try to make the resulting repository compatible
with a repository generated with the old cvs2git ?
This is the original version:
sh-3.00$ git-cat-file commit f6a92a7a774473bce12415200bab2788ea3b18f0
tree a0ec41a61461476c72c3967576225bd4772b6c8f
author risset <risset> 995295631 +0000
committer risset <risset> 995295631 +0000
Initial revision
sh-3.00$
This is your version:
sh-3.00$ git-cat-file commit db3540e3f670d4af4acefc723bab41a077c9300e
tree a0ec41a61461476c72c3967576225bd4772b6c8f
author risset <risset> 995295631 +0000
committer risset <risset> 995295631 +0000
Initial revision
sh-3.00$
Note the extra empty line.
Every commit is now different.
I'd really prefer it if I would not have to do the whole
conversion again.
skimo
Could you try to make the resulting repository compatible
with a repository generated with the old cvs2git ?
I believe I did... at least it worked that way two days ago. ;-)
This is the original version:
Which repository is that?
I'd really prefer it if I would not have to do the whole
conversion again.
So do I. ;-)
--
Matthias Urlichs | {M:U} IT Design @ m-u-it.de | smurf@smurf.noris.de
Disclaimer: The quote was selected randomly. Really. | http://smurf.noris.de
- -
Imitation is the sincerest form of television.
-- Fred Allen
- $ancestor = $opt_o if $ancestor == "HEAD";
+ $ancestor = $opt_o if $ancestor eq "HEAD";
Duh. Thanks for spotting that. :-/
--
Matthias Urlichs | {M:U} IT Design @ m-u-it.de | smurf@smurf.noris.de
Disclaimer: The quote was selected randomly. Really. | http://smurf.noris.de
- -
I am enough of an artist to draw freely upon my imagination.
Imagination is more important than knowledge.
Knowledge is limited. Imagination encircles the world.
-- Albert Einstein
From: Sven Verdoolaege <hidden> Date: 2016-06-15 22:42:01
On Thu, Jun 30, 2005 at 05:21:25PM +0200, Matthias Urlichs wrote:
Sven Verdoolaege:
quoted
Could you try to make the resulting repository compatible
with a repository generated with the old cvs2git ?
I believe I did... at least it worked that way two days ago. ;-)
quoted
This is the original version:
Which repository is that?
That was a private repository, but I tried it on another one
and I see that each commit message has an extra empty line
when compared to both an earlier cvs2git conversion and
"cvs log".
Presumably you have an extraneous "\n" somewhere.
-d :pserver:anonymous@exp-prolog.cs.kuleuven.ac.be:/cvs/dtse/ Polylib
sverdool@pc117b:/local/kul/Polylib> cvs log typemap |tail -n 15
make Polyhedron subclass of Domain
----------------------------
revision 1.2
date: 2001/11/16 16:01:58; author: sven; state: Exp; lines: +15 -1
take array when matrix is needed
----------------------------
revision 1.1
date: 2001/11/06 15:19:44; author: sven; state: Exp;
branches: 1.1.1;
Initial revision
----------------------------
revision 1.1.1.1
date: 2001/11/06 15:19:44; author: sven; state: Exp; lines: +0 -0
=============================================================================
sverdool@pc117b:/local/git/Polylib> cg-log typemap | tail -n 26
commit b53b0121ac62e9fa9cceb2c483e121d6ba1e24ed
tree 8d3d8125b8642a21cb9a5efb4e308f91ede06d56
parent 74d88525870de6c5648580a90920e85f294cae8c
author sven <sven> Mon, 14 Jan 2002 12:48:11 +0000
committer sven <sven> Mon, 14 Jan 2002 12:48:11 +0000
make Polyhedron subclass of Domain
commit df6e38c6efe4f161ee35d60728813ddc0f1cb9cf
tree 43eef31ade1f7a88256e6dff9e66c2e7ca3201db
parent e38797be1f09c649600e681c8c7dc322e2db504d
author sven <sven> Fri, 16 Nov 2001 16:01:58 +0000
committer sven <sven> Fri, 16 Nov 2001 16:01:58 +0000
take array when matrix is needed
commit 4c91382f379478f2ef8b9d875e7c81bddcb3aa57
tree e0ed0e7b11f9fc0341cdddaa95a8872fe5b01a5c
author sven <sven> Tue, 06 Nov 2001 15:19:44 +0000
committer sven <sven> Tue, 06 Nov 2001 15:19:44 +0000
Initial revision
sverdool@pc117b:/local/git/Polylib>
skimo
Strange.
That must have crept in when I switched from cg-commit to git-commit-tree.
I'll find it. However, you don't actually need to re-import your
existing CVS->GIT trees; as long as the dates and the branch names
match, my script will continue where the other left off.
--
Matthias Urlichs | {M:U} IT Design @ m-u-it.de | smurf@smurf.noris.de
Disclaimer: The quote was selected randomly. Really. | http://smurf.noris.de
- -
You do not have mail.
From: Sven Verdoolaege <hidden> Date: 2016-06-15 22:42:01
On Thu, Jun 30, 2005 at 06:10:43PM +0200, Matthias Urlichs wrote:
I'll find it. However, you don't actually need to re-import your
existing CVS->GIT trees; as long as the dates and the branch names
match, my script will continue where the other left off.
I wanted to check first whether it would do the right thing.
I'll wait for your update to do further checking.
skimo
Ah, found it -- that was my slightly modified version of cvsps, which
happens not to print an extra empty line at the end. cvs2git.c dutifully
strips these.
Duh. Will post an incremental patch shortly.
--
Matthias Urlichs | {M:U} IT Design @ m-u-it.de | smurf@smurf.noris.de
Disclaimer: The quote was selected randomly. Really. | http://smurf.noris.de
- -
As I learn to trust the universe, I no longer need to carry a gun.
Teach the new cvsimport script to chop the log string's trailing whitespace.
Limit the log string to 32k, in order to be compatible with the old
cvs2git program.
Signed-Off-By: Matthias Urlichs <redacted>
---
From: Nicolas Pitre <hidden> Date: 2016-06-15 22:42:01
On Thu, 30 Jun 2005, Matthias Urlichs wrote:
A small fix to git-cvsimport-script:
Limit the number of arguments to git-update-cache.
(Limiting their length may make a bit more sense, but I'm lazy.)
Why not using:
write( "| xargs | git-update-cache --add --", @new)
or the like (I forget what the exact perl incantation is).
Nicolas
From: Nicolas Pitre <hidden> Date: 2016-06-15 22:42:01
On Thu, 30 Jun 2005, Nicolas Pitre wrote:
On Thu, 30 Jun 2005, Matthias Urlichs wrote:
quoted
A small fix to git-cvsimport-script:
Limit the number of arguments to git-update-cache.
(Limiting their length may make a bit more sense, but I'm lazy.)
That example should be:
write( "| xargs git-update-cache --add --", @new)
of course.
Actually, 'local $\ = "\0";' and 'xargs -0', which is roughly the point
where doing it all in Perl starts being more readable. ;-)
--
Matthias Urlichs | {M:U} IT Design @ m-u-it.de | smurf@smurf.noris.de
Disclaimer: The quote was selected randomly. Really. | http://smurf.noris.de
- -
The only secure computer is one that's unplugged, locked in a safe,
and buried 20 feet under the ground in a secret location... and I'm
not even too sure about that one.
-- Dennis Huges, FBI.
From: Stephen C. Tweedie <hidden> Date: 2016-06-15 22:42:01
Hi,
On Tue, 2005-06-28 at 20:23, Matthias Urlichs wrote:
That was cvs2git's shell script. Which, by the way, is slow as hell.
I discovered why yesterday --- it's this patch:
commit deb153a75ae1f5eca628a38b911474a69edd242d
...
[PATCH] cvs2git and file permissions
git-cvs2git: propagate mode information
Let cvs checkout in a temporary directory rather than
using the pipe option to avoid loss of mode information.
This has a very unfortunate side effect --- when CVS checks out into a
new directory, it then waits for the time to advance to the next second
so that it can guarantee that future writes to the checked-out file
always change the timestamp from what it stores in CVS/Entries.
And when you're doing repeated checkouts, that means you get one per
second, max. And so the git cvs import was taking one ... second ...
per ... revision ... per ... file, instead of the 8 complete changesets
or better I was getting before the above change.
Reverting the change back to checkout-via-pipe fixed the performance
problem for me, but obviously we're back to losing the mode information.
--Stephen
From: Sven Verdoolaege <hidden> Date: 2016-06-15 22:42:01
On Thu, Jun 30, 2005 at 06:10:43PM +0200, Matthias Urlichs wrote:
I'll find it. However, you don't actually need to re-import your
existing CVS->GIT trees; as long as the dates and the branch names
match, my script will continue where the other left off.
That seems to work, once I figured out I had to pass in the "-o master"
option (as cvs2git didn't create an "origin" branch).
If you don't, you get a rather cryptic message:
usage: git-read-tree (<sha> | -m [-u] <sha1> [<sha2> [<sha3>]])
read-tree failed: 256
You probably want to check whether the origin branch actually
exists.
Apparently you also need to pass the '-x' option to cvsps.
Otherwise, it won't look at anything new.
It would also be nice if the user could pass extra options
to cvsps (notably '-z').
skimo
On Thu, Jun 30, 2005 at 06:10:43PM +0200, Matthias Urlichs wrote:
quoted
I'll find it. However, you don't actually need to re-import your
existing CVS->GIT trees; as long as the dates and the branch names
match, my script will continue where the other left off.
That seems to work, once I figured out I had to pass in the "-o master"
option (as cvs2git didn't create an "origin" branch).
Yes -- that's intentional, as the "master" branch is the one you're
going to add your own work to once the improt is finished. Using
"master" as CVS HEAD would mean that incremental imports no longer work.
If you don't, you get a rather cryptic message:
usage: git-read-tree (<sha> | -m [-u] <sha1> [<sha2> [<sha3>]])
read-tree failed: 256
You probably want to check whether the origin branch actually
exists.
I'll add that, thanks.
Apparently you also need to pass the '-x' option to cvsps.
Otherwise, it won't look at anything new.
Ditto.
It would also be nice if the user could pass extra options
to cvsps (notably '-z').
Ditto. ;-)
--
Matthias Urlichs | {M:U} IT Design @ m-u-it.de | smurf@smurf.noris.de
Disclaimer: The quote was selected randomly. Really. | http://smurf.noris.de
- -
Don't let grass grow on the path of friendship.
-- Blackfoot Indian
From: Sven Verdoolaege <hidden> Date: 2016-06-15 22:42:01
On Thu, Jun 30, 2005 at 11:00:23PM +0200, Matthias Urlichs wrote:
Sven Verdoolaege:
quoted
It would also be nice if the user could pass extra options
to cvsps (notably '-z').
Ditto. ;-)
Actually, do you really have to call cvsps from within your
script ? Why don't you just keep the small shell script
that links cvsps to cvs2git (your version) ?
skimo
On Thu, Jun 30, 2005 at 11:00:23PM +0200, Matthias Urlichs wrote:
quoted
Sven Verdoolaege:
quoted
It would also be nice if the user could pass extra options
to cvsps (notably '-z').
Ditto. ;-)
Actually, do you really have to call cvsps from within your
script ? Why don't you just keep the small shell script
that links cvsps to cvs2git (your version) ?
I dislike temporary files, a shell pipe can't catch errors in earlier
stages without major hackery, Linus didn't have a problem with ripping
it out, and in an earlier life this script was called cvs2bk and called
bk directly, so I kept that.
Enough reasons? ;-) Sure, none of them really prevent me from doing it,
but OTOH I see no reason to resurrect the shell script either.
--
Matthias Urlichs | {M:U} IT Design @ m-u-it.de | smurf@smurf.noris.de
Disclaimer: The quote was selected randomly. Really. | http://smurf.noris.de
- -
Christianity has nothing to offer a happy man
living in a natural, intelligible universe.
-- George H. Smith, "Atheism: The Case Against God"
Until Linus merges it I'd suggest that you post the updated full patch
instead.
Personally, I'd prefer merging.
Linus/everybody_else :-) : Please pull from
rsync://netz.smurf.noris.de/git.git#cvs2git
--
Matthias Urlichs | {M:U} IT Design @ m-u-it.de | smurf@smurf.noris.de
Disclaimer: The quote was selected randomly. Really. | http://smurf.noris.de
- -
We were hungry when we got to Moscow, Soviet.
-- Groucho Marx
From: Sven Verdoolaege <hidden> Date: 2016-06-15 22:42:01
Make specification of CVS module to convert optional.
If we're inside a checked out CVS repository, there is
no need to explicitly specify the module as it is
available in CVS/Repository.
Also read CVS/Root if it's available and -d is not specified.
Finally, explicitly pass root to cvsps as CVS/Root takes
precedence over CVSROOT.
Signed-off-by: Sven Verdoolaege <redacted>
---
commit f9714a4a0cd4ed0ccca3833743d98ea874a2232d
tree de5d7bba63538f29b8ea2b801d932b7679289b96
parent 1cd3674add10d1e511446f3034a1d233a3da7eab
author Sven Verdoolaege [off-list ref] Sun, 03 Jul 2005 11:34:59 +0200
committer Sven Verdoolaege [off-list ref] Sun, 03 Jul 2005 11:40:44 +0200
Documentation/git-cvsimport-script.txt | 2 +-
git-cvsimport-script | 34 ++++++++++++++++++++++++--------
2 files changed, 27 insertions(+), 9 deletions(-)
@@ -26,35 +26,53 @@ use POSIX qw(strftime dup2); $SIG{'PIPE'}="IGNORE"; $ENV{'TZ'}="UTC";-our($opt_h,$opt_o,$opt_v,$opt_d,$opt_p);+our($opt_h,$opt_o,$opt_v,$opt_d,$opt_p,$opt_C); sub usage() { print STDERR <<END; Usage: ${\basename $0} # fetch/update GIT from CVS [ -o branch-for-HEAD ] [ -h ] [ -v ] [ -d CVSROOT ]- [ -p opts-for-cvsps ]- CVS_module [ GIT_repository ]+ [ -p opts-for-cvsps ] [ -C GIT_repository ]+ [ CVS_module ] END exit(1); }-getopts("hqvo:d:p:") or usage();+getopts("hqvo:d:p:C:") or usage(); usage if $opt_h;-@ARGV == 1 or @ARGV == 2 or usage();--my($cvs_tree, $git_tree) = @ARGV;+@ARGV <= 1 or usage(); if($opt_d) { $ENV{"CVSROOT"} = $opt_d;+} elsif(-f 'CVS/Root') {+ open my $f, '<', 'CVS/Root' or die 'Failed to open CVS/Root';+ $opt_d = <$f>;+ chomp $opt_d;+ close $f;+ $ENV{"CVSROOT"} = $opt_d; } elsif($ENV{"CVSROOT"}) { $opt_d = $ENV{"CVSROOT"}; } else { die "CVSROOT needs to be set"; } $opt_o ||= "origin";+my $git_tree = $opt_C; $git_tree ||= ".";+my $cvs_tree;+if ($#ARGV == 0) {+ $cvs_tree = $ARGV[0];+} elsif (-f 'CVS/Repository') {+ open my $f, '<', 'CVS/Repository' or + die 'Failed to open CVS/Repository';+ $cvs_tree = <$f>;+ chomp $cvs_tree;+ close $f+} else {+ usage();+}+ select(STDERR); $|=1; select(STDOUT);
@@ -378,7 +396,7 @@ die "Cannot fork: $!\n" unless defined $ unless($pid) { my @opt; @opt = split(/,/,$opt_p) if defined $opt_p;- exec("cvsps",@opt,"-x","-A","--cvs-direct",$cvs_tree);+ exec("cvsps",@opt,"-x","-A","--cvs-direct",'--root',$opt_d,$cvs_tree); die "Could not start cvsps: $!\n"; }
@@ -48,14 +48,6 @@ OPTIONS <CVS_module>:: The CVS module you want to import. Relative to <CVSROOT>.-<type>::- Typically this matches the real type of <object> but asking- for a type that can trivially dereferenced from the given- <object> is also permitted. An example is to ask for a- "tree" with <object> being a commit object that contains it,- or to ask for a "blob" with <object> being a tag object that- points at it.- -h:: Print a short usage message and exit.
@@ -148,6 +148,8 @@ sub conn { my $pw = IO::Pipe->new(); my $pid = fork(); die "Fork: $!\n" unless defined $pid;+ my $cvs = 'cvs';+ $cvs = $ENV{CVS_SERVER} if exists $ENV{CVS_SERVER}; unless($pid) { $pr->writer(); $pw->reader();
@@ -26,7 +26,8 @@ OPTIONS ------- -d <CVSROOT>:: The root of the CVS archive. May be local (a simple path) or remote;- currently, only the :pserver: access method is supported.+ currently, only the :local:, :ext: and :pserver: access methods + are supported. -o <branch-for-HEAD>:: The 'HEAD' branch from CVS is imported to the 'origin' branch within
Your patches make sense -- thanks; imported.
Linus: Please grab http://netz.smurf.noris.de/git/git.git/#cvs2git.
(A very git-ty URL, that.)
--
Matthias Urlichs | {M:U} IT Design @ m-u-it.de | smurf@smurf.noris.de
Disclaimer: The quote was selected randomly. Really. | http://smurf.noris.de
- -
Quantum Mechanics is God's version of "Trust me."
Note how the patchsets with the same date have somehow
been reversed. Any ideas ?
No. I process the lines from cvsps in the order I get them...
I've also found another typo in your script; see my repo.
Thanks. I guess. ;-)
--
Matthias Urlichs | {M:U} IT Design @ m-u-it.de | smurf@smurf.noris.de
Disclaimer: The quote was selected randomly. Really. | http://smurf.noris.de
- -
People who run down others are taking a roundabout way of praising themselves.
@@ -80,6 +80,8 @@ package CVSconn; # Basic CVS dialog. # We're only interested in connecting and downloading, so ...+use File::Spec;+use File::Temp qw(tempfile); use POSIX qw(strftime dup2); sub new {
@@ -231,11 +233,11 @@ sub _file { sub _line { # Read a line from the server. # ... except that 'line' may be an entire file. ;-)- my($self) = @_;+ my($self, $fh) = @_; die "Not in lines" unless defined $self->{'lines'}; my $line;- my $res="";+ my $res=0; while(defined($line = $self->readline())) { # M U gnupg-cvs-rep/AUTHORS # Updated gnupg-cvs-rep/
@@ -255,16 +257,18 @@ sub _line { chomp $cnt; die "Duh: Filesize $cnt" if $cnt !~ /^\d+$/; $line="";- $res="";+ $res=0; while($cnt) { my $buf; my $num = $self->{'socketi'}->read($buf,$cnt); die "Server: Filesize $cnt: $num: $!\n" if not defined $num or $num<=0;- $res .= $buf;+ print $fh $buf;+ $res += $num; $cnt -= $num; } } elsif($line =~ s/^ //) {- $res .= $line;+ print $fh $line;+ $res += length($line); } elsif($line =~ /^M\b/) { # output, do nothing } elsif($line =~ /^Mbinary\b/) {
@@ -277,7 +281,8 @@ sub _line { my $buf; my $num = $self->{'socketi'}->read($buf,$cnt); die "S: Mbinary $cnt: $num: $!\n" if not defined $num or $num<=0;- $res .= $buf;+ print $fh $buf;+ $res += $num; $cnt -= $num; } } else {
@@ -297,18 +302,21 @@ sub file { my($self,$fn,$rev) = @_; my $res;- if ($self->_file($fn,$rev)) {- $res = $self->_line();- return $res if defined $res;+ my ($fh, $name) = tempfile('gitcvs.XXXXXX', + DIR => File::Spec->tmpdir(), UNLINK => 1);++ $self->_file($fn,$rev) and $res = $self->_line($fh);++ if (!defined $res) {+ # retry+ $self->conn();+ $self->_file($fn,$rev)+ or die "No file command send\n";+ $res = $self->_line($fh);+ die "No input: $fn $rev\n" unless defined $res; }- # retry- $self->conn();- $self->_file($fn,$rev)- or die "No file command send\n";- $res = $self->_line();- die "No input: $fn $rev\n" unless defined $res;- return $res;+ return ($name, $res); }
@@ -631,7 +640,7 @@ while(<CVS>) { } if(($ancestor || $branch) ne $last_branch) { print "Switching from $last_branch to $branch\n" if $opt_v;- system("git-read-tree","-m","-u","$last_branch","$branch");+ system("git-read-tree","-m","$last_branch","$branch"); die "read-tree failed: $?\n" if $?; } if($branch ne $last_branch) {
@@ -648,17 +657,16 @@ while(<CVS>) { my $fn = $1; my $rev = $3; $fn =~ s#^/+##;- my $data = $cvs->file($fn,$rev);- print "".($init ? "New" : "Update")." $fn: ".length($data)." bytes.\n" if $opt_v;- mkpath(dirname($fn),$opt_v);- open(F,"> ./$fn")- or die "Cannot create '$fn': $!\n";- print F $data- or die "Cannot write to '$fn': $!\n";- close(F)- or die "Cannot write to '$fn': $!\n";- chmod(pmode($cvs->{'mode'}), $fn);- push(@new,$fn); # may be resurrected!+ my ($tmpname, $size) = $cvs->file($fn,$rev);+ print "".($init ? "New" : "Update")." $fn: $size bytes.\n" if $opt_v;+ open my $F, '-|', "git-write-blob $tmpname"+ or die "Cannot create object: $!\n";+ my $sha = <$F>;+ chomp $sha;+ close $F;+ unlink($tmpname);+ my $mode = pmode($cvs->{'mode'});+ push(@new,[$mode, $sha, $fn]); # may be resurrected! } elsif($state == 9 and /^\s+(\S+):\d(?:\.\d+)+->(\d(?:\.\d+)+)\(DEAD\)\s*$/) { my $fn = $1; $fn =~ s#^/+##;
@@ -688,8 +696,15 @@ if($orig_branch) { unless -f "$git_dir/refs/heads/master"; }-system("git-read-tree","-m","-u","$last_branch","$orig_branch");-die "read-tree failed: $?\n" if $?;+if ($orig_branch) {+ system("git-read-tree",$last_branch);+ die "read-tree failed: $?\n" if $?;+} else {+ system('git-read-tree', $orig_branch);+ die "read-tree failed: $?\n" if $?;+ system('git-checkout-cache', '-a');+ die "checkout-cache failed: $?\n" if $?;+} unlink("$git_dir/HEAD"); symlink("refs/heads/$orig_branch","$git_dir/HEAD");
@@ -16,6 +16,8 @@ use strict; use warnings; use Getopt::Std;+use File::Spec;+use File::Temp qw(tempfile); use File::Path qw(mkpath); use File::Basename qw(basename dirname); use Time::Local;
@@ -377,6 +379,12 @@ my %branch_date; my $git_dir = $ENV{"GIT_DIR"} || ".git"; $git_dir = getwd()."/".$git_dir unless $git_dir =~ m#^/#; $ENV{"GIT_DIR"} = $git_dir;+my $orig_git_index;+$orig_git_index = $ENV{GIT_INDEX_FILE} if exists $ENV{GIT_INDEX_FILE};+my ($git_ih, $git_index) = tempfile('gitXXXXXX', SUFFIX => '.idx',+ DIR => File::Spec->tmpdir());+close ($git_ih);+$ENV{GIT_INDEX_FILE} = $git_index; unless(-d $git_dir) { system("git-init-db"); die "Cannot init the GIT db at $git_tree: $?\n" if $?;
@@ -398,6 +406,9 @@ unless(-d $git_dir) { } $orig_branch = $last_branch;+ # populate index+ system('git-read-tree', $last_branch);+ # Get the last import timestamps opendir(D,"$git_dir/refs/heads"); while(defined(my $head = readdir(D))) {
@@ -686,26 +692,23 @@ while(<CVS>) { } &$commit() if $branch and $state != 11;+unlink($git_index);+ # Now switch back to the branch we were in before all of this happened if($orig_branch) {- print "DONE; switching back to $orig_branch\n" if $opt_v;+ print "DONE\n" if $opt_v; } else { $orig_branch = "master"; print "DONE; creating $orig_branch branch\n" if $opt_v; system("cp","$git_dir/refs/heads/$opt_o","$git_dir/refs/heads/master") unless -f "$git_dir/refs/heads/master";+ unlink("$git_dir/HEAD");+ symlink("refs/heads/$orig_branch","$git_dir/HEAD");+ if (defined $orig_git_index) {+ $ENV{GIT_INDEX_FILE} = $orig_git_index;+ } else {+ delete $ENV{GIT_INDEX_FILE};+ }+ system('git checkout');+ die "checkout failed: $?\n" if $?; }--if ($orig_branch) {- system("git-read-tree",$last_branch);- die "read-tree failed: $?\n" if $?;-} else {- system('git-read-tree', $orig_branch);- die "read-tree failed: $?\n" if $?;- system('git-checkout-cache', '-a');- die "checkout-cache failed: $?\n" if $?;-}--unlink("$git_dir/HEAD");-symlink("refs/heads/$orig_branch","$git_dir/HEAD");-
Why not an explicit '-z' option as in the current git-cvsimport-script ?
Because my code doesn't support compressed cvs connections:
a -z that doesn't work except for the rlog part would be a lie.
Feel free to add that code. ;-)
--
Matthias Urlichs | {M:U} IT Design @ m-u-it.de | smurf@smurf.noris.de
Disclaimer: The quote was selected randomly. Really. | http://smurf.noris.de
- -
Confidence is simply that quiet, assured feeling you have before you
fall flat on your face.
From: Sven Verdoolaege <hidden> Date: 2016-06-15 22:42:01
On Mon, Jul 04, 2005 at 03:53:27PM +0200, Matthias Urlichs wrote:
Hi,
Sven Verdoolaege:
quoted
Why not an explicit '-z' option as in the current git-cvsimport-script ?
Because my code doesn't support compressed cvs connections:
a -z that doesn't work except for the rlog part would be a lie.
I was talking about the cvsps '-z' option (see current git-cvsimport-script).
Are you saying you want to reserve that option to signify compressed
cvs connections ?
skimo
From: Sven Verdoolaege <hidden> Date: 2016-06-15 22:42:01
git-cvsimport-script: update cvsps cache instead of rebuilding it
Updating the cache is sufficient for most purposes.
If users really want to rebuild the cache, they can specify
the option themselves.
---
commit 6e7e37b0bfc921aa1f0cb30560fc128e87a41966
tree 12a9303d4ba4566d9e081b2c375648685ce41e93
parent 46e63efc072bc440e4c6aad33d3157b70f5172b6
author Sven Verdoolaege [off-list ref] Mon, 04 Jul 2005 15:35:30 +0200
committer Sven Verdoolaege [off-list ref] Mon, 04 Jul 2005 15:35:30 +0200
git-cvsimport-script | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
@@ -436,7 +436,7 @@ die "Cannot fork: $!\n" unless defined $ unless($pid) { my @opt; @opt = split(/,/,$opt_p) if defined $opt_p;- exec("cvsps",@opt,"-x","-A","--cvs-direct",'--root',$opt_d,$cvs_tree);+ exec("cvsps",@opt,"-u","-A","--cvs-direct",'--root',$opt_d,$cvs_tree); die "Could not start cvsps: $!\n"; }
Because my code doesn't support compressed cvs connections:
a -z that doesn't work except for the rlog part would be a lie.
I was talking about the cvsps '-z' option (see current git-cvsimport-script).
Are you saying you want to reserve that option to signify compressed
cvs connections ?
Sorry, I was confused -- with cvsps, -capital-Z says to compress.
Ideally, I'd prefer to recycle standard CVS options as much as possible,
but given that the confusion is already there (worse: cvs' -z wants an
argument (compression level), cvsps' -Z doesn't) that may not actually
make sense. *Shrug*
I'm too happy when other people improve my tools to get hung up on
details like that. ;-)
--
Matthias Urlichs | {M:U} IT Design @ m-u-it.de | smurf@smurf.noris.de
Disclaimer: The quote was selected randomly. Really. | http://smurf.noris.de
- -
You'll feel much better once you've given up hope.
From: Sven Verdoolaege <hidden> Date: 2016-06-15 22:42:01
On Mon, Jul 04, 2005 at 04:36:37PM +0200, Matthias Urlichs wrote:
Ideally, I'd prefer to recycle standard CVS options as much as possible,
but given that the confusion is already there (worse: cvs' -z wants an
argument (compression level), cvsps' -Z doesn't) that may not actually
make sense. *Shrug*
I'm too happy when other people improve my tools to get hung up on
details like that. ;-)
Here it is, then.
skimo
--
git-cvsimport-script: provide direct support for cvsps -z option
---
commit 28537171e7ec23c8677ea6e77c208583f95caa28
tree ca80ed2fad05b150984c14a5364dac8d3e307120
parent 6e7e37b0bfc921aa1f0cb30560fc128e87a41966
author Sven Verdoolaege [off-list ref] Mon, 04 Jul 2005 17:10:06 +0200
committer Sven Verdoolaege [off-list ref] Mon, 04 Jul 2005 17:10:06 +0200
git-cvsimport-script | 9 +++++----
1 files changed, 5 insertions(+), 4 deletions(-)
@@ -436,6 +436,7 @@ die "Cannot fork: $!\n" unless defined $ unless($pid) { my @opt; @opt = split(/,/,$opt_p) if defined $opt_p;+ unshift @opt, '-z', $opt_z if defined $opt_z; exec("cvsps",@opt,"-u","-A","--cvs-direct",'--root',$opt_d,$cvs_tree); die "Could not start cvsps: $!\n"; }
If you make it print out its <pid> and then pause, you can use
ls -l /proc/<pid>/fd/
to get an idea of what the files may be. Looks like the new perl version
is leaking file descriptors..
Matthias?
Linus
From: Sven Verdoolaege <hidden> Date: 2016-06-15 22:42:01
On Tue, Jul 05, 2005 at 07:41:30PM -0700, Linus Torvalds wrote:
If you make it print out its <pid> and then pause, you can use
ls -l /proc/<pid>/fd/
to get an idea of what the files may be. Looks like the new perl version
is leaking file descriptors..
Matthias?
That was my mistake, actually.
Thanks for spotting this.
skimo
--
git-cvsimport-script: close temporary file.
---
commit 6b6fdaa290f7dfd178a518fcafb9e14e652eb8ac
tree 725e7c6ecc75a0e90a6bc002ce540bd74dca999e
parent f4b3a4c30b5ea3a5de2a2597a3c53266017d02ba
author Sven Verdoolaege [off-list ref] Wed, 06 Jul 2005 08:01:47 +0200
committer Sven Verdoolaege [off-list ref] Wed, 06 Jul 2005 08:01:47 +0200
git-cvsimport-script | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
to get an idea of what the files may be. Looks like the new perl version
is leaking file descriptors..
Matthias?
That was my mistake, actually.
Thanks for spotting this.
Ouch. For me, the main danger of lots of Python programming is that
I tend not to see this kind of problem any more, because in Python it
Simply Doesn't Happen.
--
Matthias Urlichs | {M:U} IT Design @ m-u-it.de | smurf@smurf.noris.de
Disclaimer: The quote was selected randomly. Really. | http://smurf.noris.de
- -
Conscience is the inner voice that warns us somebody is looking
-- H. L. Mencken
From: Wolfgang Denk <hidden> Date: 2016-06-15 22:42:01
In message [off-list ref] Linus Torvalds wrote:
If you make it print out its <pid> and then pause, you can use
ls -l /proc/<pid>/fd/
to get an idea of what the files may be. Looks like the new perl version
is leaking file descriptors..
It does. In case it's still of interest: log file attached.
Best regards,
Wolfgang Denk
Software Engineering: Embedded and Realtime Systems, Embedded Linux
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd@denx.de
It seems intuitively obvious to me, which means that it might be
wrong. -- Chris Torek