{"thread":{"id":"3548","subject":"cvsimport woes","startedAt":"2006-03-04T07:47:36Z","lastAt":"2006-03-07T13:42:01Z","messageCount":8,"participants":["Rajkumar S","Martin Langhoff","Junio C Hamano","smurf@smurf.noris.de"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"17141","messageId":"44094618.6070404@asianetindia.com","threadId":"3548","inReplyTo":null,"subject":"cvsimport woes","fromName":"Rajkumar S","fromEmail":"rajkumars@asianetindia.com","sentAt":"2006-03-04T07:47:36Z","receivedAt":"2006-03-04T07:47:36Z","isPatch":false,"sender":{"key":"rajkumars@asianetindia.com","avatar":null},"body":"Hi,\n\nI am trying to track a cvs project using git. The idea is to use cvsimport to update my \nlocal git copy and make my changes in a separate branch. But for some reason after \ncvsimport the last update of cvs repository is not reflected in git. I have made a small \nscript to test this behavior and am able to reproduce is consistently. I am working on \nFreeBSD 6.0-RELEASE, git version 1.2.4 and cvsps version 2.1\n\nThe first script is to init a cvs repository, add 3 files and cvsimport it into git \nrepository, before which I remove the all directories and .cvsps\n\nraj@beastie:~$ cat git_init.sh\nexport CVSROOT=/home/raj/cvsroot\nrm -rf cvsroot/ git/ src/ /home/raj/.cvsps\nmkdir cvsroot  git src\ncvs init\ncd src/\necho \"Line one\" > file.txt\necho \"Line one\" > file1.txt\necho \"Line one\" > file2.txt\ncvs import -m \"Imported sources\" src start realstart\ncd ..\nrm -rf src/\ncvs co src\ngit cvsimport -v -d /home/raj/cvsroot -C git/  src\n\n\non executing:\n\nN src/file.txt\nN src/file1.txt\nN src/file2.txt\n\nNo conflicts created by this import\n\ncvs checkout: Updating src\nU src/file.txt\nU src/file1.txt\nU src/file2.txt\ncvs_direct initialized to CVSROOT /home/raj/cvsroot\ncvs rlog: Logging src\nFetching file.txt   v 1.1\nNew file.txt: 9 bytes\nFetching file1.txt   v 1.1\nNew file1.txt: 9 bytes\nFetching file2.txt   v 1.1\nNew file2.txt: 9 bytes\nTree ID b75643d0deaa77018b4dbaa2ff81756c4c1bebc1\nCommitted patch 1 (origin 2006-03-04 07:37:59)\nCommitting initial tree b75643d0deaa77018b4dbaa2ff81756c4c1bebc1\nCommit ID e800fd633e319b9a0b4c351f2964a03abf96b6e2\nFetching file.txt   v 1.1.1.1\nUpdate file.txt: 9 bytes\nFetching file1.txt   v 1.1.1.1\nUpdate file1.txt: 9 bytes\nFetching file2.txt   v 1.1.1.1\nUpdate file2.txt: 9 bytes\nTree ID b75643d0deaa77018b4dbaa2ff81756c4c1bebc1\nParent ID e800fd633e319b9a0b4c351f2964a03abf96b6e2\nCommitted patch 2 (start 2006-03-04 07:37:59)\nCommit ID 21bd067b19310d11790e99ad421de6611b942fbd\nCreated tag 'realstart' on 'start'\nDONE; creating master branch\n\nNow edit two files, commit cvs and cvsupdate again.\n\nraj@beastie:~$ cat git_test.sh\nexport CVSROOT=/home/raj/cvsroot\ncd src/\necho \"Line two\" >> file.txt\necho \"Line two\" >> file1.txt\ncvs commit -m \"v2.0\"\ncd ..\ngit cvsimport -v -d /home/raj/cvsroot -C git/  src\ncd git\ngit status\ncd ..\necho cat git/file.txt\ncat git/file.txt\necho cat src/file.txt\ncat src/file.txt\n\non executing:\n\ncvs commit: Examining .\nChecking in file.txt;\n/home/raj/cvsroot/src/file.txt,v  <--  file.txt\nnew revision: 1.2; previous revision: 1.1\ndone\nChecking in file1.txt;\n/home/raj/cvsroot/src/file1.txt,v  <--  file1.txt\nnew revision: 1.2; previous revision: 1.1\ndone\ncvs_direct initialized to CVSROOT /home/raj/cvsroot\ncvs rlog: Logging src\nskip patchset 1: 1141457879 before 1141457879\nskip patchset 2: 1141457879 before 1141457879\nSwitching from master to origin\nFetching file.txt   v 1.2\nUpdate file.txt: 18 bytes\nFetching file1.txt   v 1.2\nUpdate file1.txt: 18 bytes\nTree ID 18d855d5b825ef1c0ecb9d26591e654cbe5c21df\nParent ID e800fd633e319b9a0b4c351f2964a03abf96b6e2\nCommitted patch 3 (origin 2006-03-04 07:39:35)\nCommit ID 6e7129d186834d5b2941e78c1c67c5255f868e12\nDONE\n#\n# Updated but not checked in:\n#   (will commit)\n#\n#       modified: file.txt\n#       modified: file1.txt\n#\ncat git/file.txt\nLine one\ncat src/file.txt\nLine one\nLine two\n\n\nAs you can see the git/file.txt and src/file.txt are different. I have tried my best to \nread all documentation and follow them faithfully and I hope I am not making any obviously \n  stupid mistake.\n\nraj\n"},{"id":"17251","messageId":"46a038f90603060124h4ea1c3c6gaa5d8b52ed311230@mail.gmail.com","threadId":"3548","inReplyTo":"44094618.6070404@asianetindia.com","subject":"Re: cvsimport woes","fromName":"Martin Langhoff","fromEmail":"martin.langhoff@gmail.com","sentAt":"2006-03-06T09:24:03Z","receivedAt":"2006-03-06T09:24:03Z","isPatch":false,"sender":{"key":"martin.langhoff@gmail.com","avatar":"https://gravatar.com/avatar/1e3f311b6c4c15836501901ca58f8c0b0667246488084ba524d8bc9867e22fd9?d=mp&s=160"},"body":"Hi Raj,\n\nyou don't seem to be making any silly mistake. Make sure you are using\na recent git, and a recent cvsps. Actually you want the _latest_ cvsps\n(2.1 I think).\n\nA good thing to check is what cvsps is telling cvsimport.\n\n\nNow, here you are not showing us your cvsimport commandline:\n> cvs_direct initialized to CVSROOT /home/raj/cvsroot\n> cvs rlog: Logging src\n> skip patchset 1: 1141457879 before 1141457879\n> skip patchset 2: 1141457879 before 1141457879\n\nAhhh... ok, you are doing it all very fast. Is this a script you are\nrunning? add sleep 1 before you call cvsimport.\n\ncheers,\n\n\nmartin\n"},{"id":"17252","messageId":"46a038f90603060137o758ea7ch6c40652ad86a102a@mail.gmail.com","threadId":"3548","inReplyTo":"46a038f90603060124h4ea1c3c6gaa5d8b52ed311230@mail.gmail.com","subject":"Re: cvsimport woes","fromName":"Martin Langhoff","fromEmail":"martin.langhoff@gmail.com","sentAt":"2006-03-06T09:37:23Z","receivedAt":"2006-03-06T09:37:23Z","isPatch":false,"sender":{"key":"martin.langhoff@gmail.com","avatar":"https://gravatar.com/avatar/1e3f311b6c4c15836501901ca58f8c0b0667246488084ba524d8bc9867e22fd9?d=mp&s=160"},"body":"On 3/6/06, Martin Langhoff <martin.langhoff@gmail.com> wrote:\n> you don't seem to be making any silly mistake. Make sure you are using\n> a recent git, and a recent cvsps. Actually you want the _latest_ cvsps\n> (2.1 I think).\n\nScratch this bit, naturally. I wasn't 100% paying attention. Still,\nthe rest of the answer should kinda/sorta make sense.\n\nsorry!\n\nmartin\n"},{"id":"17259","messageId":"440C68B9.9030305@asianetindia.com","threadId":"3548","inReplyTo":"46a038f90603060137o758ea7ch6c40652ad86a102a@mail.gmail.com","subject":"Re: cvsimport woes","fromName":"Rajkumar S","fromEmail":"rajkumars@asianetindia.com","sentAt":"2006-03-06T16:52:09Z","receivedAt":"2006-03-06T16:52:09Z","isPatch":false,"sender":{"key":"rajkumars@asianetindia.com","avatar":null},"body":"Martin Langhoff wrote:\n> On 3/6/06, Martin Langhoff <martin.langhoff@gmail.com> wrote:\n>> you don't seem to be making any silly mistake. Make sure you are using\n>> a recent git, and a recent cvsps. Actually you want the _latest_ cvsps\n>> (2.1 I think).\n> \n> Scratch this bit, naturally. I wasn't 100% paying attention. Still,\n> the rest of the answer should kinda/sorta make sense.\n\nThanks for your kind replies.\n\nI was also talking to Matthias Urlichs (the author of cvsimport) What he \nsays is that the first version is still checked out because\nthe import does not do the fast-forward/merge by itself.\n\nI am wondering how can I do the fast-forward. I had a long chat in irc \nbut did not find any solution to this particular issue. I tried git \nmerge, but that does not work as the command needs more arguments. (I am \na git newbie and git concepts are still bit fuzzy for me)\n\nI would appreciate a lot if some one can point me in the right direction.\n\nIf you are not following this thread, the problem I am talking about is \nthat when I do a cvsimport for a second time (ie do a git cvsimport; \nupdate the cvs; do a cvsimport again) the second updates are not visible \nin the current directory, though they are present in the git database.\n\nYou can use this script to reproduce this problem.\n\nexport CVSROOT=/home/raj/cvsroot\nrm -rf cvsroot/ git/ src/ /home/raj/.cvsps\nmkdir cvsroot  git src\ncvs init\ncd src/\necho \"Line one\" > file.txt\necho \"Line one\" > file1.txt\necho \"Line one\" > file2.txt\ncvs import -m \"Imported sources\" src start realstart\ncd ..\nrm -rf src/\ncvs co src\ngit cvsimport -v -k -u -m -d $CVSROOT -C git/  src\ncd git\ngit status\ncd ..\ncd src/\necho \"Line two\" >> file.txt\necho \"Line two\" >> file1.txt\ncvs commit -m \"v2.0\"\ncd ..\ngit cvsimport -v -k -u -m -d $CVSROOT -C git/  src\ncd git\ngit status\ncd ..\n\nNow the cvs version of file.txt and git version are different.\n\nThanks and regards,\n\nraj\n"},{"id":"17275","messageId":"46a038f90603061906n6ef7f48dw910661e33496fec3@mail.gmail.com","threadId":"3548","inReplyTo":"440C68B9.9030305@asianetindia.com","subject":"Re: cvsimport woes","fromName":"Martin Langhoff","fromEmail":"martin.langhoff@gmail.com","sentAt":"2006-03-07T03:06:39Z","receivedAt":"2006-03-07T03:06:39Z","isPatch":false,"sender":{"key":"martin.langhoff@gmail.com","avatar":"https://gravatar.com/avatar/1e3f311b6c4c15836501901ca58f8c0b0667246488084ba524d8bc9867e22fd9?d=mp&s=160"},"body":"On 3/7/06, Rajkumar S <rajkumars@asianetindia.com> wrote:\n> You can use this script to reproduce this problem.\n\nRajkumar, does it work better if you add \"sleep 10\" before each\ninvocation of git-cvsimport?\n\ncheers,\n\n\nmartin\n"},{"id":"17281","messageId":"7vek1e6cnk.fsf@assigned-by-dhcp.cox.net","threadId":"3548","inReplyTo":"440C68B9.9030305@asianetindia.com","subject":"Re: cvsimport woes","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-03-07T05:34:39Z","receivedAt":"2006-03-07T05:34:39Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"I've run your reproduction recipe and also looked at #git log\nfrom yesterday.\n\nHere is what I see immediately after the initial cvs import:\n\n$ git show-branch\n* [master] Initial revision\n ! [origin] Initial revision\n  ! [start] Imported sources\n---\n  + [start] Imported sources\n*++ [master] Initial revision\n\nAnd here is what I get immediately after the second one:\n\n$ git show-branch\n* [master] v2.0\n ! [origin] v2.0\n  ! [start] Imported sources\n---\n*+  [master] v2.0\n  + [start] Imported sources\n*++ [master^] Initial revision\n$ git diff --cached --abbrev -r\n:100644 100644 b8b933b... e251870... M  file.txt\n:100644 100644 b8b933b... e251870... M  file1.txt\n\nI think what is happening is that cvsimport updates origin and\nmaster branch HEAD without updating the working tree.  I am not\nsure what the cvsimport command line you used is intended to do:\n\n\tgit cvsimport -v -k -u -m -d $CVSROOT -C git/ src\n\nSpecifically, what branch, if any, is used as the \"tracking\nbranch\" (i.e. stores the unmodified copy from CVS)?  I presume\nit is \"origin\", in which case, I would have expected to see\nsomething like this instead.\n\n$ git show-branch\n* [master] Initial revision\n ! [origin] v2.0\n  ! [start] Imported sources\n---\n +  [origin] v2.0\n  + [start] Imported sources\n*++ [master^] Initial revision\n$ git diff --cached --abbrev -r\n(empty)\n\nThen I would understand what cvsimport author means by \"it does\nnot do fast forward, you have to do it yourself\".  What it means\nis that the import only updates the tracking branch but does not\nupdate your working tree; merging the updates to the tracking\nbranch made from the foreign SCM into your working branch is\nleft for you to perform whenever it is convenient for you to do\n(meaning, you may have some intermediate change in your master\nbranch in which case you would first commit them first and then\nmerge from CVS).  And if that is they way cvsimport is intended\nto be used, then you would at this point do:\n\n$ git pull . origin\n\nto do the fast forward.\n\nI do not understand what cvsimport is trying to do here; I\n_suspect_ the part that updates the \"master\" branch head might\nbe a bug.\n\nSmurf, mind clarifying what is happening here for me please?\n"},{"id":"17284","messageId":"20060307090834.GX13888@smurf.noris.de","threadId":"3548","inReplyTo":"7vek1e6cnk.fsf@assigned-by-dhcp.cox.net","subject":"[PATCH] cvsimport: Remove master-updating code","fromName":"","fromEmail":"smurf@smurf.noris.de","sentAt":"2006-03-07T09:08:34Z","receivedAt":"2006-03-07T09:08:34Z","isPatch":true,"sender":{"key":"matthias@urlichs.de","avatar":"https://gravatar.com/avatar/2708905af227313eba6f2b2ae0f7d0259b5ac5d71baef58fe5a13c699ce0bbf0?d=mp&s=160"},"body":"The code which tried to update the master branch was somewhat broken.\n=> People should do that manually, with \"git merge\".\n\nSigned-off-by: Matthias Urlichs <smurf@smurf.noris.de>\n---\n\nJunio C Hamano:\n> I do not understand what cvsimport is trying to do here; I\n> _suspect_ the part that updates the \"master\" branch head might\n> be a bug.\n> \nThis should fix it.\n\n---\n\n Documentation/git-cvsimport.txt |    6 ++++++\n git-cvsimport.perl              |   27 ++-------------------------\n 2 files changed, 8 insertions(+), 25 deletions(-)\n\n4c28ef8000d68a0736084022a047019dca96c823\ndiff --git a/Documentation/git-cvsimport.txt b/Documentation/git-cvsimport.txt\nindex dfe86ce..57027b4 100644\n--- a/Documentation/git-cvsimport.txt\n+++ b/Documentation/git-cvsimport.txt\n@@ -22,6 +22,12 @@ repository, or incrementally import into\n Splitting the CVS log into patch sets is done by 'cvsps'.\n At least version 2.1 is required.\n \n+You should *never* do any work of your own on the branches that are\n+created by git-cvsimport. The initial import will create and populate a\n+\"master\" branch from the CVS repository's main branch which you're free\n+to work with; after that, you need to 'git merge' incremental imports, or\n+any CVS branches, yourself.\n+\n OPTIONS\n -------\n -d <CVSROOT>::\ndiff --git a/git-cvsimport.perl b/git-cvsimport.perl\nindex b46469a..02d1928 100755\n--- a/git-cvsimport.perl\n+++ b/git-cvsimport.perl\n@@ -452,7 +452,6 @@ chdir($git_tree);\n \n my $last_branch = \"\";\n my $orig_branch = \"\";\n-my $forward_master = 0;\n my %branch_date;\n \n my $git_dir = $ENV{\"GIT_DIR\"} || \".git\";\n@@ -488,21 +487,6 @@ unless(-d $git_dir) {\n \t\t$last_branch = \"master\";\n \t}\n \t$orig_branch = $last_branch;\n-\tif (-f \"$git_dir/CVS2GIT_HEAD\") {\n-\t\tdie <<EOM;\n-CVS2GIT_HEAD exists.\n-Make sure your working directory corresponds to HEAD and remove CVS2GIT_HEAD.\n-You may need to run\n-\n-    git read-tree -m -u CVS2GIT_HEAD HEAD\n-EOM\n-\t}\n-\tsystem('cp', \"$git_dir/HEAD\", \"$git_dir/CVS2GIT_HEAD\");\n-\n-\t$forward_master =\n-\t    $opt_o ne 'master' && -f \"$git_dir/refs/heads/master\" &&\n-\t    system('cmp', '-s', \"$git_dir/refs/heads/master\", \n-\t\t\t\t\"$git_dir/refs/heads/$opt_o\") == 0;\n \n \t# populate index\n \tsystem('git-read-tree', $last_branch);\n@@ -889,17 +873,11 @@ if (defined $orig_git_index) {\n \n # Now switch back to the branch we were in before all of this happened\n if($orig_branch) {\n-\tprint \"DONE\\n\" if $opt_v;\n-\tsystem(\"cp\",\"$git_dir/refs/heads/$opt_o\",\"$git_dir/refs/heads/master\")\n-\t\tif $forward_master;\n-\tunless ($opt_i) {\n-\t\tsystem('git-read-tree', '-m', '-u', 'CVS2GIT_HEAD', 'HEAD');\n-\t\tdie \"read-tree failed: $?\\n\" if $?;\n-\t}\n+\tprint \"DONE; you may need to merge manually.\\n\" if $opt_v;\n } else {\n \t$orig_branch = \"master\";\n \tprint \"DONE; creating $orig_branch branch\\n\" if $opt_v;\n-\tsystem(\"cp\",\"$git_dir/refs/heads/$opt_o\",\"$git_dir/refs/heads/master\")\n+\tsystem(\"git-update-ref\", \"refs/heads/master\", \"refs/heads/$opt_o\")\n \t\tunless -f \"$git_dir/refs/heads/master\";\n \tsystem('git-update-ref', 'HEAD', \"$orig_branch\");\n \tunless ($opt_i) {\n@@ -907,4 +885,3 @@ if($orig_branch) {\n \t\tdie \"checkout failed: $?\\n\" if $?;\n \t}\n }\n-unlink(\"$git_dir/CVS2GIT_HEAD\");\n-- \n1.2.GIT\n\n\n-- \nMatthias Urlichs   |   {M:U} IT Design @ m-u-it.de   |  smurf@smurf.noris.de\nDisclaimer: The quote was selected randomly. Really. | http://smurf.noris.de\n - -\nYou will be run over by a bus.\n"},{"id":"17294","messageId":"440D8DA9.4040206@asianetindia.com","threadId":"3548","inReplyTo":"20060307090834.GX13888@smurf.noris.de","subject":"Re: [PATCH] cvsimport: Remove master-updating code","fromName":"Rajkumar S","fromEmail":"rajkumars@asianetindia.com","sentAt":"2006-03-07T13:42:01Z","receivedAt":"2006-03-07T13:42:01Z","isPatch":true,"sender":{"key":"rajkumars@asianetindia.com","avatar":null},"body":"smurf@smurf.noris.de wrote:\n> Junio C Hamano:\n> \n>>I do not understand what cvsimport is trying to do here; I\n>>_suspect_ the part that updates the \"master\" branch head might\n>>be a bug.\n>>\n> \n> This should fix it.\n\nIt's working fine for me. Thanks!\n\nraj\n"}]}