{"thread":{"id":"21568","subject":"P4 Sync problem","startedAt":"2009-11-10T13:56:27Z","lastAt":"2010-07-22T18:21:54Z","messageCount":9,"participants":["Dmitry Smirnov","Tor Arvid Lund","Pete Wyckoff","masonk"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"127245","messageId":"loom.20091110T145046-137@post.gmane.org","threadId":"21568","inReplyTo":null,"subject":"P4 Sync problem","fromName":"Dmitry Smirnov","fromEmail":"divis1969@gmail.com","sentAt":"2009-11-10T13:56:27Z","receivedAt":"2009-11-10T13:56:27Z","isPatch":false,"sender":{"key":"divis1969@gmail.com","avatar":null},"body":"Hi,\n\nI'm trying to import Perfoce client into Git repository.\nI had configured git-p4.clent=MYCLIENT and git-p4.useclientspec=true.\n\nWhen runnign git p4 sync --verbose I got the follwing:\n\nc:\\p4\\views\\Git\\p4client>git p4 sync --verbose\nReading pipe: git config git-p4.useclientspec\nReading pipe: git config git-p4.user\nReading pipe: git config git-p4.password\nReading pipe: git config git-p4.port\nReading pipe: git config git-p4.host\nReading pipe: git config git-p4.client\np4 -c MYCLIENT -G client -o\nOpening pipe: p4 -c MYCLIENT -G client -o\nReading pipe: git rev-parse --symbolic  --remotes\nbranches: []\nGetting p4 changes for ...\nTraceback (most recent call last):\n  File \"/usr/sbin/git-core//git-p4\", line 1929, in ?\n    main()\n  File \"/usr/sbin/git-core//git-p4\", line 1924, in main\n    if not cmd.run(args):\n  File \"/usr/sbin/git-core//git-p4\", line 1676, in run\n    changes = p4ChangesForPaths(self.depotPaths, self.changeRange)\n  File \"/usr/sbin/git-core//git-p4\", line 442, in p4ChangesForPaths\n    assert depotPaths\nAssertionError\n\nI would appreciate if someone help to solve this problem.\n\nDmitry\n"},{"id":"127300","messageId":"1a6be5fa0911110043i63b5c032s7924f9f1cdfe32ee@mail.gmail.com","threadId":"21568","inReplyTo":"loom.20091110T145046-137@post.gmane.org","subject":"Re: P4 Sync problem","fromName":"Tor Arvid Lund","fromEmail":"torarvid@gmail.com","sentAt":"2009-11-11T08:43:42Z","receivedAt":"2009-11-11T08:43:42Z","isPatch":false,"sender":{"key":"torarvid@gmail.com","avatar":"https://avatars.githubusercontent.com/u/439758?v=4"},"body":"On Tue, Nov 10, 2009 at 2:56 PM, Dmitry Smirnov <divis1969@gmail.com> wrote:\n> Hi,\n>\n> I'm trying to import Perfoce client into Git repository.\n> I had configured git-p4.clent=MYCLIENT and git-p4.useclientspec=true.\n>\n> When runnign git p4 sync --verbose I got the follwing:\n>\n> c:\\p4\\views\\Git\\p4client>git p4 sync --verbose\n<snip>\n> Traceback (most recent call last):\n>  File \"/usr/sbin/git-core//git-p4\", line 1929, in ?\n>    main()\n>  File \"/usr/sbin/git-core//git-p4\", line 1924, in main\n>    if not cmd.run(args):\n>  File \"/usr/sbin/git-core//git-p4\", line 1676, in run\n>    changes = p4ChangesForPaths(self.depotPaths, self.changeRange)\n>  File \"/usr/sbin/git-core//git-p4\", line 442, in p4ChangesForPaths\n>    assert depotPaths\n> AssertionError\n\nHi. So - I think the problem is that git-p4 doesn't understand what it\nis you want to sync. The git-p4.useclientspec flag was created for the\npurpose where your perforce depot may look like this:\n\n//depot/project1\n//depot/project1/source_code\n//depot/project1/documentation\n//depot/project1/some_large_collection_of_binaries\n\nThen - if I set up my client spec like:\n\n//depot/...\n-//depot/project1/some_large_collection_of_binaries\n\n... and do\n\ngit p4 sync //depot/project1@all\n\n... it should get all project1 files except the\n\"some_large_collection_of_binaries\" subdirectory (provided that you\nhave set the git-p4.client and git-p4.useclientspec).\n\n-Tor Arvid-\n"},{"id":"127311","messageId":"loom.20091111T100646-406@post.gmane.org","threadId":"21568","inReplyTo":"1a6be5fa0911110043i63b5c032s7924f9f1cdfe32ee@mail.gmail.com","subject":"Re: P4 Sync problem","fromName":"Dmitry Smirnov","fromEmail":"divis1969@gmail.com","sentAt":"2009-11-11T09:43:52Z","receivedAt":"2009-11-11T09:43:52Z","isPatch":false,"sender":{"key":"divis1969@gmail.com","avatar":null},"body":"Tor Arvid Lund <torarvid <at> gmail.com> writes:\n\n> Hi. So - I think the problem is that git-p4 doesn't understand what it\n> is you want to sync. \n\nI believe it will never understand that until self.depotPaths \nwill be initialized.\nIt looks like it is intitilized from argument list only (or from already saved \nsettings). See P4Sync.run(). \nBut self.getClientSpec() which is called some time before, does not init neither \nself.depotPaths nor args.\n\nI had fixed this with the following code (new lines marked with +):\n        if self.useClientSpec or gitConfig(\"git-p4.useclientspec\") == \"true\":\n+            if self.verbose:\n+                print \"Get client spec\"\n            self.getClientSpec()\n+            if self.verbose:\n+                print \"Client Spec Dirs: %s\" % self.clientSpecDirs\n+            if len(args) == 0:\n+                for item in self.clientSpecDirs:\n+                      k,v = item\n+                      args.append(k)\n\nUnfortunately, this fails on another stage:\n\n>git p4 sync --verbose\nReading pipe: git config git-p4.useclientspec\nGet client spec\nReading pipe: git config git-p4.user\nReading pipe: git config git-p4.password\nReading pipe: git config git-p4.port\nReading pipe: git config git-p4.host\nReading pipe: git config git-p4.client\np4 -c MYCLIENT-G client -o\nOpening pipe: p4 -c MYCLIENT-G client -o\n\nClient Spec Dirs:[ <my paths here> ]\nDoing initial import of  <my paths here> from revision #head into \nrefs/remotes/p4/master\np4 -c MYCLIENT-G files <my paths here appended with ...#head >\nOpening pipe: p4 -c MYCLIENT-G files <my paths here appended with ...#head >\np4 returned an error: //MYCLIENT/path/file.c/...#head> - file(s) not in client \nview.\n\nMy client spec contains some line to the file:\n-//depot/path/... //MYCLIENT/null/...\n//depot/path/file.cs //MYCLIENT/path/file.cs\n\nThis means that I wish to sync only file.cs into my client and get rid of other \nfiles in this directory.\nBTW, note that file extension is truncated in the log\n\n\nDmitry\n"},{"id":"127319","messageId":"1a6be5fa0911110400l1fe931afmbb53ceba8704e029@mail.gmail.com","threadId":"21568","inReplyTo":"loom.20091111T100646-406@post.gmane.org","subject":"Re: P4 Sync problem","fromName":"Tor Arvid Lund","fromEmail":"torarvid@gmail.com","sentAt":"2009-11-11T12:00:39Z","receivedAt":"2009-11-11T12:00:39Z","isPatch":false,"sender":{"key":"torarvid@gmail.com","avatar":"https://avatars.githubusercontent.com/u/439758?v=4"},"body":"On Wed, Nov 11, 2009 at 10:43 AM, Dmitry Smirnov <divis1969@gmail.com> wrote:\n> Tor Arvid Lund <torarvid <at> gmail.com> writes:\n>\n>> Hi. So - I think the problem is that git-p4 doesn't understand what it\n>> is you want to sync.\n>\n> I believe it will never understand that until self.depotPaths\n> will be initialized.\n\nCorrect.\n\n> It looks like it is intitilized from argument list only (or from already saved\n> settings). See P4Sync.run().\n\nAlso correct, me thinks.\n\n> But self.getClientSpec() which is called some time before, does not init neither\n> self.depotPaths nor args.\n\nCorrect again. The useclientspec flag was created (by me) as a simple\nway to filter out files that I did not want to download (the reason\nbeing my company tends to mix binaries with source files causing\nunnecessary long sync times). So it was never used to tell git-p4\n_what_ to sync, but rather what to _not_ sync.\n\nSo - in your case, you could have tried to just say \"git p4 sync\n//depot@all\", and if your clientspec contained, say, only\n\"//depot/path/projectX\", then projectX should be the only thing that\ngot downloaded. Keep in mind, though, that git-p4 would still ask the\np4 server for _all_ of its changelists, loop through them, and check\neach file in each changelist against the clientSpecDirs array...\n\n> I had fixed this with the following code (new lines marked with +):\n>        if self.useClientSpec or gitConfig(\"git-p4.useclientspec\") == \"true\":\n> +            if self.verbose:\n> +                print \"Get client spec\"\n>            self.getClientSpec()\n> +            if self.verbose:\n> +                print \"Client Spec Dirs: %s\" % self.clientSpecDirs\n> +            if len(args) == 0:\n> +                for item in self.clientSpecDirs:\n> +                      k,v = item\n> +                      args.append(k)\n\nWell, I see what you're trying to do, but I would not want to see that\npatch in the official script, because some (most?) people (myself, at\nleast) use git-p4 to clone single projects out of a perforce depot\nthat may contain many projects. I do this myself by doing:\n\ngit p4 clone //depot/path/to/projectX@all\n\nI usually use one clientspec in perforce, and I do not want to change\nthat... With your patch, I would be in trouble since my clientspec\ncontains \"//depot/...\" (followed by a lot of lines starting with '-')\n\n> Unfortunately, this fails on another stage:\n>\n>>git p4 sync --verbose\n<snip>\n> Opening pipe: p4 -c MYCLIENT-G files <my paths here appended with ...#head >\n> p4 returned an error: //MYCLIENT/path/file.c/...#head> - file(s) not in client\n> view.\n>\n> My client spec contains some line to the file:\n> -//depot/path/... //MYCLIENT/null/...\n> //depot/path/file.cs //MYCLIENT/path/file.cs\n>\n> This means that I wish to sync only file.cs into my client and get rid of other\n> files in this directory.\n> BTW, note that file extension is truncated in the log\n\nYep - this is a bug (or lack of a feature, if you will...). The\nclientspec functionality in git-p4 supports directories only. If you\nlook at the getClientSpec function, you see that it looks for \"...\".\nIt's probably an easy fix if you want to support having single files\nin the client spec. I didn't (and don't) need it, so it didn't occur\nto me at the time...\n\nIf you want to fix it, you might want to rename clientSpecDirs to\nclientSpecEntries or something like that.\n\nBtw... Am I understanding correctly what it is you wish to accomplish?\nI'm guessing that you have a perforce server with a client spec set\nup, and you want to sync everything on the entire server according to\nthat client spec?\n\n-Tor Arvid-\n"},{"id":"127323","messageId":"loom.20091111T131837-901@post.gmane.org","threadId":"21568","inReplyTo":"1a6be5fa0911110400l1fe931afmbb53ceba8704e029@mail.gmail.com","subject":"Re: P4 Sync problem","fromName":"Dmitry Smirnov","fromEmail":"divis1969@gmail.com","sentAt":"2009-11-11T12:39:09Z","receivedAt":"2009-11-11T12:39:09Z","isPatch":false,"sender":{"key":"divis1969@gmail.com","avatar":null},"body":"Tor Arvid Lund <torarvid <at> gmail.com> writes:\n\n\n> Well, I see what you're trying to do, but I would not want to see that\n> patch in the official script, because some (most?) people (myself, at\n> least) use git-p4 to clone single projects out of a perforce depot\n> that may contain many projects. I do this myself by doing:\n> \n> git p4 clone //depot/path/to/projectX <at> all\n> \n> I usually use one clientspec in perforce, and I do not want to change\n> that... With your patch, I would be in trouble since my clientspec\n> contains \"//depot/...\" (followed by a lot of lines starting with '-')\n\nWell, does this mean that if you try to sync the client in perforce (visual or \ncommand line), you will sync all the projects?\n\nIn that case, git p4 will require significant effort to satisfy both of us :-) \nUnfortunatly, it seems I'm in minory group of git-p4 users...\n\ni would propose to use both command-line arguments and a client spec \nto create a correct filter of what should be synced/cloned.\nBTW, it looks this script does not honor neither the order of paths \nin the spec (which can be important) nor mapping of the files to a local tree.\n \n\n> If you want to fix it, you might want to rename clientSpecDirs to\n> clientSpecEntries or something like that.\n\nFor now, I just commented out two lines in the run() procedure:\n            #if not p.endswith(\"/\"):\n            #    p += \"/\"\n\n> Btw... Am I understanding correctly what it is you wish to accomplish?\n> I'm guessing that you have a perforce server with a client spec set\n> up, and you want to sync everything on the entire server according to\n> that client spec?\n\nyes. Client spec completely defines the project layout for me. \nIt contains paths to some components that are mapped to the \nclient working tree.\nJust if your CS contain \n\n//depot/path/to/projectX/... //CLIENT/...\n"},{"id":"127330","messageId":"1a6be5fa0911110554u7c3a04c8hf50100b784b63c7a@mail.gmail.com","threadId":"21568","inReplyTo":"loom.20091111T131837-901@post.gmane.org","subject":"Re: P4 Sync problem","fromName":"Tor Arvid Lund","fromEmail":"torarvid@gmail.com","sentAt":"2009-11-11T13:54:23Z","receivedAt":"2009-11-11T13:54:23Z","isPatch":false,"sender":{"key":"torarvid@gmail.com","avatar":"https://avatars.githubusercontent.com/u/439758?v=4"},"body":"On Wed, Nov 11, 2009 at 1:39 PM, Dmitry Smirnov <divis1969@gmail.com> wrote:\n> Tor Arvid Lund <torarvid <at> gmail.com> writes:\n>\n>\n>> Well, I see what you're trying to do, but I would not want to see that\n>> patch in the official script, because some (most?) people (myself, at\n>> least) use git-p4 to clone single projects out of a perforce depot\n>> that may contain many projects. I do this myself by doing:\n>>\n>> git p4 clone //depot/path/to/projectX <at> all\n>>\n>> I usually use one clientspec in perforce, and I do not want to change\n>> that... With your patch, I would be in trouble since my clientspec\n>> contains \"//depot/...\" (followed by a lot of lines starting with '-')\n>\n> Well, does this mean that if you try to sync the client in perforce (visual or\n> command line), you will sync all the projects?\n\nYes, but I generally try to not use perforce, but git instead :-)\n\n> In that case, git p4 will require significant effort to satisfy both of us :-)\n> Unfortunatly, it seems I'm in minory group of git-p4 users...\n\nI don't know, but if I were to guess, then yes, you probably are... If\nyou have a complex perforce client spec setup, then there may of\ncourse be problems that git-p4 might not solve for you. Since nobody\nhas volunteered to implement the features you describe yet, I believe\nthat most of us git-p4 users have fairly simple client spec setups.\n\nFor me, most projects in p4 are such that I can give one root\ndirectory to \"git p4 sync\", and it works for me. I of course have\nseveral git projects that sync from the same p4 server (only with\ndifferent root dirs). In cases where you have dependencies between\nsuch projects, you should maybe read about git submodules - or maybe\ngoogles \"repo\" script (search for \"google repo git\"). I don't know\nmuch about any of these, other than 'they exist, and seemingly try to\nsolve such issues' :-/\n\n> i would propose to use both command-line arguments and a client spec\n> to create a correct filter of what should be synced/cloned.\n> BTW, it looks this script does not honor neither the order of paths\n> in the spec (which can be important) nor mapping of the files to a local tree.\n\nWhen you have a client spec like:\n\n//depot/A/...\n-//depot/A/B/...\n//depot/A/B/C/...\n\n... git-p4 sorts these paths by length. For a given filename, it finds\nthe longest path that matches that files directory, and if that path\nstarts with a '-', the file is not synced (for a file\n\"//depot/A/B/myfile.c\" it gets a match on \"-//depot/A/B/...\", and\nmyfile.c is not synced, but the file \"//depot/A/B/C/myotherfile.c\" it\nmatches \"//depot/A/B/C/...\")\n\nDo you have an example that shows how it might fail?\n\nAnd no, git-p4 does not care about the local mappings, it reads only\nthe server part.\n\n-Tor Arvid-\n\n>> If you want to fix it, you might want to rename clientSpecDirs to\n>> clientSpecEntries or something like that.\n>\n> For now, I just commented out two lines in the run() procedure:\n>            #if not p.endswith(\"/\"):\n>            #    p += \"/\"\n>\n>> Btw... Am I understanding correctly what it is you wish to accomplish?\n>> I'm guessing that you have a perforce server with a client spec set\n>> up, and you want to sync everything on the entire server according to\n>> that client spec?\n>\n> yes. Client spec completely defines the project layout for me.\n> It contains paths to some components that are mapped to the\n> client working tree.\n> Just if your CS contain\n>\n> //depot/path/to/projectX/... //CLIENT/...\n>\n>\n>\n> --\n> To unsubscribe from this list: send the line \"unsubscribe git\" in\n> the body of a message to majordomo@vger.kernel.org\n> More majordomo info at  http://vger.kernel.org/majordomo-info.html\n>\n"},{"id":"127336","messageId":"loom.20091111T154425-182@post.gmane.org","threadId":"21568","inReplyTo":"1a6be5fa0911110554u7c3a04c8hf50100b784b63c7a@mail.gmail.com","subject":"Re: P4 Sync problem","fromName":"Dmitry Smirnov","fromEmail":"divis1969@gmail.com","sentAt":"2009-11-11T14:57:46Z","receivedAt":"2009-11-11T14:57:46Z","isPatch":false,"sender":{"key":"divis1969@gmail.com","avatar":null},"body":"Tor Arvid Lund <torarvid <at> gmail.com> writes:\n\n> //depot/A/...\n> -//depot/A/B/...\n> //depot/A/B/C/...\n> \n> ... git-p4 sorts these paths by length. For a given filename, it finds\n> the longest path that matches that files directory, and if that path\n> starts with a '-', the file is not synced (for a file\n> \"//depot/A/B/myfile.c\" it gets a match on \"-//depot/A/B/...\", and\n> myfile.c is not synced, but the file \"//depot/A/B/C/myotherfile.c\" it\n> matches \"//depot/A/B/C/...\")\n> \n> Do you have an example that shows how it might fail?\n\nAccording to the P4 User's Guide \n(http://www.perforce.com/perforce/doc.091/manuals/p4guide/02_config.html#1066090) \nPerforce prefer later mapping if there is a conflict.\n\nSo, if you switch paths:\n-//depot/A/B/...\n//depot/A/...\nperforce will sync all the the files. Of course, this is not a very \nuseful case.  \nI suppose the order is not important until mapping are implemented...\n"},{"id":"127608","messageId":"20091115130022.GA20136@arf.padd.com","threadId":"21568","inReplyTo":"loom.20091111T131837-901@post.gmane.org","subject":"Re: P4 Sync problem","fromName":"Pete Wyckoff","fromEmail":"pw@padd.com","sentAt":"2009-11-15T13:00:22Z","receivedAt":"2009-11-15T13:00:22Z","isPatch":false,"sender":{"key":"pw@padd.com","avatar":null},"body":"divis1969@gmail.com wrote on Wed, 11 Nov 2009 12:39 +0000:\n> i would propose to use both command-line arguments and a client spec \n> to create a correct filter of what should be synced/cloned.\n> BTW, it looks this script does not honor neither the order of paths \n> in the spec (which can be important) nor mapping of the files to a local tree.\n\nHere's a hack that I've been using to at least read the repo\nlocations out of the client spec.  In the useclientspec case, it\ntakes all the info on paths from an existing p4 client spec.  No\ncommand line argument to git p4 sync.  Hack out the test for P4ENV;\nthat is site specific for me.\n\nWe've moved away from using client specs with more than 1 line, so\nI'm not interested in this patch anymore.  Also, the long term\nsolution will probably be based on the foreign remote work that\nDaniel and others are doing, so don't invest too much time in fixing\nthis up.  That said, if there is a clean way to support both your\nclient specs and how Tor and others use them, it is worth putting\nin now.\n\nGood luck.\n\n\t\t-- Pete\n\n>From 55e8f6323894031119c755f2c3b3214c1c74b824 Mon Sep 17 00:00:00 2001\nFrom: Pete Wyckoff <pw@padd.com>\nDate: Wed, 26 Nov 2008 12:28:09 -0500\nSubject: [PATCH] honor git client spec\n\nDestination directories for parts of the depot are specified in the\nclient spec.  Use them as given.  Also read the entire client spec to\nfigure out what to do.\n---\n contrib/fast-import/git-p4 |  108 +++++++++++++++++++++++++++++++++++---------\n 1 files changed, 86 insertions(+), 22 deletions(-)\n\ndiff --git a/contrib/fast-import/git-p4 b/contrib/fast-import/git-p4\nindex 1cecae2..28fa95f 100755\n--- a/contrib/fast-import/git-p4\n+++ b/contrib/fast-import/git-p4\n@@ -456,6 +456,26 @@ def p4ChangesForPaths(depotPaths, changeRange):\n     changelist.sort()\n     return changelist\n \n+#\n+# Sort by number of slashes first:  more specific at the top.  Then\n+# sort by alpha within a given number of path components.\n+#\n+def clientSortFunc(a, b):\n+    asrc = a[0]\n+    bsrc = b[0]\n+    asrclen = asrc.count(\"/\")\n+    bsrclen = bsrc.count(\"/\")\n+    if asrclen > bsrclen:\n+\treturn -1\n+    elif asrclen < bsrclen:\n+\treturn 1\n+    elif asrc > bsrc:\n+\treturn 1\n+    elif asrc < bsrc:\n+\treturn -1\n+    else:\n+\treturn 0\n+\n class Command:\n     def __init__(self):\n         self.usage = \"usage: %prog [options]\"\n@@ -915,6 +935,11 @@ class P4Sync(Command):\n         return files\n \n     def stripRepoPath(self, path, prefixes):\n+\tif self.clientSpecDirs:\n+\t    for val in self.clientSpecDirs:\n+\t\tif path.startswith(val[0]):\n+\t\t    return val[1] + path[len(val[0]):]\n+\n         if self.keepRepoPath:\n             prefixes = [re.sub(\"^(//[^/]+/).*\", r'\\1', prefixes[0])]\n \n@@ -1038,7 +1063,7 @@ class P4Sync(Command):\n             includeFile = True\n             for val in self.clientSpecDirs:\n                 if f['path'].startswith(val[0]):\n-                    if val[1] <= 0:\n+                    if val[1] == '-':\n                         includeFile = False\n                     break\n \n@@ -1115,6 +1140,7 @@ class P4Sync(Command):\n             self.gitStream.write(\"from %s\\n\" % parent)\n \n         self.streamP4Files(new_files)\n+\n         self.gitStream.write(\"\\n\")\n \n         change = int(details[\"change\"])\n@@ -1476,24 +1502,54 @@ class P4Sync(Command):\n \n \n     def getClientSpec(self):\n-        specList = p4CmdList( \"client -o\" )\n+        specList = p4CmdList(\"client -o\")\n         temp = {}\n+\tclient = \"\"\n+        for entry in specList:\n+            for k,v in entry.iteritems():\n+\t\tif k.startswith(\"Client\"):\n+\t\t    client = v\n+\t\t    print \"client is\", client\n+\tif not client:\n+\t    sys.stderr.write(\"no client found\\n\")\n+\t    sys.exit(1)\n+\tclient = \"//\" + client + \"/\"\n         for entry in specList:\n             for k,v in entry.iteritems():\n                 if k.startswith(\"View\"):\n-                    if v.startswith('\"'):\n-                        start = 1\n-                    else:\n-                        start = 0\n-                    index = v.find(\"...\")\n-                    v = v[start:index]\n-                    if v.startswith(\"-\"):\n-                        v = v[1:]\n-                        temp[v] = -len(v)\n-                    else:\n-                        temp[v] = len(v)\n-        self.clientSpecDirs = temp.items()\n-        self.clientSpecDirs.sort( lambda x, y: abs( y[1] ) - abs( x[1] ) )\n+\t\t    if v.startswith('\"'):\n+\t\t\tv = v[1:]\n+\t\t    if v.endswith('\"'):\n+\t\t\tv = v[:-1]\n+\t\t    d = v.split(\" \");\n+\t\t    if len(d) != 2:\n+\t\t\tsys.stderr.write( \\\n+\t\t\t    \"expecting two fields in view, got: %s\\n\" % v)\n+\t\t\tsys.exit(1)\n+\t\t    if not d[0].endswith(\"...\"):\n+\t\t\tsys.stderr.write(\\\n+\t\t\t    \"expecting trailing ..., got: %s\\n\" % d[0])\n+\t\t\tsys.exit(1)\n+\t\t    d[0] = d[0][:-3]\n+\t\t    if not d[1].endswith(\"...\"):\n+\t\t\tsys.stderr.write(\\\n+\t\t\t    \"expecting trailing ..., got: %s\\n\" % d[1])\n+\t\t\tsys.exit(1)\n+\t\t    d[1] = d[1][:-3]\n+\t\t    if not d[1].startswith(client):\n+\t\t\tsys.stderr.write(\\\n+\t\t\t    \"expecting dest to start with %s, got: %s\\n\" % \\\n+\t\t\t    (client, d[1]))\n+\t\t\tsys.exit(1)\n+\t\t    d[1] = d[1][len(client):]\n+\t\t    # negated items do not appear in tree\n+\t\t    if d[0].startswith(\"-\"):\n+\t\t\td[0] = d[0][1:]\n+\t\t\td[1] = \"\"\n+\t\t    temp[d[0]] = d[1]\n+\n+\tself.clientSpecDirs = temp.items()\n+\tself.clientSpecDirs.sort(clientSortFunc)\n \n     def run(self, args):\n         self.depotPaths = []\n@@ -1755,7 +1811,7 @@ class P4Clone(P4Sync):\n     def __init__(self):\n         P4Sync.__init__(self)\n         self.description = \"Creates a new git repository and imports from Perforce into it\"\n-        self.usage = \"usage: %prog [options] //depot/path[@revRange]\"\n+        self.usage = \"usage: %prog [options] [//depot/path[@revRange]]\"\n         self.options += [\n             optparse.make_option(\"--destination\", dest=\"cloneDestination\",\n                                  action='store', default=None,\n@@ -1783,18 +1839,26 @@ class P4Clone(P4Sync):\n         return os.path.split(depotDir)[1]\n \n     def run(self, args):\n-        if len(args) < 1:\n-            return False\n-\n         if self.keepRepoPath and not self.cloneDestination:\n             sys.stderr.write(\"Must specify destination for --keep-path\\n\")\n             sys.exit(1)\n \n         depotPaths = args\n \n-        if not self.cloneDestination and len(depotPaths) > 1:\n-            self.cloneDestination = depotPaths[-1]\n-            depotPaths = depotPaths[:-1]\n+\tif gitConfig(\"git-p4.useclientspec\") == \"true\":\n+\t    if not os.path.exists(\"P4ENV\"):\n+\t\tsys.stderr.write(\"Must copy P4ENV file from a valid client\\n\")\n+\t\tsys.exit(1)\n+\t    self.getClientSpec()\n+\t    if not depotPaths:\n+\t\tdepotPaths = [p[0] for p in self.clientSpecDirs]\n+\telse:\n+\t    if not depotPaths:\n+\t\tsys.stderr.write(\"Must specify depot path if no client spec\\n\")\n+\t\tsys.exit(1)\n+\n+        if not self.cloneDestination:\n+\t\tself.cloneDestination = \".\"\n \n         self.cloneExclude = [\"/\"+p for p in self.cloneExclude]\n         for p in depotPaths:\n-- \n1.6.2.5\n"},{"id":"146004","messageId":"1279822914118-5326585.post@n2.nabble.com","threadId":"21568","inReplyTo":"loom.20091111T154425-182@post.gmane.org","subject":"Re: P4 Sync problem","fromName":"masonk","fromEmail":"mason.kramer@gmail.com","sentAt":"2010-07-22T18:21:54Z","receivedAt":"2010-07-22T18:21:54Z","isPatch":false,"sender":{"key":"mason.kramer@gmail.com","avatar":null},"body":"\nHi, I know this is an old thread, but I think it might be relevant.  (At any\nrate, at least you know I've been looking).\n\nI'm trying to use git-p4 with a very large P4 repository, of which my client\nview is a small fraction.  \nMy client view is within the administrator-set file limit of P4 files. \nE.G., p4 sync //depot/... works.\n\nWhen I call git-p4 sync or clone, however, it bumps into the limit.  Even if\nI am using client spec and detecting branches.  If p4 were successfully\ndetecting my branches -or- using my client spec, I would not be running into\nthe limit.  But:\n\ngit p4 sync //depot@all --use-client-spec --detect-branches --verbose\nSyncing with origin first by calling git fetch origin\nexecuting git fetch origin\nReading pipe: git config git-p4.user\nReading pipe: git config git-p4.password\nReading pipe: git config git-p4.port\nReading pipe: git config git-p4.host\nReading pipe: git config git-p4.client\np4 -u mkramer -c mkramer -G client -o\nOpening pipe: p4 -u mkramer -c mkramer -G client -o\nReading pipe: git rev-parse --symbolic  --remotes\nReading pipe: git rev-parse p4/master\np4-git branches: []\ninitial parents: {}\nGetting p4 changes for //depot/...\np4 -u mkramer -c mkramer changes //depot/...\nReading pipe: p4 -u mkramer -c mkramer changes //depot/...\nRequest too large (over 110000); see 'p4 help maxresults'.\nTraceback (most recent call last):\n  File \"/home/mkramer/git/bin/git-p4\", line 1924, in <module>\n    main()\n  File \"/home/mkramer/git/bin/git-p4\", line 1919, in main\n    if not cmd.run(args):\n  File \"/home/mkramer/git/bin/git-p4\", line 1671, in run\n    changes = p4ChangesForPaths(self.depotPaths, self.changeRange)\n  File \"/home/mkramer/git/bin/git-p4\", line 444, in p4ChangesForPaths\n    for p in depotPaths]))\n  File \"/home/mkramer/git/bin/git-p4\", line 108, in p4_read_pipe_lines\n    return read_pipe_lines(real_cmd)\n  File \"/home/mkramer/git/bin/git-p4\", line 101, in read_pipe_lines\n    die('Command failed: %s' % c)\n  File \"/home/mkramer/git/bin/git-p4\", line 59, in die\n    raise Exception(msg)\nException: Command failed: p4 -u mkramer -c mkramer changes //depot/...\n\n\nIs this a limitation in the current --use-client-spec or --detect-branches\nflags, or am I doing it wrong?\n-- \nView this message in context: http://git.661346.n2.nabble.com/P4-Sync-problem-tp3979793p5326585.html\nSent from the git mailing list archive at Nabble.com.\n"}]}