{"thread":{"id":"8508","subject":"how to properly import perforce history...","startedAt":"2007-06-08T20:22:36Z","lastAt":"2007-06-12T14:12:35Z","messageCount":16,"participants":["Kevin Green","Simon Hausmann","Alex Riesen","Scott Lamb","Han-Wen Nienhuys"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"44371","messageId":"20070608202236.GJ25093@menevado.ms.com","threadId":"8508","inReplyTo":null,"subject":"how to properly import perforce history...","fromName":"Kevin Green","fromEmail":"kevin.t.green@morganstanley.com","sentAt":"2007-06-08T20:22:36Z","receivedAt":"2007-06-08T20:22:36Z","isPatch":false,"sender":{"key":"kevin.t.green@morganstanley.com","avatar":null},"body":"\nVery new to git.  Was hoping this would be much more straightforward and I'm\nassuming I'm just missing something fundamentally easy.\n\nI'm using git-p4import.py which came with my release of git.\n\nI have a small project I'd like to move from perforce to git ( 111 files, 165\nrevisions ).\n\nI've used a number of different approaches to do this, all of them resulting\nin my files being deleted.\n\n1)\n$ git init\n$ git-p4import //depot/path master\n\nbombs out with missing .git/index\n\n2)\n$ p4 sync ...\n$ git init\n$ git add .\n$ git commit\n$ git-p4import --stitch //depot/path\n\nThis imports all the comment history, but deletes all of my files!!\n\n3)\n$ p4 sync ...\n$ git init\n$ git add .\n$ git commit\n$ git-p4import //depot/path new\n### new branch with no files, but all my files in master\n$ git checkout master\n$ git merge new\n### Now I see it deleting all of my files, but it pulls in all of the history. \n\n\nNOTE:  All of the commits pulled in have no file information associated with\nthem...\n\n\nWhat am I missing?\n\n\nThanks\n\n--Kevin\n"},{"id":"44728","messageId":"20070611142525.GN25093@menevado.ms.com","threadId":"8508","inReplyTo":"20070608202236.GJ25093@menevado.ms.com","subject":"Asking again... [Re: how to properly import perforce history?]","fromName":"Kevin Green","fromEmail":"kevin.t.green@morganstanley.com","sentAt":"2007-06-11T14:25:25Z","receivedAt":"2007-06-11T14:25:25Z","isPatch":false,"sender":{"key":"kevin.t.green@morganstanley.com","avatar":null},"body":"Reading this again, the subject was probably misleading...  Sorry for that.\n\nIn the meantime I've been scouring the archives looking for the proper way to\nimport p4 history into a project.\n\nI'm attempting to use git-p4import.py as that's what came with my version of\ngit.  I ran into the problems below.\n\nHow can I properly migrate a project from perforce to git? \n\nThanks\n\n--Kevin\n\n\nOn 06/08/07 16:22:36, Kevin Green wrote:\n> \n> Very new to git.  Was hoping this would be much more straightforward and I'm\n> assuming I'm just missing something fundamentally easy.\n> \n> I'm using git-p4import.py which came with my release of git.\n> \n> I have a small project I'd like to move from perforce to git ( 111 files, 165\n> revisions ).\n> \n> I've used a number of different approaches to do this, all of them resulting\n> in my files being deleted.\n> \n> 1)\n> $ git init\n> $ git-p4import //depot/path master\n> \n> bombs out with missing .git/index\n> \n> 2)\n> $ p4 sync ...\n> $ git init\n> $ git add .\n> $ git commit\n> $ git-p4import --stitch //depot/path\n> \n> This imports all the comment history, but deletes all of my files!!\n> \n> 3)\n> $ p4 sync ...\n> $ git init\n> $ git add .\n> $ git commit\n> $ git-p4import //depot/path new\n> ### new branch with no files, but all my files in master\n> $ git checkout master\n> $ git merge new\n> ### Now I see it deleting all of my files, but it pulls in all of the history. \n> \n> \n> NOTE:  All of the commits pulled in have no file information associated with\n> them...\n> \n> \n> What am I missing?\n> \n> \n> Thanks\n> \n> --Kevin\n"},{"id":"44729","messageId":"200706111656.33696.simon@lst.de","threadId":"8508","inReplyTo":"20070611142525.GN25093@menevado.ms.com","subject":"Re: Asking again... [Re: how to properly import perforce history?]","fromName":"Simon Hausmann","fromEmail":"simon@lst.de","sentAt":"2007-06-11T14:56:33Z","receivedAt":"2007-06-11T14:56:33Z","isPatch":false,"sender":{"key":"hausmann@kde.org","avatar":"https://gravatar.com/avatar/bc9aad4fb31dce17eb66e690e7b51fe980c62da3c225c785da35dd806b8da778?d=mp&s=160"},"body":"On Monday 11 June 2007 16:25:25 Kevin Green wrote:\n> Reading this again, the subject was probably misleading...  Sorry for that.\n>\n> In the meantime I've been scouring the archives looking for the proper way\n> to import p4 history into a project.\n>\n> I'm attempting to use git-p4import.py as that's what came with my version\n> of git.  I ran into the problems below.\n>\n> How can I properly migrate a project from perforce to git?\n\n*plug* You could try with git-p4 from http://repo.or.cz/w/fast-export.git . It \nshould be just a matter of calling\n\n\tgit-p4 clone //depot/path\n\nor\n\n\tgit-p4 clone //depot/path@all\n\n(the former if you just want perforce #head, the latter if you want to import \nall revisions).\n\n\nSimon\n\n"},{"id":"44731","messageId":"81b0412b0706110844i12ebe52m21735815cc06effa@mail.gmail.com","threadId":"8508","inReplyTo":"200706111656.33696.simon@lst.de","subject":"Re: Asking again... [Re: how to properly import perforce history?]","fromName":"Alex Riesen","fromEmail":"raa.lkml@gmail.com","sentAt":"2007-06-11T15:44:04Z","receivedAt":"2007-06-11T15:44:04Z","isPatch":false,"sender":{"key":"raa.lkml@gmail.com","avatar":"https://avatars.githubusercontent.com/u/324101?v=4"},"body":"On 6/11/07, Simon Hausmann <simon@lst.de> wrote:\n>\n> *plug* You could try with git-p4 from http://repo.or.cz/w/fast-export.git . It\n> should be just a matter of calling\n>\n>         git-p4 clone //depot/path\n>\n\nCan I suggest you add a target directory mapping to your tool?\nSomething like:\n\n  git-p4 clone //depot/project/path [libs/project/path] [rev-range]\n\nThe way Perforce handles branches and directories leads to\nthe problem that it actually cannot cleanly support neither of\nthem, and it is very hard to untangle a big repo which\nhistorically has had many projects living in it.\nEspecially if some idiot actually tried to \"do branching\".\n\nAnd, BTW, don't you have a small problem with filenames with\nspaces and quoting?\n"},{"id":"44737","messageId":"20070611164127.GS25093@menevado.ms.com","threadId":"8508","inReplyTo":"200706111656.33696.simon@lst.de","subject":"Re: Asking again... [Re: how to properly import perforce history?]","fromName":"Kevin Green","fromEmail":"kevin.t.green@morganstanley.com","sentAt":"2007-06-11T16:41:27Z","receivedAt":"2007-06-11T16:41:27Z","isPatch":false,"sender":{"key":"kevin.t.green@morganstanley.com","avatar":null},"body":"On 06/11/07 10:56:33, Simon Hausmann wrote:\n> On Monday 11 June 2007 16:25:25 Kevin Green wrote:\n> > Reading this again, the subject was probably misleading...  Sorry for that.\n> >\n> > In the meantime I've been scouring the archives looking for the proper way\n> > to import p4 history into a project.\n> >\n> > I'm attempting to use git-p4import.py as that's what came with my version\n> > of git.  I ran into the problems below.\n> >\n> > How can I properly migrate a project from perforce to git?\n> \n> *plug* You could try with git-p4 from http://repo.or.cz/w/fast-export.git . It \n> should be just a matter of calling\n> \n> \tgit-p4 clone //depot/path\n> \n> or\n> \n> \tgit-p4 clone //depot/path@all\n> \n> (the former if you just want perforce #head, the latter if you want to import \n> all revisions).\n> \n\nThanks...  I'll try this today and post back on my experience.  From your\nusage example here, it seems to behave the way I thought git-p4import.py\nwould.\n\nIs git-p4import.py still used and maintained?  I submitted a patch to fix\nsomething trivial on Friday, but didn't here any response to that either,\nwhich led me to believe that it's not the tool being used most often for\np4->git migration...\n\n\n--Kevin\n"},{"id":"44739","messageId":"200706112042.16331.simon@lst.de","threadId":"8508","inReplyTo":"81b0412b0706110844i12ebe52m21735815cc06effa@mail.gmail.com","subject":"Re: Asking again... [Re: how to properly import perforce history?]","fromName":"Simon Hausmann","fromEmail":"simon@lst.de","sentAt":"2007-06-11T18:42:12Z","receivedAt":"2007-06-11T18:42:12Z","isPatch":false,"sender":{"key":"hausmann@kde.org","avatar":"https://gravatar.com/avatar/bc9aad4fb31dce17eb66e690e7b51fe980c62da3c225c785da35dd806b8da778?d=mp&s=160"},"body":"On Monday 11 June 2007 17:44:04 Alex Riesen wrote:\n> On 6/11/07, Simon Hausmann <simon@lst.de> wrote:\n> > *plug* You could try with git-p4 from http://repo.or.cz/w/fast-export.git\n> > . It should be just a matter of calling\n> >\n> >         git-p4 clone //depot/path\n>\n> Can I suggest you add a target directory mapping to your tool?\n> Something like:\n>\n>   git-p4 clone //depot/project/path [libs/project/path] [rev-range]\n\nI'm not sure I understand the libs/project/path part, but the revision range \ncan be specified in p4-like syntax as part of the depot path. For example\n\n\tgit-p4 clone //depot/path@12,435\n\nto import from revision 12 up to 435. The revision range is more or less \npassed directly to \"p4 changes\", with the exception of \"@all\".\n\nHan-Wen implemented also support for importing multiple depot paths at the \nsame time (and tracking them in one git branch).\n\n> The way Perforce handles branches and directories leads to\n> the problem that it actually cannot cleanly support neither of\n> them, and it is very hard to untangle a big repo which\n> historically has had many projects living in it.\n> Especially if some idiot actually tried to \"do branching\".\n\nI agree, even with a lot of discipline it's very hard to do a 100% accurate \nimport with logical branches.\n\nThe environment I'm working in is not too big and fairly liberal and \nreasonably disciplined. I'm using p4 branch mappings to \"map\" some branches \nfrom perforce to git, which for sure isn't perfect but works overall fine. Of \ncourse that doesn't cover p4 integration changes, but just for tracking \nmultiple \"logical\" p4 branches it works great (for me at least :).\n\n> And, BTW, don't you have a small problem with filenames with\n> spaces and quoting?\n\nI'm not aware of any problems. For example in our depot we have filenames with \nspaces in them and they appear just fine in my git import. Did you run into \nany specific case? It could very well be that there's a bug somewhere that \nI'm just not hitting myself, so I'm curious :)\n\n\nSimon\n"},{"id":"44754","messageId":"20070611201232.GA4649@steel.home","threadId":"8508","inReplyTo":"200706112042.16331.simon@lst.de","subject":"Re: Asking again... [Re: how to properly import perforce history?]","fromName":"Alex Riesen","fromEmail":"raa.lkml@gmail.com","sentAt":"2007-06-11T20:12:32Z","receivedAt":"2007-06-11T20:12:32Z","isPatch":false,"sender":{"key":"raa.lkml@gmail.com","avatar":"https://avatars.githubusercontent.com/u/324101?v=4"},"body":"Simon Hausmann, Mon, Jun 11, 2007 20:42:12 +0200:\n> On Monday 11 June 2007 17:44:04 Alex Riesen wrote:\n> > On 6/11/07, Simon Hausmann <simon@lst.de> wrote:\n> > > *plug* You could try with git-p4 from http://repo.or.cz/w/fast-export.git\n> > > . It should be just a matter of calling\n> > >\n> > >         git-p4 clone //depot/path\n> >\n> > Can I suggest you add a target directory mapping to your tool?\n> > Something like:\n> >\n> >   git-p4 clone //depot/project/path [libs/project/path] [rev-range]\n> \n> I'm not sure I understand the libs/project/path part, ...\n\nYour client contains the mappings. It defines how the pathnames on the\np4 server relate to that on your computer. In the example above file\nfrom the depot path //depot/project/path can be found in the directory\nof the p4 client in the subdirectories libs/project/path.\n\n> Han-Wen implemented also support for importing multiple depot paths at the \n> same time (and tracking them in one git branch).\n\nAnd where does he put the depot paths? As they are in depot? How does\nthis corelate to the setups done by genuine P4 users (the poor souls)\nwhere the mappings are not always 1-to-1 right from the root? Or you\nhaven't got any?\n\n> The environment I'm working in is not too big and fairly liberal and \n> reasonably disciplined.\n\nYou must be very strange environment indeed. Carefully balanced.\n\n> > And, BTW, don't you have a small problem with filenames with\n> > spaces and quoting?\n> \n> I'm not aware of any problems. For example in our depot we have filenames with \n> spaces in them and they appear just fine in my git import. Did you run into \n> any specific case? It could very well be that there's a bug somewhere that \n> I'm just not hitting myself, so I'm curious :)\n\nNo, I just looking at the source. Does python have some magic for\nrunning programs with system() when passed a format string? Like here:\n\n        for f in filesToAdd:\n            system(\"p4 add %s\" % f)\n        for f in filesToDelete:\n            system(\"p4 revert %s\" % f)\n            system(\"p4 delete %s\" % f)\n\nBTW, sometimes you quote the names, but obviously wrong (think about\nfilenames containing double quotes):\n\n                system(\"p4 edit \\\"%s\\\"\" % path)\n                editedFiles.add(path)\n"},{"id":"44756","messageId":"20070611202810.GB4649@steel.home","threadId":"8508","inReplyTo":"20070611164127.GS25093@menevado.ms.com","subject":"Re: Asking again... [Re: how to properly import perforce history?]","fromName":"Alex Riesen","fromEmail":"raa.lkml@gmail.com","sentAt":"2007-06-11T20:28:10Z","receivedAt":"2007-06-11T20:28:10Z","isPatch":false,"sender":{"key":"raa.lkml@gmail.com","avatar":"https://avatars.githubusercontent.com/u/324101?v=4"},"body":"Kevin Green, Mon, Jun 11, 2007 18:41:27 +0200:\n> Is git-p4import.py still used and maintained?\n\nNot really: there is only 5 changes which touch the file and only two\nof them have something to do with the import.\n\n> I submitted a patch to fix something trivial on Friday, but didn't\n> here any response to that either, which led me to believe that it's\n> not the tool being used most often for p4->git migration...\n\nThat's not the tool. It is the migration from p4 to anything which\ndoes not happen too often: this company did very good job tying the\ncustomers to this product. Once you reached some critical mass in\nyour perforce repo you cannot simply stop using it and go with\nsomething else. Not without much pain, anyway.\n\nGetting the development history out of it is the hardest. I'd say it\nis impossible, as the states of development directories, unloaded in\n\"clients\", are fluid and not recoverable after they are changed.\nImagine git with just index and no object database support.\n"},{"id":"44757","messageId":"20070611205140.GN25093@menevado.ms.com","threadId":"8508","inReplyTo":"200706112159.34181.simon@lst.de","subject":"[PATCH] git-p4: check for existence of repo dir before trying to create [Was: Asking again... [Re: how to properly import perforce history?]]","fromName":"Kevin Green","fromEmail":"kevin.t.green@morganstanley.com","sentAt":"2007-06-11T20:51:40Z","receivedAt":"2007-06-11T20:51:40Z","isPatch":true,"sender":{"key":"kevin.t.green@morganstanley.com","avatar":null},"body":"On 06/11/07 15:59:30, Simon Hausmann wrote:\n> On Monday 11 June 2007 21:44:50 you wrote:\n> > On 06/11/07 10:56:33, Simon Hausmann wrote:\n> > > *plug* You could try with git-p4 from http://repo.or.cz/w/fast-export.git\n> > > . It should be just a matter of calling\n> >\n> > hmmm....  Failed with this:\n> >\n> > $ git clone http://repo.or.cz/w/fast-export.git\n> > Initialized empty Git repository in /var/tmp/kgreen/dev/fast-export/.git/\n> > /ms/dist/fsf/PROJ/git/1.5.2.1/bin/git-clone: line 381: cd:\n> > /var/tmp/kgreen/dev/fast-export/.git/refs/remotes/origin: No such file or\n> > directory\n> > fatal: Not a valid object name HEAD\n> >\n> > I then tried the mirror I found at the git revision history site:\n> >\n> > $ git clone http://repo.or.cz/r/fast-export.git\n> > Initialized empty Git repository in /var/tmp/kgreen/dev/fast-export/.git/\n> > Getting alternates list for http://repo.or.cz/r/fast-export.git\n> > Getting pack list for http://repo.or.cz/r/fast-export.git\n> > Getting index for pack 66d95396fcacd053b385a4ed71edb2b1bc15e074\n> > ...\n> >\n> >\n> > Don't know if they're the same, but I'll give it a shot now...\n> \n> The latter seems indeed like the right URL for a HTTP based clone off of \n> repo.or.cz. I would recommend using the git protocol though if possible :)\n> \n\nNot possible unfortunately...\n\nAnyway, grabbed git-p4 and tried it three ways:\n\n1) git-p4 clone //depot/path/repo@all\n\n  I don't like this because it creates a git repository under \"repo\" subdir.\n  To make a long store short, we have a very strict namespace for\n  development...  The path ends in src and I'd like the .git repository to be\n  under src.  \n\nSo, I tried this one level up:\n\n2) git-p4 clone //depot/path/repo@all src\n\n\tBut that dies with a mkdir error because 'src' already exists.  I want to\n\tsubmit a patch, but wanted to check with you first to see if that's the\n\tdesired behaviour (I don't think it should fail though) because maybe you\n\twant to stop someone from scribbling on an already present git repository?\n\n\tI would want to just go for a \"if it doesn't exist yet, create it,\n\totherwise, forge ahead\" behaviour.  I attach the patch after my .sig...\n\n3) Tried without clone:\n\n$ git init\n$ git-p4 sync //depot/path/repo@all\n\n\tThis looks like it's pulling down all the revisions, but it doesn't\n\tactually put any code in there.  I'm left with the same situation as\n\tgit-p4import.py.\n\t\n\tActually, not even.  I don't even have the commit history...\n\n\nI would like to get 3 working properly because it's clunky to do #2.  But with\nthe patch, #2 does what I want and gets me started...\n\nPatch attached.  Please let me know what I'm doing wrong with #3 above...\n\n\nThanks\n\n--Kevin\n\n\n>From c14f906b255a310db0c674ce567fd776aad8f397 Mon Sep 17 00:00:00 2001\nFrom: Kevin Green <Kevin.Green@morganstanley.com>\nDate: Mon, 11 Jun 2007 16:48:07 -0400\nSubject: [PATCH] git-p4: check for existence of repo dir before trying to create\n\nWhen using git-p4 in this manner:\n\ngit-p4 clone //depot/path/project myproject\n\nIf \"myproject\" already exists as a dir, but not a valid git repo, it fails\nto create the directory.\n\nSigned-off-by: Kevin Green <Kevin.Green@morganstanley.com>\n---\n git-p4 |    3 ++-\n 1 files changed, 2 insertions(+), 1 deletions(-)\n\ndiff --git a/git-p4 b/git-p4\nindex e380c14..cababc7 100755\n--- a/git-p4\n+++ b/git-p4\n@@ -1400,7 +1400,8 @@ class P4Clone(P4Sync):\n             self.cloneDestination = self.defaultDestination(args)\n\n         print \"Importing from %s into %s\" % (', '.join(depotPaths), self.cloneDestination)\n-        os.makedirs(self.cloneDestination)\n+        if not os.path.exists(self.cloneDestination):\n+            os.makedirs(self.cloneDestination)\n         os.chdir(self.cloneDestination)\n         system(\"git init\")\n         self.gitdir = os.getcwd() + \"/.git\"\n--\n1.5.2.1\n"},{"id":"44759","messageId":"466DBCAB.8090006@slamb.org","threadId":"8508","inReplyTo":"20070611201232.GA4649@steel.home","subject":"Re: Asking again... [Re: how to properly import perforce history?]","fromName":"Scott Lamb","fromEmail":"slamb@slamb.org","sentAt":"2007-06-11T21:20:43Z","receivedAt":"2007-06-11T21:20:43Z","isPatch":false,"sender":{"key":"slamb@slamb.org","avatar":null},"body":"Alex Riesen wrote:\n> Simon Hausmann, Mon, Jun 11, 2007 20:42:12 +0200:\n>> On Monday 11 June 2007 17:44:04 Alex Riesen wrote:\n>>> On 6/11/07, Simon Hausmann <simon@lst.de> wrote:\n>>>> *plug* You could try with git-p4 from http://repo.or.cz/w/fast-export.git\n>>>> . It should be just a matter of calling\n>>>>\n>>>>         git-p4 clone //depot/path\n>>> Can I suggest you add a target directory mapping to your tool?\n>>> Something like:\n>>>\n>>>   git-p4 clone //depot/project/path [libs/project/path] [rev-range]\n>> I'm not sure I understand the libs/project/path part, ...\n> \n> Your client contains the mappings. It defines how the pathnames on the\n> p4 server relate to that on your computer. In the example above file\n> from the depot path //depot/project/path can be found in the directory\n> of the p4 client in the subdirectories libs/project/path.\n\ngit-p4 doesn't even use a p4 client, so the result is simply as it was \non the server. It just does a \"p4 print\" on depot paths.\n\n>> Han-Wen implemented also support for importing multiple depot paths at the \n>> same time (and tracking them in one git branch).\n> \n> And where does he put the depot paths? As they are in depot? How does\n> this corelate to the setups done by genuine P4 users (the poor souls)\n> where the mappings are not always 1-to-1 right from the root? Or you\n> haven't got any?\n\nCould you give a concrete example of what you have and what you are \ntrying to produce?\n\n> \n>> The environment I'm working in is not too big and fairly liberal and \n>> reasonably disciplined.\n> \n> You must be very strange environment indeed. Carefully balanced.\n\nNot that strange. My company's setup is pretty simple, too. The project \nI'm working on just uses has each branch under \n\"//depot/project/BRANCH/...\". Maybe your environment is the odd one?\n\n>>> And, BTW, don't you have a small problem with filenames with\n>>> spaces and quoting?\n>> I'm not aware of any problems. For example in our depot we have filenames with \n>> spaces in them and they appear just fine in my git import. Did you run into \n>> any specific case? It could very well be that there's a bug somewhere that \n>> I'm just not hitting myself, so I'm curious :)\n> \n> No, I just looking at the source. Does python have some magic for\n> running programs with system() when passed a format string? Like here:\n> \n>         for f in filesToAdd:\n>             system(\"p4 add %s\" % f)\n>         for f in filesToDelete:\n>             system(\"p4 revert %s\" % f)\n>             system(\"p4 delete %s\" % f)\n> \n> BTW, sometimes you quote the names, but obviously wrong (think about\n> filenames containing double quotes):\n> \n>                 system(\"p4 edit \\\"%s\\\"\" % path)\n>                 editedFiles.add(path)\n\nNo, there's no magic. I can't imagine how these could work properly with \ncomplex filenames. They also don't do any checking of return values. I'm \nplanning on sending in patches to make git-p4 use the Python subprocess \nmodule to do this better (as I did for git-p4import.py). It might take \nme a while to get to that item on my todo list, though - rather busy at \nwork right now.\n\n-- \nScott Lamb <http://www.slamb.org/>\n"},{"id":"44760","messageId":"200706112332.46996.simon@lst.de","threadId":"8508","inReplyTo":"20070611205140.GN25093@menevado.ms.com","subject":"Re: [PATCH] git-p4: check for existence of repo dir before trying to create [Was: Asking again... [Re: how to properly import perforce history?]]","fromName":"Simon Hausmann","fromEmail":"simon@lst.de","sentAt":"2007-06-11T21:32:43Z","receivedAt":"2007-06-11T21:32:43Z","isPatch":true,"sender":{"key":"hausmann@kde.org","avatar":"https://gravatar.com/avatar/bc9aad4fb31dce17eb66e690e7b51fe980c62da3c225c785da35dd806b8da778?d=mp&s=160"},"body":"On Monday 11 June 2007 22:51:40 Kevin Green wrote:\n[...]\n> Anyway, grabbed git-p4 and tried it three ways:\n>\n> 1) git-p4 clone //depot/path/repo@all\n>\n>   I don't like this because it creates a git repository under \"repo\"\n> subdir. To make a long store short, we have a very strict namespace for\n>   development...  The path ends in src and I'd like the .git repository to\n> be under src.\n\nFair enough :)\n\n> So, I tried this one level up:\n>\n> 2) git-p4 clone //depot/path/repo@all src\n>\n> \tBut that dies with a mkdir error because 'src' already exists.  I want to\n> \tsubmit a patch, but wanted to check with you first to see if that's the\n> \tdesired behaviour (I don't think it should fail though) because maybe you\n> \twant to stop someone from scribbling on an already present git repository?\n>\n> \tI would want to just go for a \"if it doesn't exist yet, create it,\n> \totherwise, forge ahead\" behaviour.  I attach the patch after my .sig...\n\nThanks for the patch. Applied and pushed out.\n\n> 3) Tried without clone:\n>\n> $ git init\n> $ git-p4 sync //depot/path/repo@all\n>\n> \tThis looks like it's pulling down all the revisions, but it doesn't\n> \tactually put any code in there.  I'm left with the same situation as\n> \tgit-p4import.py.\n>\n> \tActually, not even.  I don't even have the commit history...\n\nActually... the import worked just fine, but I admit that it is not obvious \n_where_ the import went. I've just pushed out a change that makes git-p4 sync \nin this case also print out the ref. By default git-p4 sync imports into \nrefs/remotes/p4/master, so after the above command a simple\n\n\tgit branch -r\n\nshould print\n\n\tp4/HEAD\n\tp4/master\n\nso you could for example just create a new master branch based on your p4 \nimport using\n\n\tgit branch master p4\n\tgit checkout master\n\nI hope this helps :)\n\nSimon\n"},{"id":"44763","messageId":"200706112346.13628.simon@lst.de","threadId":"8508","inReplyTo":"20070611201232.GA4649@steel.home","subject":"Re: Asking again... [Re: how to properly import perforce history?]","fromName":"Simon Hausmann","fromEmail":"simon@lst.de","sentAt":"2007-06-11T21:46:10Z","receivedAt":"2007-06-11T21:46:10Z","isPatch":false,"sender":{"key":"hausmann@kde.org","avatar":"https://gravatar.com/avatar/bc9aad4fb31dce17eb66e690e7b51fe980c62da3c225c785da35dd806b8da778?d=mp&s=160"},"body":"On Monday 11 June 2007 22:12:32 Alex Riesen wrote:\n[...]\n> > > And, BTW, don't you have a small problem with filenames with\n> > > spaces and quoting?\n> >\n> > I'm not aware of any problems. For example in our depot we have filenames\n> > with spaces in them and they appear just fine in my git import. Did you\n> > run into any specific case? It could very well be that there's a bug\n> > somewhere that I'm just not hitting myself, so I'm curious :)\n>\n> No, I just looking at the source. Does python have some magic for\n> running programs with system() when passed a format string? Like here:\n>\n>         for f in filesToAdd:\n>             system(\"p4 add %s\" % f)\n>         for f in filesToDelete:\n>             system(\"p4 revert %s\" % f)\n>             system(\"p4 delete %s\" % f)\n\nOoops, indeed. Makes me realizes that I've never actually submitted files with \nspaces in the name :). For now I've quoted them with double quotes like in \nthe other places, which is better than nothing. Thanks for spotting!\n\n> BTW, sometimes you quote the names, but obviously wrong (think about\n> filenames containing double quotes):\n>\n>                 system(\"p4 edit \\\"%s\\\"\" % path)\n>                 editedFiles.add(path)\n\nIndeed, for file names with double quotes that doesn't work. I guess I'll have \nto change that to subprocess.Popen then :)\n\nSimon\n"},{"id":"44772","messageId":"20070611231648.GC4649@steel.home","threadId":"8508","inReplyTo":"466DBCAB.8090006@slamb.org","subject":"Re: Asking again... [Re: how to properly import perforce history?]","fromName":"Alex Riesen","fromEmail":"raa.lkml@gmail.com","sentAt":"2007-06-11T23:16:48Z","receivedAt":"2007-06-11T23:16:48Z","isPatch":false,"sender":{"key":"raa.lkml@gmail.com","avatar":"https://avatars.githubusercontent.com/u/324101?v=4"},"body":"Scott Lamb, Mon, Jun 11, 2007 23:20:43 +0200:\n> >>>  git-p4 clone //depot/project/path [libs/project/path] [rev-range]\n> >>\n> >>I'm not sure I understand the libs/project/path part, ...\n> >\n> >Your client contains the mappings. It defines how the pathnames on the\n> >p4 server relate to that on your computer. In the example above file\n> >from the depot path //depot/project/path can be found in the directory\n> >of the p4 client in the subdirectories libs/project/path.\n> \n> git-p4 doesn't even use a p4 client, ...\n\nI didn't say: \"using p4 client, figure out where to put the files\".\nI said: _here_ is the mapping, put the files where I told you to.\n\n> >>Han-Wen implemented also support for importing multiple depot paths at \n> >>the same time (and tracking them in one git branch).\n> >\n> >And where does he put the depot paths? As they are in depot? How does\n> >this corelate to the setups done by genuine P4 users (the poor souls)\n> >where the mappings are not always 1-to-1 right from the root? Or you\n> >haven't got any?\n> \n> Could you give a concrete example of what you have and what you are \n> trying to produce?\n\nGet the p4 file //depot/project/file and put it into git as\nlibs/project/file.\n\n> >>The environment I'm working in is not too big and fairly liberal and \n> >>reasonably disciplined.\n> >\n> >You must be very strange environment indeed. Carefully balanced.\n> \n> Not that strange. My company's setup is pretty simple, too. The project \n> I'm working on just uses has each branch under \n> \"//depot/project/BRANCH/...\".\n\nIt is not a branch (as a \"line of development\"). It is merely a\ndirectory with server-side backup. Why do people continue call them\nbranches, I wonder...\n\n> Maybe your environment is the odd one?\n\nJust what do you think is a client view? Ever wondered what the\nright-hand side of lines in the \"View:\" section is for?\n"},{"id":"44774","messageId":"466DDDBA.6060500@slamb.org","threadId":"8508","inReplyTo":"20070611231648.GC4649@steel.home","subject":"Re: Asking again... [Re: how to properly import perforce history?]","fromName":"Scott Lamb","fromEmail":"slamb@slamb.org","sentAt":"2007-06-11T23:41:46Z","receivedAt":"2007-06-11T23:41:46Z","isPatch":false,"sender":{"key":"slamb@slamb.org","avatar":null},"body":"Alex Riesen wrote:\n> Scott Lamb, Mon, Jun 11, 2007 23:20:43 +0200:\n>>>>>  git-p4 clone //depot/project/path [libs/project/path] [rev-range]\n>>>> I'm not sure I understand the libs/project/path part, ...\n>>> Your client contains the mappings. It defines how the pathnames on the\n>>> p4 server relate to that on your computer. In the example above file\n>> >from the depot path //depot/project/path can be found in the directory\n>>> of the p4 client in the subdirectories libs/project/path.\n>> git-p4 doesn't even use a p4 client, ...\n> \n> I didn't say: \"using p4 client, figure out where to put the files\".\n> I said: _here_ is the mapping, put the files where I told you to.\n\nNo, you didn't say. The words you used would make equal sense with \"the \ntool should look for //depot/project/path in the working copy at \nlibs/project/path\".\n\n>>>> Han-Wen implemented also support for importing multiple depot paths at \n>>>> the same time (and tracking them in one git branch).\n>>> And where does he put the depot paths? As they are in depot? How does\n>>> this corelate to the setups done by genuine P4 users (the poor souls)\n>>> where the mappings are not always 1-to-1 right from the root? Or you\n>>> haven't got any?\n>> Could you give a concrete example of what you have and what you are \n>> trying to produce?\n> \n> Get the p4 file //depot/project/file and put it into git as\n> libs/project/file.\n\nOkay. Keep in mind that you're the first person to find this important.\n\n> \n>>>> The environment I'm working in is not too big and fairly liberal and \n>>>> reasonably disciplined.\n>>> You must be very strange environment indeed. Carefully balanced.\n>> Not that strange. My company's setup is pretty simple, too. The project \n>> I'm working on just uses has each branch under \n>> \"//depot/project/BRANCH/...\".\n> \n> It is not a branch (as a \"line of development\"). It is merely a\n> directory with server-side backup. Why do people continue call them\n> branches, I wonder...\n\nYou're being deliberately dense, but I'll explain anyway.\n\nWe have several branches of our code. We keep each one in Perforce under \n//depot/project/BRANCH/... with appropriate integration history between. \nWe follow the best practices outlined in the Perforce manual. [1] We use \nthe same terminology as defined in the Perforce manual.\n\n From your comments, I would guess that you have badly mismanaged your \nPerforce tree. Since the other people working on the tool apparently \nhave not, you may have to do your own work to migrate away.\n\nSubversion has a very similar model to Perforce (the main differences \nbeing that svn does not track merge history and does not have a separate \ntag system). I have a Subversion repository in which I did not follow \nthe recommended practices for branching. Who do I blame for that? Me. \nWho will fix it? Hopefully me. I may ask for help, but I'll do so with a \nbetter attitude than you.\n\n>> Maybe your environment is the odd one?\n> \n> Just what do you think is a client view? Ever wondered what the\n> right-hand side of lines in the \"View:\" section is for?\n\nI know what client views are, and I know what they are capable of. I can \nsay the same thing about symlinks. Is an importer tool broken if it does \nnot follow a bizarre reorganization of the source working copy through \nsymlinks?\n\n[1] - \nhttp://www.perforce.com/perforce/doc.072/manuals/p4guide/06_codemgmt.html#1065698\n\n-- \nScott Lamb <http://www.slamb.org/>\n"},{"id":"44781","messageId":"466DF489.7010700@xs4all.nl","threadId":"8508","inReplyTo":"200706112346.13628.simon@lst.de","subject":"Re: Asking again... [Re: how to properly import perforce history?]","fromName":"Han-Wen Nienhuys","fromEmail":"hanwen@xs4all.nl","sentAt":"2007-06-12T01:19:05Z","receivedAt":"2007-06-12T01:19:05Z","isPatch":false,"sender":{"key":"hanwen@google.com","avatar":"https://avatars.githubusercontent.com/u/31547?v=4"},"body":"Simon Hausmann escreveu:\n>>             system(\"p4 revert %s\" % f)\n>>             system(\"p4 delete %s\" % f)\n> \n> Ooops, indeed. Makes me realizes that I've never actually submitted files with \n> spaces in the name :). For now I've quoted them with double quotes like in \n> the other places, which is better than nothing. Thanks for spotting!\n\n>>> import commands\n>>> commands.mkarg ('$foo bar')\n\" '$foo bar'\"\n\n\n-- \n Han-Wen Nienhuys - hanwen@xs4all.nl - http://www.xs4all.nl/~hanwen\n"},{"id":"44837","messageId":"81b0412b0706120712hc72680bjdf26fa7ded08f0c7@mail.gmail.com","threadId":"8508","inReplyTo":"200706112346.13628.simon@lst.de","subject":"Re: Asking again... [Re: how to properly import perforce history?]","fromName":"Alex Riesen","fromEmail":"raa.lkml@gmail.com","sentAt":"2007-06-12T14:12:35Z","receivedAt":"2007-06-12T14:12:35Z","isPatch":false,"sender":{"key":"raa.lkml@gmail.com","avatar":"https://avatars.githubusercontent.com/u/324101?v=4"},"body":"On 6/11/07, Simon Hausmann <simon@lst.de> wrote:\n> Ooops, indeed. Makes me realizes that I've never actually submitted files with\n> spaces in the name :). For now I've quoted them with double quotes like in\n> the other places, which is better than nothing. Thanks for spotting!\n\nRunning 'p4 print' the code also does not check for code \"error\",\nand there may be other places which have to check for errors.\n\nBTW, I have never seen code \"text\". It is always \"binary\" for file data,\nfor text files the type in code-stat element is just set to \"text\".\n"}]}