P4 break

Friday, January 27, 2012 3 Comments

Are you confined in perforce? Do you want to escape from it?

Materials

We need some tools to success in our adventure!

  1. Python 2.7 (http://www.python.org/getit/releases/2.7/)
  2. P4PythonLib 2010.1 for Python 2.7 (http://public.perforce.com:8080/guest/sven_erik_knop/P4Pythonlib/bin/?ac=83)
  3. Bzr Standalone (http://launchpad.net/bzr/2.4/2.4.2/+download/bzr-2.4.2-1-setup.exe)
  4. Bzr Python Based (http://launchpad.net/bzr/2.4/2.4.2/+download/bzr-2.4.2-1.win32-py2.7.exe)
  5. Git for windows (http://msysgit.googlecode.com/files/Git-1.7.8-preview20111206.exe)
  6. P4-fast-export.py (bzrp4)(http://dl.dropbox.com/u/2974293/trunk.rar)
  7. I assume you have the P4 client and server.

Dangers

It’s not going to be a Boy Scout trip… some brave people failed.

  1. If the Bzr and P4PythonLib is not able to find the Python installation directory please review the following link: (http://selfsolved.com/problems/setuptools-06c11-fails-to-instal/s/63)
  2. If the p4-fast-export.py fails regarding a Git error you have to follow this:(http://stackoverflow.com/questions/5299122/unable-to-import-with-git-p4-on-windows)
The plan

  1. Install all the materials, just install it, you don’t need to open or configure anything.
  2. Place the http://dl.dropbox.com/u/2974293/trunk.rar content inside a directory called “bzrp4” under the "C:\Program Files\Bazaar\plugins" directory, the path to the python migration file should be like this: “C:\Program Files\Bazaar\plugins\bzrp4\p4-fast-export.py”.
  3. Customize the “setup_env.bat” parameters with your environment info, adapt the Git path, P4PORT, and the Perforce server Path. Finally run it.
  4. Open a command line window and run: “python p4-fast-export.py //my/repo/path@all > p4fe.dat”. If you are strong enough you can review the command help. Make sure you are using the Python 2.7 executable.
  5. Create a temporal directory, change your command line directory to it and perform the following: “git init .” “type p4fe.dat | git fast-import” and then “git fast-export --all --tag-of-filtered-object=drop --signed-tags=strip > gitFe.dat”
  6. The last step is “cm fast-import p4ImportedRep gitFe.dat”

If all works fine you will have your repository inside PlasticSCM!!!

Survivors?


3 comments:

  1. What's the point of the step5 in the plan section? Does bzr produce wrong fast-export stream for you?

    ReplyDelete
  2. You hit the nail right on the head!
    The bzr fast-export is using the "inline" format.

    We will work for support this format and avoid the Git step.

    ReplyDelete
  3. For me ussing latest fast-import from git repository worked fine, so no bazar needed.
    Also incremental git import works nice.

    ReplyDelete