{"thread":{"id":"4311","subject":"[PATCH 0/3] Handful of cvsexportcommit patches","startedAt":"2006-05-27T16:36:41Z","lastAt":"2006-06-17T17:46:40Z","messageCount":6,"participants":["Yann Dirson","Sven Verdoolaege"],"isPatch":true,"patchVersion":1,"patchTotal":3},"messages":[{"id":"20802","messageId":"20060527163641.474.93575.stgit@gandelf.nowhere.earth","threadId":"4311","inReplyTo":null,"subject":"[PATCH 0/3] Handful of cvsexportcommit patches","fromName":"Yann Dirson","fromEmail":"ydirson@altern.org","sentAt":"2006-05-27T16:36:41Z","receivedAt":"2006-05-27T16:36:41Z","isPatch":true,"sender":{"key":"ydirson@altern.org","avatar":"https://avatars.githubusercontent.com/u/1190950?v=4"},"body":"The following series contains a collection of cvsexportcommit changes I have at hand.\nThe support for creating directory files was only tested on a 1.0.7 code base, I'll\nhave to shake this one before being confident with it, but that will be done next week.\nIn the meantime, it may still be of interest for someone :)\n\nBest regards,\n-- \nYann Dirson    <ydirson@altern.org> |\nDebian-related: <dirson@debian.org> |   Support Debian GNU/Linux:\n                                    |  Freedom, Power, Stability, Gratis\n     http://ydirson.free.fr/        | Check <http://www.debian.org/>\n"},{"id":"20805","messageId":"20060527163931.474.19611.stgit@gandelf.nowhere.earth","threadId":"4311","inReplyTo":"20060527163641.474.93575.stgit@gandelf.nowhere.earth","subject":"[PATCH 1/3] Do not call 'cmp' with non-existant -q flag.","fromName":"Yann Dirson","fromEmail":"ydirson@altern.org","sentAt":"2006-05-27T16:39:31Z","receivedAt":"2006-05-27T16:39:31Z","isPatch":true,"sender":{"key":"ydirson@altern.org","avatar":"https://avatars.githubusercontent.com/u/1190950?v=4"},"body":"\nI cannot find when that flag was removed if it ever existed, I can find\nnothing about it in the ChangeLog and NEWS file of GNU diff.  The current\nflag is -s aka --quiet aka --silent, so let's use -s, assuming it is a\nportable flag.  Feel free to lart me with a POSIX bible if needed.\n\nSigned-off-by: Yann Dirson <ydirson@altern.org>\n---\n\n git-cvsexportcommit.perl |    2 +-\n 1 files changed, 1 insertions(+), 1 deletions(-)\n\ndiff --git a/git-cvsexportcommit.perl b/git-cvsexportcommit.perl\nindex f994443..ed87dc9 100755\n--- a/git-cvsexportcommit.perl\n+++ b/git-cvsexportcommit.perl\n@@ -151,7 +151,7 @@ foreach my $f (@bfiles) {\n     my $blob = `git-ls-tree $tree \"$f\" | cut -f 1 | cut -d ' ' -f 3`;\n     chomp $blob;\n     `git-cat-file blob $blob > $tmpdir/blob`;\n-    if (system('cmp', '-q', $f, \"$tmpdir/blob\")) {\n+    if (system('cmp', '-s', $f, \"$tmpdir/blob\")) {\n \twarn \"Binary file $f in CVS does not match parent.\\n\";\n \t$dirty = 1;\n \tnext;\n"},{"id":"20804","messageId":"20060527163933.474.4059.stgit@gandelf.nowhere.earth","threadId":"4311","inReplyTo":"20060527163641.474.93575.stgit@gandelf.nowhere.earth","subject":"[PATCH 2/3] Document current cvsps limitations.","fromName":"Yann Dirson","fromEmail":"ydirson@altern.org","sentAt":"2006-05-27T16:39:33Z","receivedAt":"2006-05-27T16:39:33Z","isPatch":true,"sender":{"key":"ydirson@altern.org","avatar":"https://avatars.githubusercontent.com/u/1190950?v=4"},"body":"\nSince there is no bugtracker that I know of, let's just use the scripts\nthemselves to document their limitations.\n\nSigned-off-by: Yann Dirson <ydirson@altern.org>\n---\n\n git-cvsexportcommit.perl |    7 +++++++\n 1 files changed, 7 insertions(+), 0 deletions(-)\n\ndiff --git a/git-cvsexportcommit.perl b/git-cvsexportcommit.perl\nindex ed87dc9..3e4e90b 100755\n--- a/git-cvsexportcommit.perl\n+++ b/git-cvsexportcommit.perl\n@@ -1,5 +1,12 @@\n #!/usr/bin/perl -w\n \n+# Known limitations:\n+# - cannot add or remove binary files\n+# - cannot add parent directories when needed\n+# - does not propagate permissions\n+# - tells \"ready for commit\" even when things could not be completed\n+#   (eg addition of a binary file)\n+\n use strict;\n use Getopt::Std;\n use File::Temp qw(tempdir);\n"},{"id":"20803","messageId":"20060527163935.474.22794.stgit@gandelf.nowhere.earth","threadId":"4311","inReplyTo":"20060527163641.474.93575.stgit@gandelf.nowhere.earth","subject":"[PATCH 3/3] Make cvsexportcommit create parent directories as needed.","fromName":"Yann Dirson","fromEmail":"ydirson@altern.org","sentAt":"2006-05-27T16:39:35Z","receivedAt":"2006-05-27T16:39:35Z","isPatch":true,"sender":{"key":"ydirson@altern.org","avatar":"https://avatars.githubusercontent.com/u/1190950?v=4"},"body":"\nThis is a quick port of my initial patch for 1.0.7, that I had forgotten to\npost.  Possibly needs some testing before applying to master.\n\nSigned-off-by: Yann Dirson <ydirson@altern.org>\n---\n\n git-cvsexportcommit.perl |   37 ++++++++++++++++++++++++++++++++-----\n 1 files changed, 32 insertions(+), 5 deletions(-)\n\ndiff --git a/git-cvsexportcommit.perl b/git-cvsexportcommit.perl\nindex 3e4e90b..57088c3 100755\n--- a/git-cvsexportcommit.perl\n+++ b/git-cvsexportcommit.perl\n@@ -2,7 +2,6 @@ #!/usr/bin/perl -w\n \n # Known limitations:\n # - cannot add or remove binary files\n-# - cannot add parent directories when needed\n # - does not propagate permissions\n # - tells \"ready for commit\" even when things could not be completed\n #   (eg addition of a binary file)\n@@ -11,7 +10,7 @@ use strict;\n use Getopt::Std;\n use File::Temp qw(tempdir);\n use Data::Dumper;\n-use File::Basename qw(basename);\n+use File::Basename qw(basename dirname);\n \n unless ($ENV{GIT_DIR} && -r $ENV{GIT_DIR}){\n     die \"GIT_DIR is not defined or is unreadable\";\n@@ -91,7 +90,7 @@ close MSG;\n `git-cat-file commit $commit | sed -e '1,/^\\$/d' >> .msg`;\n $? && die \"Error extracting the commit message\";\n \n-my (@afiles, @dfiles, @mfiles);\n+my (@afiles, @dfiles, @mfiles, @dirs);\n my @files = safe_pipe_capture('git-diff-tree', '-r', $parent, $commit);\n #print @files;\n $? && die \"Error in git-diff-tree\";\n@@ -99,7 +98,14 @@ foreach my $f (@files) {\n     chomp $f;\n     my @fields = split(m!\\s+!, $f);\n     if ($fields[4] eq 'A') {\n-\tpush @afiles, $fields[5];\n+        my $path = $fields[5];\n+\tpush @afiles, $path;\n+        # add any needed parent directories\n+\t$path = dirname $path;\n+\twhile (!-d $path and ! grep { $_ eq $path } @dirs) {\n+\t    unshift @dirs, $path;\n+\t    $path = dirname $path;\n+\t}\n     }\n     if ($fields[4] eq 'M') {\n \tpush @mfiles, $fields[5];\n@@ -114,13 +120,21 @@ undef @files; # don't need it anymore\n \n # check that the files are clean and up to date according to cvs\n my $dirty;\n+foreach my $d (@dirs) {\n+    if (-e $d) {\n+\t$dirty = 1;\n+\twarn \"$d exists and is not a directory!\\n\";\n+    }\n+}\n foreach my $f (@afiles) {\n     # This should return only one value\n     my @status = grep(m/^File/,  safe_pipe_capture('cvs', '-q', 'status' ,$f));\n     if (@status > 1) { warn 'Strange! cvs status returned more than one line?'};\n-    unless ($status[0] =~ m/Status: Unknown$/) {\n+    if (-d dirname $f and $status[0] !~ m/Status: Unknown$/\n+\tand $status[0] !~ m/^File: no file /) {\n  \t$dirty = 1;\n \twarn \"File $f is already known in your CVS checkout -- perhaps it has been added by another user. Or this may indicate that it exists on a different branch. If this is the case, use -f to force the merge.\\n\";\n+\twarn \"Status was: $status\\n\";\n     }\n }\n foreach my $f (@mfiles, @dfiles) {\n@@ -146,6 +160,19 @@ ###       you MUST call cleanupcvs(@file\n ###\n \n \n+print \"Creating new directories\\n\";\n+foreach my $d (@dirs) {\n+    unless (mkdir $d) {\n+        warn \"Could not mkdir $d: $!\";\n+\t$dirty = 1;\n+    }\n+    `cvs add $d`;\n+    if ($?) {\n+\t$dirty = 1;\n+\twarn \"Failed to cvs add directory $d -- you may need to do it manually\";\n+    }\n+}\n+\n print \"'Patching' binary files\\n\";\n \n my @bfiles = grep(m/^Binary/, safe_pipe_capture('git-diff-tree', '-p', $parent, $commit));\n"},{"id":"20811","messageId":"20060527191358.GN6535@nowhere.earth","threadId":"4311","inReplyTo":"20060527163933.474.4059.stgit@gandelf.nowhere.earth","subject":"Re: [PATCH 2/3] Document current cvsps limitations.","fromName":"Yann Dirson","fromEmail":"ydirson@altern.org","sentAt":"2006-05-27T19:13:58Z","receivedAt":"2006-05-27T19:13:58Z","isPatch":true,"sender":{"key":"ydirson@altern.org","avatar":"https://avatars.githubusercontent.com/u/1190950?v=4"},"body":"Well, you will have corrected by yourself, but I did mean\n\"cvsexportcommit limitations\" :)\n\n-- \nYann Dirson    <ydirson@altern.org> |\nDebian-related: <dirson@debian.org> |   Support Debian GNU/Linux:\n                                    |  Freedom, Power, Stability, Gratis\n     http://ydirson.free.fr/        | Check <http://www.debian.org/>\n"},{"id":"21962","messageId":"20060617174640.GG1325MdfPADPa@greensroom.kotnet.org","threadId":"4311","inReplyTo":"20060527163935.474.22794.stgit@gandelf.nowhere.earth","subject":"[PATCH] git-cvsexportcommit.perl: fix typo","fromName":"Sven Verdoolaege","fromEmail":"skimo@kotnet.org","sentAt":"2006-06-17T17:46:40Z","receivedAt":"2006-06-17T17:46:40Z","isPatch":true,"sender":{"key":"skimo@kotnet.org","avatar":null},"body":"---\n git-cvsexportcommit.perl |    2 +-\n 1 files changed, 1 insertions(+), 1 deletions(-)\n\ndiff --git a/git-cvsexportcommit.perl b/git-cvsexportcommit.perl\nindex 57088c3..d1051d0 100755\n--- a/git-cvsexportcommit.perl\n+++ b/git-cvsexportcommit.perl\n@@ -134,7 +134,7 @@ foreach my $f (@afiles) {\n \tand $status[0] !~ m/^File: no file /) {\n  \t$dirty = 1;\n \twarn \"File $f is already known in your CVS checkout -- perhaps it has been added by another user. Or this may indicate that it exists on a different branch. If this is the case, use -f to force the merge.\\n\";\n-\twarn \"Status was: $status\\n\";\n+\twarn \"Status was: $status[0]\\n\";\n     }\n }\n foreach my $f (@mfiles, @dfiles) {\n-- \n1.4.0-dirty\n"}]}