[PATCH] git-cvsimport-script: leave working directory alone.
git-cvsimport-script: leave working directory alone. --- commit 2eb6d82eaa869a1faf4ba3326fd628f76f9f93a8 tree 3e59c8c298e51a8ae20102b4b139c84c79fa54a0 parent 866d13108e969773347828daa9b7f3476ec70cb8 author Sven Verdoolaege [EMAIL PROTECTED] Mon, 04 Jul 2005 00:43:26 +0200 committer Sven Verdoolaege [EMAIL PROTECTED] Mon, 04 Jul 2005 00:43:26 +0200 git-cvsimport-script | 81 ++ 1 files changed, 48 insertions(+), 33 deletions(-) diff --git a/git-cvsimport-script b/git-cvsimport-script --- a/git-cvsimport-script +++ b/git-cvsimport-script @@ -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.XX', + 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); } @@ -457,13 +465,14 @@ my $commit = sub { } while(@new) { my @n2; - if(@new 55) { - @n2 = splice(@new,0,50); + if(@new 12) { + @n2 = splice(@new,0,10); } else { @n2 = @new; @new = (); } - system(git-update-cache,--add,--,@n2); + system(git-update-cache,--add, + (map { ('--cacheinfo', @$_) } @n2)); die Cannot add files: $?\n if $?; } @@ -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; -
[PATCH] git-cvsimport-script: use private index.
git-cvsimport-script: use private index. --- commit 79ee456cf222982f7ee3f003440c57b5f7cffa8b tree c27c7f8bafa48d81a4d9f7562b851681984a9c7e parent 2eb6d82eaa869a1faf4ba3326fd628f76f9f93a8 author Sven Verdoolaege [EMAIL PROTECTED] Mon, 04 Jul 2005 13:36:59 +0200 committer Sven Verdoolaege [EMAIL PROTECTED] Mon, 04 Jul 2005 13:36:59 +0200 git-cvsimport-script | 43 +++ 1 files changed, 23 insertions(+), 20 deletions(-) diff --git a/git-cvsimport-script b/git-cvsimport-script --- a/git-cvsimport-script +++ b/git-cvsimport-script @@ -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('gitXX', 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))) { @@ -643,11 +654,6 @@ while(CVS) { system(git-read-tree,-m,$last_branch,$branch); die read-tree failed: $?\n if $?; } - if($branch ne $last_branch) { - unlink($git_dir/HEAD); - symlink(refs/heads/$branch,$git_dir/HEAD); - $last_branch = $branch; - } $state = 9; } elsif($state == 8) { $logmsg .= $_\n; @@ -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); - - To unsubscribe from this list: send the line unsubscribe git in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: Stacked GIT 0.3 (now more Quilt-like)
Catalin Marinas [EMAIL PROTECTED] writes: On Sun, 2005-07-03 at 14:38 +0200, Peter Osterlund wrote: Catalin Marinas [EMAIL PROTECTED] writes: I know that using -A gives a more detailed output in case of a conflict. The problem is that you will get a conflict even if the changes are identical, making it impossible to detect when a patch was merged upstream. OK, I see. How about using wiggle instead? http://cgi.cse.unsw.edu.au/~neilb/source/wiggle/ That's what patch-utils uses if you run pushpatch -m. wiggle is also a lot smarter than diff3, so there will be fewer cases that result in a conflict. Maybe a parameter to stg push could enable wiggle mode. I haven't used wiggle before but I will give it a try (though I prefer such a tool not to be too smart since it might make mistakes). Anyway, I will make this configurable, i.e. you could put something like below in the .stgitrc file: merger = 'diff3 -m -E %(branch1)s %(ancestor)s %(branch2)s' or merger = 'wiggle -m %(branch1)s %(ancestor)s %(branch2)s' Is there a way in StGIT to undo a push that results in a large mess of conflicts? Good point. No, there isn't yet. I will think about an undo command. At the moment, the old top and bottom ids of a patch are saved so that the patch before the merge can be retrieved but there isn't any command to make use of them. I agree with the other comments, it's probably not wise to rely on wiggle, and wiggle sometimes makes a mess. However, it often does the right thing, and with a configurable merge program and an undo function, this should not be a problem. Just undo and try again if you don't like the result. -- Peter Osterlund - [EMAIL PROTECTED] http://web.telia.com/~u89404340 - To unsubscribe from this list: send the line unsubscribe git in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] cvsimport: rewritten in Perl
On Thu, Jun 30, 2005 at 11:00:23PM +0200, Matthias Urlichs wrote: Sven Verdoolaege: It would also be nice if the user could pass extra options to cvsps (notably '-z'). Ditto. ;-) Why not an explicit '-z' option as in the current git-cvsimport-script ? skimo - To unsubscribe from this list: send the line unsubscribe git in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] cvsimport: rewritten in Perl
Hi, Sven Verdoolaege: 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 | [EMAIL PROTECTED] 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. signature.asc Description: Digital signature
Re: [PATCH] cvsimport: rewritten in Perl
On Mon, Jul 04, 2005 at 03:53:27PM +0200, Matthias Urlichs wrote: Hi, Sven Verdoolaege: 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 - To unsubscribe from this list: send the line unsubscribe git in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] git-cvsimport-script: fix branch switching
git-cvsimport-script: fix branch switching Previous patch broke branch switching. --- commit 46e63efc072bc440e4c6aad33d3157b70f5172b6 tree 2c4fd7286e29e6041808d07874ef2151e3876676 parent 79ee456cf222982f7ee3f003440c57b5f7cffa8b author Sven Verdoolaege [EMAIL PROTECTED] Mon, 04 Jul 2005 15:28:36 +0200 committer Sven Verdoolaege [EMAIL PROTECTED] Mon, 04 Jul 2005 15:28:36 +0200 git-cvsimport-script |3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/git-cvsimport-script b/git-cvsimport-script --- a/git-cvsimport-script +++ b/git-cvsimport-script @@ -651,9 +651,10 @@ while(CVS) { } if(($ancestor || $branch) ne $last_branch) { print Switching from $last_branch to $branch\n if $opt_v; - system(git-read-tree,-m,$last_branch,$branch); + system(git-read-tree, $branch); die read-tree failed: $?\n if $?; } + $last_branch = $branch if $branch ne $last_branch; $state = 9; } elsif($state == 8) { $logmsg .= $_\n; - To unsubscribe from this list: send the line unsubscribe git in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] git-cvsimport-script: update cvsps cache instead of rebuilding it
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 [EMAIL PROTECTED] Mon, 04 Jul 2005 15:35:30 +0200 committer Sven Verdoolaege [EMAIL PROTECTED] Mon, 04 Jul 2005 15:35:30 +0200 git-cvsimport-script |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/git-cvsimport-script b/git-cvsimport-script --- a/git-cvsimport-script +++ b/git-cvsimport-script @@ -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; } - To unsubscribe from this list: send the line unsubscribe git in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] Better error message from git-ssh-push
If git-ssh-push can't interpret the commit-id, there are various possible issues. Just giving the usage message makes it hard to identify what could be wrong. Signed-off-by: Daniel Barkalow [EMAIL PROTECTED] --- commit 7a274ce1f93e6092dcf226d546a58d2d6df9d13c tree 1f045fa8aa017cabbac613cf8c1ea2bd63ccc46c parent 8934c88118c900fe38abbf60f893ee9ef4e83b3c author Daniel Barkalow [EMAIL PROTECTED] 1120507167 -0400 committer Daniel Barkalow [EMAIL PROTECTED](none) 1120507167 -0400 Index: ssh-push.c === --- 62a74516551505e5fd2b5c2fd14486f3ac8a400e/ssh-push.c (mode:100644 sha1:10390948efacfa06f4f6fc6b2f3631cec6fcb876) +++ 1f045fa8aa017cabbac613cf8c1ea2bd63ccc46c/ssh-push.c (mode:100644 sha1:6b1406b527ba6ede8602a04ab031003edb7da2b0) @@ -257,8 +257,12 @@ usage(ssh_push_usage); commit_id = argv[arg]; url = argv[arg + 1]; - if (get_sha1(commit_id, sha1)) - usage(ssh_push_usage); + if (get_sha1(commit_id, sha1)) { + fprintf(stderr, + Unable to interpret %s as something to push.\n, + commit_id); + return 1; + } memcpy(hex, sha1_to_hex(sha1), sizeof(hex)); argv[arg] = hex; - To unsubscribe from this list: send the line unsubscribe git in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: expensive local git clone
On Mon, 4 Jul 2005, David S. Miller wrote: I can't be the only person in the world seeing this :-) It usually grows to around 88MB and runs for 8 minutes before it finishes. I'm making something based on pack-files. git-local-pull is indeed walking the whole tree and copying one file at a time. We shouldn't use git-fetch-script in git clone (it's really designed for doing one file at a time and for small updates), That said, the pack-file thing I'm working on won't be perfect either, and the main advantage is that it should work over ssh. The fastest way to do a clone is really to do a recursive hardlinked tree, so you may well want to just do #!/bin/sh mkdir $2 cp -rl $1/.git $2/.git and it should be about a million times faster and equally effective. Untested, of course. Linus - To unsubscribe from this list: send the line unsubscribe git in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: Stacked GIT 0.3 (now more Quilt-like)
On Mon, 2005-07-04 at 14:32 +0200, Peter Osterlund wrote: I agree with the other comments, it's probably not wise to rely on wiggle, and wiggle sometimes makes a mess. However, it often does the right thing, and with a configurable merge program and an undo function, this should not be a problem. Just undo and try again if you don't like the result. I uploaded a new snapshot (stgit-20050704.tar.gz) which has support for merge tool configuration. It installs a default /etc/stgitrc file but you can define your own options in ~/.stgitrc or .git/stgitrc (the latter overrides the options in the earlier files). You can even define something like - 'diff3 ... || xxdiff ...' so that if one tool fails it will try the next one (the whole command is executed with 'sh -c'). I will try to write an 'undo' command in the next days. -- Catalin - To unsubscribe from this list: send the line unsubscribe git in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: expensive local git clone
From: Petr Baudis [EMAIL PROTECTED] Date: Mon, 4 Jul 2005 22:42:35 +0200 Dear diary, on Mon, Jul 04, 2005 at 10:39:09PM CEST, I got a letter where Linus Torvalds [EMAIL PROTECTED] told me that... That said, the pack-file thing I'm working on won't be perfect either, and the main advantage is that it should work over ssh. The fastest way to do a clone is really to do a recursive hardlinked tree, so you may well want to just do #!/bin/sh mkdir $2 cp -rl $1/.git $2/.git and it should be about a million times faster and equally effective. Untested, of course. I wouldn't do that on anything but .git/objects. ;-) Agreed. When I do it by hand (but I shouldn't have to do this by hand, git-clone-script should do it this way if that's the best and most efficient) I usually link the object directory then copy the rest of the stuff non-linked. I keep hoping git-clone-script is going to be a good way to clone two local trees. Is my hope misguided? :-) - To unsubscribe from this list: send the line unsubscribe git in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: Last mile for 1.0 again
DB == Daniel Barkalow [EMAIL PROTECTED] writes: DB On Wed, 29 Jun 2005, Junio C Hamano wrote: - Blame/Annotate. Does anybody have a fast and correct one DB How about an option to git-rev-list to take a path, and (1) exclude any DB branch where the version at that path ends up ignored in a merge and DB (2) not list any revision where the version at that path is identical to a DB parent? DB This should give you the list of all commits which are directly DB responsible for the present state of the file, which can then be formatted DB as desired. Sounds close enough if you do not care about copies and complete rewrites. - To unsubscribe from this list: send the line unsubscribe git in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: Last mile for 1.0 again
On Mon, 4 Jul 2005, Linus Torvalds wrote: On Mon, 4 Jul 2005, Daniel Barkalow wrote: How about an option to git-rev-list to take a path, and (1) exclude any branch where the version at that path ends up ignored in a merge and (2) not list any revision where the version at that path is identical to a parent? Hmm. How is that different from git-whatchanged path, really? It would short-circuit going up areas of the history which don't contribute (i.e., lead up to a merge which took its version from a different parent). It could also stop when it ran out of branches that have the file at all. Neither of these is all that significant, I guess. Junio: what's missing from annotate/blame? -Daniel *This .sig left intentionally blank* - To unsubscribe from this list: send the line unsubscribe git in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: expensive local git clone
DSM == David S Miller [EMAIL PROTECTED] writes: DSM Looks interesting. Any particular reason to use cpio DSM instead of cp? No particular reason other than I am just used to doing things that way. - To unsubscribe from this list: send the line unsubscribe git in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: Last mile for 1.0 again
On Mon, 4 Jul 2005, Junio C Hamano wrote: DB == Daniel Barkalow [EMAIL PROTECTED] writes: DB Junio: what's missing from annotate/blame? Which one are you talking about? What I use to generate http://members.cox.net/junkio/Summary.txt is an implementation of an algorithm I consider complete in that it does rename/copy and complete rewrite correctly. What is missing from the implementation is efficiency. [perl script] How does this work, and what do we do about merges? I've got that part, but I'm not clear on how the rename/copy and complete rewrite stuff works. -Daniel *This .sig left intentionally blank* - To unsubscribe from this list: send the line unsubscribe git in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html