{"thread":{"id":"893","subject":"[PATCH] support incremental cvs2git-ing","startedAt":"2005-06-10T19:35:19Z","lastAt":"2005-06-17T16:26:57Z","messageCount":2,"participants":["Panagiotis Issaris","Sven Verdoolaege"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"4828","messageId":"20050610193519.GA28628@lumumba.luc.ac.be","threadId":"893","inReplyTo":null,"subject":"[PATCH] support incremental cvs2git-ing","fromName":"Panagiotis Issaris","fromEmail":"takis@lumumba.luc.ac.be","sentAt":"2005-06-10T19:35:19Z","receivedAt":"2005-06-10T19:35:19Z","isPatch":true,"sender":{"key":"takis@lumumba.luc.ac.be","avatar":null},"body":"Hi Linus,\n\nI wanted to be able to track CVS repositories in a GIT repository. The\ncvs2git program worked fine with the initial import but needed a tiny\nmodification to enable me to resync the GIT repository with the updated\nCVS tree.\n\nWith friendly regards,\nTakis\n\nSigned-off-by: Panagiotis Issaris <takis@lumumba.luc.ac.be>\n---\n\ndiff --git a/cvs2git.c b/cvs2git.c\n--- a/cvs2git.c\n+++ b/cvs2git.c\n@@ -11,6 +11,7 @@\n #include <unistd.h>\n \n static int verbose = 0;\n+static int updating = 0;\n \n /*\n  * This is a really stupid program that takes cvsps output, and\n@@ -28,11 +29,17 @@ static int verbose = 0;\n  * Usage:\n  *\n  *\tTZ=UTC cvsps -A |\n- *\t\tcvs2git --cvsroot=[root] --module=[module] > script\n+ *\t\tgit-cvs2git --cvsroot=[root] --module=[module] > script\n  *\n  * Creates a shell script that will generate the .git archive of\n  * the names CVS repository.\n  *\n+ *\tTZ=UTC cvsps -s 1234- -A |\n+ *\t\tgit-cvs2git -u --cvsroot=[root] --module=[module] > script\n+ *\n+ * Creates a shell script that will update the .git archive with\n+ * CVS changes from patchset 1234 until the last one.\n+ *\n  * IMPORTANT NOTE ABOUT \"cvsps\"! This requires version 2.1 or better,\n  * and the \"TZ=UTC\" and the \"-A\" flag is required for sane results!\n  */\n@@ -113,7 +120,7 @@ static void prepare_commit(void)\n \n static void commit(void)\n {\n-\tconst char *cmit_parent = initial_commit ? \"\" : \"-p HEAD\";\n+\tconst char *cmit_parent = (initial_commit && !updating) ? \"\" : \"-p HEAD\";\n \tconst char *dst_branch;\n \tchar *space;\n \tint i;\n@@ -230,6 +237,10 @@ int main(int argc, char **argv)\n \t\t\tverbose = 1;\n \t\t\tcontinue;\n \t\t}\n+\t\tif (!strcmp(arg, \"-u\")) {\n+\t\t\tupdating = 1;\n+\t\t\tcontinue;\n+\t\t}\n \t}\n \n \n@@ -241,11 +252,13 @@ int main(int argc, char **argv)\n \t\texit(1);\n \t}\n \n-\tprintf(\"[ -d .git ] && exit 1\\n\");\n-\tprintf(\"git-init-db\\n\");\n-\tprintf(\"mkdir -p .git/refs/heads\\n\");\n-\tprintf(\"mkdir -p .git/refs/tags\\n\");\n-\tprintf(\"ln -sf refs/heads/master .git/HEAD\\n\");\n+    if (!updating) {\n+    \tprintf(\"[ -d .git ] && exit 1\\n\");\n+\t    printf(\"git-init-db\\n\");\n+    \tprintf(\"mkdir -p .git/refs/heads\\n\");\n+    \tprintf(\"mkdir -p .git/refs/tags\\n\");\n+    \tprintf(\"ln -sf refs/heads/master .git/HEAD\\n\");\n+    }\n \n \twhile (fgets(line, sizeof(line), stdin) != NULL) {\n \t\tint linelen = strlen(line);\n"},{"id":"5002","messageId":"20050617162657.GG9986MdfPADPa@garage.linux.student.kuleuven.ac.be","threadId":"893","inReplyTo":"20050610193519.GA28628@lumumba.luc.ac.be","subject":"Re: [PATCH] support incremental cvs2git-ing","fromName":"Sven Verdoolaege","fromEmail":"skimo@kotnet.org","sentAt":"2005-06-17T16:26:57Z","receivedAt":"2005-06-17T16:26:57Z","isPatch":true,"sender":{"key":"skimo@kotnet.org","avatar":null},"body":"On Fri, Jun 10, 2005 at 09:35:19PM +0200, Panagiotis Issaris wrote:\n> Hi Linus,\n> \n> I wanted to be able to track CVS repositories in a GIT repository. The\n> cvs2git program worked fine with the initial import but needed a tiny\n> modification to enable me to resync the GIT repository with the updated\n> CVS tree.\n> \n\nThe original version of this patch failed to track the correct\nbranch on the first new commit.\nFixed and tested patch below.\n\nskimo\n--\ncvs2git.c: support incremental conversion\n\nAdd -u option to indicate incremental conversion.\n\nSigned-off-by: Panagiotis Issaris <takis@lumumba.luc.ac.be>\nSigned-off-by: Sven Verdoolaege <skimo@kotnet.org>\n\n---\ncommit 67fcd1648f66d04972c90860b58449f586718653\ntree 698e9c37f91c88c797cab7324d69106b898987a3\nparent 4fd62062eb2d52d32cb771feb05bf1ee29d760f9\nauthor Panagiotis Issaris <takis@lumumba.luc.ac.be> Fri, 17 Jun 2005 18:30:27 +0200\ncommitter Sven Verdoolaege <skimo@kotnet.org> Fri, 17 Jun 2005 18:30:27 +0200\n\n cvs2git.c |   24 ++++++++++++++++++------\n 1 files changed, 18 insertions(+), 6 deletions(-)\n\ndiff --git a/cvs2git.c b/cvs2git.c\n--- a/cvs2git.c\n+++ b/cvs2git.c\n@@ -28,11 +28,17 @@ static int verbose = 0;\n  * Usage:\n  *\n  *\tTZ=UTC cvsps -A |\n- *\t\tcvs2git --cvsroot=[root] --module=[module] > script\n+ *\t\tgit-cvs2git --cvsroot=[root] --module=[module] > script\n  *\n  * Creates a shell script that will generate the .git archive of\n  * the names CVS repository.\n  *\n+ *\tTZ=UTC cvsps -s 1234- -A |\n+ *\t\tgit-cvs2git -u --cvsroot=[root] --module=[module] > script\n+ *\n+ * Creates a shell script that will update the .git archive with\n+ * CVS changes from patchset 1234 until the last one.\n+ *\n  * IMPORTANT NOTE ABOUT \"cvsps\"! This requires version 2.1 or better,\n  * and the \"TZ=UTC\" and the \"-A\" flag is required for sane results!\n  */\n@@ -230,6 +236,10 @@ int main(int argc, char **argv)\n \t\t\tverbose = 1;\n \t\t\tcontinue;\n \t\t}\n+\t\tif (!strcmp(arg, \"-u\")) {\n+\t\t\tinitial_commit = 0;\n+\t\t\tcontinue;\n+\t\t}\n \t}\n \n \n@@ -241,11 +251,13 @@ int main(int argc, char **argv)\n \t\texit(1);\n \t}\n \n-\tprintf(\"[ -d .git ] && exit 1\\n\");\n-\tprintf(\"git-init-db\\n\");\n-\tprintf(\"mkdir -p .git/refs/heads\\n\");\n-\tprintf(\"mkdir -p .git/refs/tags\\n\");\n-\tprintf(\"ln -sf refs/heads/master .git/HEAD\\n\");\n+\tif (initial_commit) {\n+\t\tprintf(\"[ -d .git ] && exit 1\\n\");\n+\t\t    printf(\"git-init-db\\n\");\n+\t\tprintf(\"mkdir -p .git/refs/heads\\n\");\n+\t\tprintf(\"mkdir -p .git/refs/tags\\n\");\n+\t\tprintf(\"ln -sf refs/heads/master .git/HEAD\\n\");\n+\t}\n \n \twhile (fgets(line, sizeof(line), stdin) != NULL) {\n \t\tint linelen = strlen(line);\n"}]}