{"thread":{"id":"34589","subject":"Re: [PATCH] git-p4: use \"p4 fstat\" to interpret View setting","startedAt":"2013-08-02T21:53:59Z","lastAt":"2013-08-05T04:49:51Z","messageCount":2,"participants":["Pete Wyckoff","kazuki saitoh"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"224464","messageId":"20130802215359.GB9142@padd.com","threadId":"34589","inReplyTo":"CACGba4yGZDnr-1R-6k-sZoh4P=fu9M0bsmH3uoqj3tXUPsZRYw@mail.gmail.com","subject":"Re: [PATCH] git-p4: use \"p4 fstat\" to interpret View setting","fromName":"Pete Wyckoff","fromEmail":"pw@padd.com","sentAt":"2013-08-02T21:53:59Z","receivedAt":"2013-08-02T21:53:59Z","isPatch":true,"sender":{"key":"pw@padd.com","avatar":null},"body":"ksaitoh560@gmail.com wrote on Fri, 02 Aug 2013 17:02 +0900:\n> I trying clone Perforce project and I found git-p4. It's a great tool!\n> \n> And I don't know how to exclude special extension file in a directory?\n> (Practically, I want to exclude Excel files at git p4 clone/sync.)\n> \n> In Perforce, View setting of p4 client can describe\n>   -//depot/project/files/*.xls //client/project/files/*.xls\n> to exclude Excel files.\n> But \"git p4 --use-client-spec\" cannot support '*'.\n> \n> In git-p4.py, \"map_in_client\" method analyzes View setting and return\n> client file path.\n> So I modify the method to just use p4 command, \"p4 fstat -T clientFile\".\n> \n> I'd like to know your opinions about that and what you think about the\n> suggestion.\n\nThis is either incredibly brilliant or fundamentally broken.  I'm\nhoping for the former.  :)\n\nYour theory is:  there is a client spec, and p4 knows how to\ninterpret these things, so instead of figuring out and\nimplementing the algorithms for %% and * and ... in git-p4, just\nask p4 directly.\n\nLet me play with this for a bit.  I wonder about the performance\naspects of doing a \"p4 fstat\" for every file.  Would it be\npossible to do one or a few batch queries higher up somewhere?\n\nA few nit-picky questions below, just on the test bits, while I\nplay with your code.\n\n> diff --git a/t/lib-git-p4.sh b/t/lib-git-p4.sh\n> index 2098b9b..fbda1ad 100644\n> --- a/t/lib-git-p4.sh\n> +++ b/t/lib-git-p4.sh\n> @@ -48,6 +48,9 @@ P4DPORT=$((10669 + ($testid - $git_p4_test_start)))\n>  P4PORT=localhost:$P4DPORT\n>  P4CLIENT=client\n>  P4EDITOR=:\n> +P4USER=\"\"\n> +P4PASS=\"\"\n> +P4CHARSET=\"\"\n\nWhy do you need these?\n\n> diff --git a/t/t9801-git-p4-branch.sh b/t/t9801-git-p4-branch.sh\n> index 2bf142d..b97bdda 100755\n> --- a/t/t9801-git-p4-branch.sh\n> +++ b/t/t9801-git-p4-branch.sh\n> @@ -480,6 +480,7 @@ test_expect_success 'use-client-spec detect-branches\n> skips branches setup' '\n>  test_expect_success 'use-client-spec detect-branches skips branches' '\n>   client_view \"//depot/usecs/... //client/...\" \\\n>      \"-//depot/usecs/b3/... //client/b3/...\" &&\n> +    ( p4 sync ) &&\n>   test_when_finished cleanup_git &&\n\nHow does the p4 sync help here?\n\n> +test_expect_success 'view wildcard *' '\n> + client_view \"//depot/... //client/...\" \\\n> + \"-//depot/dir1/*.junk //client/dir1/*.junk\" \\\n> + \"-//depot/dir2/*.junk //client/dir2/*.junk\" &&\n> + (p4 sync ) &&\n> + files=\"dir1/file11 dir1/file12 dir2/file21 dir2/file22\" &&\n> + client_verify $files &&\n> + git p4 clone --use-client-spec --dest=\"$git\" //depot &&\n> + git_verify $files\n> +'\n\nIt works!  Cool.\n\n\t\t-- Pete\n"},{"id":"224565","messageId":"CACGba4wiVarQhtqMqaSU+qjp0=5V0w_UUKZt1QZ4MYf=MJn7=Q@mail.gmail.com","threadId":"34589","inReplyTo":"20130802215359.GB9142@padd.com","subject":"Re: [PATCH] git-p4: use \"p4 fstat\" to interpret View setting","fromName":"kazuki saitoh","fromEmail":"ksaitoh560@gmail.com","sentAt":"2013-08-05T04:49:51Z","receivedAt":"2013-08-05T04:49:51Z","isPatch":true,"sender":{"key":"ksaitoh560@gmail.com","avatar":"https://avatars.githubusercontent.com/u/217076?v=4"},"body":"Hi, Pete\nThank you reply.\n\n> Your theory is:  there is a client spec, and p4 knows how to\n> interpret these things, so instead of figuring out and\n> implementing the algorithms for %% and * and ... in git-p4, just\n> ask p4 directly.\nThat's right.\nIt is simple way to get my purpose unless break existing function\nAnd passed all existing test.\n\n> Let me play with this for a bit.  I wonder about the performance\n> aspects of doing a \"p4 fstat\" for every file.  Would it be\n> possible to do one or a few batch queries higher up somewhere?\nOh yes, thank you advice.\nMy patch is quick hack to get file info absolutely, but now, I found\ndirectory unit query (e.g.   p4 fstat -T clientFile\n//depot/project/... )\nBetter way is that use directory unit query  then caching.\nI will try it.\n\n\n> > +P4USER=\"\"\n> > +P4PASS=\"\"\n> > +P4CHARSET=\"\"\n>\n> Why do you need these?\nMy environment set P4CHARSET=utf8, but \"start_p4d\" is failed.\nSo I undefined P4CHARSET and then passed.\nI don't understand source cause clearly, perhaps only Japanese\nenvironment problem.\nHow about other environment?\n\nP4USER, P4PASS description is no need, just it make sure. I will remove, sorry.\n\n\n> > +    ( p4 sync ) &&\n> >   test_when_finished cleanup_git &&\n>\n> How does the p4 sync help here?\nIf remove this line, some test is failed.\nBecause sometime \"p4 fstat\" return wrong result after modified p4\nclient View setting.\n\nI don't understand Perforce behavior clearly.\nMaybe after modify View, something commend is need to sync server side\nand client side.\n\nThis is week point of my suggestion, but I think this situation is rare.\n"}]}