{"thread":{"id":"10455","subject":"[PATCH] git-cvsimport: Add -N option to force a new import","startedAt":"2007-10-24T23:28:39Z","lastAt":"2007-11-06T21:35:22Z","messageCount":7,"participants":["Matt McCutchen","Junio C Hamano","Johannes Schindelin","Robin Rosenberg","Piet Delaney"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"57118","messageId":"1193268519.8008.11.camel@mattlaptop2","threadId":"10455","inReplyTo":null,"subject":"[PATCH] git-cvsimport: Add -N option to force a new import","fromName":"Matt McCutchen","fromEmail":"matt@mattmccutchen.net","sentAt":"2007-10-24T23:28:39Z","receivedAt":"2007-10-24T23:28:39Z","isPatch":true,"sender":{"key":"matt@mattmccutchen.net","avatar":"https://avatars.githubusercontent.com/u/8885753?v=4"},"body":"I had a git repository for development of rsync and wanted to start\nimporting the upstream CVS with git-cvsimport, but git-cvsimport saw\nthat the git repository existed and insisted on updating a previous\nimport.  This patch adds an -N option to git-cvsimport to force a new\nimport and updates the documentation appropriately.\n\nSigned-off-by: Matt McCutchen <matt@mattmccutchen.net>\n---\nI implemented this because I needed it; adopt it in the main git if you\nlike it.\n\n Documentation/git-cvsimport.txt |    5 ++++-\n git-cvsimport.perl              |    9 ++++++---\n 2 files changed, 10 insertions(+), 4 deletions(-)\n\ndiff --git a/Documentation/git-cvsimport.txt b/Documentation/git-cvsimport.txt\nindex fdd7ec7..f595957 100644\n--- a/Documentation/git-cvsimport.txt\n+++ b/Documentation/git-cvsimport.txt\n@@ -13,7 +13,7 @@ SYNOPSIS\n \t      [-A <author-conv-file>] [-p <options-for-cvsps>] [-P <file>]\n \t      [-C <git_repository>] [-z <fuzz>] [-i] [-k] [-u] [-s <subst>]\n \t      [-a] [-m] [-M <regex>] [-S <regex>] [-L <commitlimit>]\n-\t      [-r <remote>] [<CVS_module>]\n+\t      [-r <remote>] [-N] [<CVS_module>]\n \n\n DESCRIPTION\n@@ -144,6 +144,9 @@ It is not recommended to use this feature if you intend to\n export changes back to CVS again later with\n gitlink:git-cvsexportcommit[1].\n \n+-N::\n+\tDo a new import even if the git repository already exists.\n+\n -h::\n \tPrint a short usage message and exit.\n \ndiff --git a/git-cvsimport.perl b/git-cvsimport.perl\nindex 2954fb8..6f03be9 100755\n--- a/git-cvsimport.perl\n+++ b/git-cvsimport.perl\n@@ -29,7 +29,7 @@ use IPC::Open2;\n $SIG{'PIPE'}=\"IGNORE\";\n $ENV{'TZ'}=\"UTC\";\n \n-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);\n+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_N);\n my (%conv_author_name, %conv_author_email);\n \n sub usage(;$) {\n@@ -40,7 +40,7 @@ Usage: ${\\basename $0}     # fetch/update GIT from CVS\n        [-o branch-for-HEAD] [-h] [-v] [-d CVSROOT] [-A author-conv-file]\n        [-p opts-for-cvsps] [-P file] [-C GIT_repository] [-z fuzz] [-i] [-k]\n        [-u] [-s subst] [-a] [-m] [-M regex] [-S regex] [-L commitlimit]\n-       [-r remote] [CVS_module]\n+       [-r remote] [-N] [CVS_module]\n END\n \texit(1);\n }\n@@ -114,7 +114,7 @@ sub read_repo_config {\n     }\n }\n \n-my $opts = \"haivmkuo:d:p:r:C:z:s:M:P:A:S:L:\";\n+my $opts = \"haivmkuNo:d:p:r:C:z:s:M:P:A:S:L:\";\n read_repo_config($opts);\n getopts($opts) or usage();\n usage if $opt_h;\n@@ -563,7 +563,10 @@ unless (-d $git_dir) {\n \tdie \"Cannot init the GIT db at $git_tree: $?\\n\" if $?;\n \tsystem(\"git-read-tree\");\n \tdie \"Cannot init an empty tree: $?\\n\" if $?;\n+\t$opt_N = 1;\n+}\n \n+if ($opt_N) {\n \t$last_branch = $opt_o;\n \t$orig_branch = \"\";\n } else {\n-- \n1.5.3.3.128.g56927\n"},{"id":"57123","messageId":"7vfxzz51d7.fsf@gitster.siamese.dyndns.org","threadId":"10455","inReplyTo":"1193268519.8008.11.camel@mattlaptop2","subject":"Re: [PATCH] git-cvsimport: Add -N option to force a new import","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2007-10-25T03:17:40Z","receivedAt":"2007-10-25T03:17:40Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Matt McCutchen <matt@mattmccutchen.net> writes:\n\n> I had a git repository for development of rsync and wanted to start\n> importing the upstream CVS with git-cvsimport, but git-cvsimport saw\n> that the git repository existed and insisted on updating a previous\n> import.  This patch adds an -N option to git-cvsimport to force a new\n> import and updates the documentation appropriately.\n\nSounds like a useful addition.  Tests?\n"},{"id":"57132","messageId":"1193284913.2619.23.camel@mattlaptop2","threadId":"10455","inReplyTo":"7vfxzz51d7.fsf@gitster.siamese.dyndns.org","subject":"Re: [PATCH] git-cvsimport: Add -N option to force a new import","fromName":"Matt McCutchen","fromEmail":"matt@mattmccutchen.net","sentAt":"2007-10-25T04:01:53Z","receivedAt":"2007-10-25T04:01:53Z","isPatch":true,"sender":{"key":"matt@mattmccutchen.net","avatar":"https://avatars.githubusercontent.com/u/8885753?v=4"},"body":"On Wed, 2007-10-24 at 20:17 -0700, Junio C Hamano wrote:\n> Matt McCutchen <matt@mattmccutchen.net> writes:\n> \n> > I had a git repository for development of rsync and wanted to start\n> > importing the upstream CVS with git-cvsimport, but git-cvsimport saw\n> > that the git repository existed and insisted on updating a previous\n> > import.  This patch adds an -N option to git-cvsimport to force a new\n> > import and updates the documentation appropriately.\n> \n> Sounds like a useful addition.  Tests?\n\nAre there existing tests for git-cvsimport somewhere whose example I\ncould follow?  (I didn't see any in t/ .)  If not, I suppose I will just\nwrite a simple script that runs git-cvsimport with and without -N and\nwith and without an existing, empty git repository and checks that the\nright things happen.\n\nMatt\n"},{"id":"57154","messageId":"Pine.LNX.4.64.0710251055590.25221@racer.site","threadId":"10455","inReplyTo":"1193284913.2619.23.camel@mattlaptop2","subject":"Re: [PATCH] git-cvsimport: Add -N option to force a new import","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2007-10-25T09:56:36Z","receivedAt":"2007-10-25T09:56:36Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Thu, 25 Oct 2007, Matt McCutchen wrote:\n\n> On Wed, 2007-10-24 at 20:17 -0700, Junio C Hamano wrote:\n> > Matt McCutchen <matt@mattmccutchen.net> writes:\n> > \n> > > I had a git repository for development of rsync and wanted to start\n> > > importing the upstream CVS with git-cvsimport, but git-cvsimport saw\n> > > that the git repository existed and insisted on updating a previous\n> > > import.  This patch adds an -N option to git-cvsimport to force a new\n> > > import and updates the documentation appropriately.\n> > \n> > Sounds like a useful addition.  Tests?\n> \n> Are there existing tests for git-cvsimport somewhere whose example I\n> could follow?  (I didn't see any in t/ .)  If not, I suppose I will just\n> write a simple script that runs git-cvsimport with and without -N and\n> with and without an existing, empty git repository and checks that the\n> right things happen.\n\nMy best bet: t/t9200-cvsexportcommit.sh\n\nHth,\nDscho\n"},{"id":"57224","messageId":"200710252145.40559.robin.rosenberg.lists@dewire.com","threadId":"10455","inReplyTo":"1193284913.2619.23.camel@mattlaptop2","subject":"Re: [PATCH] git-cvsimport: Add -N option to force a new import","fromName":"Robin Rosenberg","fromEmail":"robin.rosenberg.lists@dewire.com","sentAt":"2007-10-25T19:45:39Z","receivedAt":"2007-10-25T19:45:39Z","isPatch":true,"sender":{"key":"robin.rosenberg@dewire.com","avatar":"https://avatars.githubusercontent.com/u/46357?v=4"},"body":"torsdag 25 oktober 2007 skrev Matt McCutchen:\n> On Wed, 2007-10-24 at 20:17 -0700, Junio C Hamano wrote:\n> > Matt McCutchen <matt@mattmccutchen.net> writes:\n> > \n> > > I had a git repository for development of rsync and wanted to start\n> > > importing the upstream CVS with git-cvsimport, but git-cvsimport saw\n> > > that the git repository existed and insisted on updating a previous\n> > > import.  This patch adds an -N option to git-cvsimport to force a new\n> > > import and updates the documentation appropriately.\n> > \n> > Sounds like a useful addition.  Tests?\n> \n> Are there existing tests for git-cvsimport somewhere whose example I\n> could follow?  (I didn't see any in t/ .)  If not, I suppose I will just\n> write a simple script that runs git-cvsimport with and without -N and\n> with and without an existing, empty git repository and checks that the\n> right things happen.\n\nNone, but there should be. I also think cvsps should be included in the git \nrepo since it is required and AFAIK, only git people maintain it. \n\nNow I don't use cvsimport to import my CVS repos, so I'll pass on adding test \ncases. It is a non-trivial task \n\nI did it for cvsexportcommit which didn't have any tests when I started \nhacking it.\n\n-- robin\n"},{"id":"58484","messageId":"1194320170.21645.72.camel@localhost","threadId":"10455","inReplyTo":"7vfxzz51d7.fsf@gitster.siamese.dyndns.org","subject":"Re: [PATCH] git-cvsimport: Add -N option to force a new import","fromName":"Matt McCutchen","fromEmail":"matt@mattmccutchen.net","sentAt":"2007-11-06T03:36:10Z","receivedAt":"2007-11-06T03:36:10Z","isPatch":true,"sender":{"key":"matt@mattmccutchen.net","avatar":"https://avatars.githubusercontent.com/u/8885753?v=4"},"body":"On Wed, 2007-10-24 at 20:17 -0700, Junio C Hamano wrote:\n> Matt McCutchen <matt@mattmccutchen.net> writes:\n> \n> > I had a git repository for development of rsync and wanted to start\n> > importing the upstream CVS with git-cvsimport, but git-cvsimport saw\n> > that the git repository existed and insisted on updating a previous\n> > import.  This patch adds an -N option to git-cvsimport to force a new\n> > import and updates the documentation appropriately.\n> \n> Sounds like a useful addition.  Tests?\n\nGood call!  As I was dismayed to discover, the existing files in the\nworking tree confused the import, so -N as I implemented it is useless.\nI ended up doing the import a different way; I'll notify the list if I\nget around to implementing -N properly.\n\nMatt\n"},{"id":"58596","messageId":"4730DE1A.9010106@gmail.com","threadId":"10455","inReplyTo":"1194320170.21645.72.camel@localhost","subject":"Re: [PATCH] git-cvsimport: Add -N option to force a new import","fromName":"Piet Delaney","fromEmail":"piet.delaney@gmail.com","sentAt":"2007-11-06T21:35:22Z","receivedAt":"2007-11-06T21:35:22Z","isPatch":true,"sender":{"key":"piet.delaney@gmail.com","avatar":null},"body":"Matt McCutchen wrote:\n> On Wed, 2007-10-24 at 20:17 -0700, Junio C Hamano wrote:\n>> Matt McCutchen <matt@mattmccutchen.net> writes:\n>>\n>>> I had a git repository for development of rsync and wanted to start\n>>> importing the upstream CVS with git-cvsimport, but git-cvsimport saw\n>>> that the git repository existed and insisted on updating a previous\n>>> import.  This patch adds an -N option to git-cvsimport to force a new\n>>> import and updates the documentation appropriately.\n>> Sounds like a useful addition.  Tests?\n> \n> Good call!  As I was dismayed to discover, the existing files in the\n> working tree confused the import,\\\n\nWhat's the confusion? I thought updating of the git repo from cvs \nworked. Sigh.\n\n-piet\n\n\n\n>                                   so -N as I implemented it is useless.\n> I ended up doing the import a different way; I'll notify the list if I\n> get around to implementing -N properly.\n> \n> Matt\n> \n"}]}