git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Simon Hausmann <simon@lst.de>
To: git@vger.kernel.org
Subject: Yet another git perforce integration
Date: Tue, 8 May 2007 10:23:38 +0200	[thread overview]
Message-ID: <200705081023.38810.simon@lst.de> (raw)

[-- Attachment #1: Type: text/plain, Size: 2430 bytes --]

Hi,

Integrations of Git with Perforce seem to be fashion these days, so I'd like 
to chip in and announce another one :)

I've written a Python script called git-p4 that allows (incremental) imports 
from Perforce as well as submitting changes back from git into a Perforce 
depot.

It is currently part of the fast-export repository that Chris Lee started at

        http://repo.or.cz/w/fast-export.git

I've been using it now for about a month for my everyday work (which requires 
Perforce), so it seems to work reasonably stable at least in my setup :)

The usage is pretty simple:

        git-p4 clone //depot/path/my/project

Syncing:

        git-p4 sync

or just

        git-p4 rebase

to sync and automatically rebase into the current branch (much like git-svn 
rebase :)

        git-p4 submit

is used to submit changes back into Perforce (use at your own risk! :)

The import itself uses git-fast-import, so it's very fast. There is also no 
need to have the imported Perforce projects in the Perforce client view as it 
just uses "p4 changes //depot/path" and "p4 
print //depot/path/file#revision", which I find very convenient and still 
fast enough for use (since of course only changed files are printed).

It also doesn't require any additional meta-data. Instead every import commit 
has a line added to the log message that contains the Perforce path the 
changeset comes from as well as the change number. git-p4 
sync/rebase "parses" this on the last commit in the "p4" git branch to find 
out where to continue importing for incremental imports.


What's still missing is a bit of cleanup. For example I'd like to put the 
import branch into refs/remotes instead of refs/heads, but I've had some 
problems with fast-import when trying that. Also the support for Perforce 
branches isn't quite working yet. I'd ideally like to for example map a 
structure like

//depot/project/main
//depot/project/branch1
//depot/project/branch2

into

remotes/p4/main
remotes/p4/branch1
remotes/p4/branch2

in git and still support incremental commits. But that isn't working yet ;(

Also I've never tried it on Windows and I expect problems as the script uses 
pipes, calls "patch", etc.

Nevertheless I hope that this tool may be interesting for others as well.
Maybe there's a possibility of including it in git/contrib/fast-import?


Simon

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

             reply	other threads:[~2007-05-08  8:23 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-05-08  8:23 Simon Hausmann [this message]
2007-05-08  9:47 ` Yet another git perforce integration Alex Riesen
2007-05-08 10:49   ` Simon Hausmann
2007-05-08 12:32     ` Alex Riesen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200705081023.38810.simon@lst.de \
    --to=simon@lst.de \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).