git-p4import --stitch <//p4repo/path>
git-p4import
Once the initial import is complete you can do an incremental import of new commits from the Perforce repository. You do this by checking out the appropriate git branch and then running git-p4import without any options.
The standard p4 client is used to communicate with the Perforce repository; it must be configured correctly in order for git-p4import to operate (see below).
You must also configure a p4 client "view" which maps the Perforce branch into the top level of your git repository, for example:
Client: myhost
Root: /home/sean/import
Options: noallwrite clobber nocompress unlocked modtime rmdir
View:
//public/jam/... //myhost/jam/...
With the above p4 client setup, you could import the "jam" perforce
branch into a branch named "jammy", like so:
$ mkdir -p /home/sean/import/jam $ cd /home/sean/import/jam $ git init-db $ git p4import //public/jam jammy
View:
//public/jam/... //myhost/jam/...
//public/other/... //myhost/jam/...
//public/guest/... //myhost/jam/...
If you want more than one Perforce branch to be imported into the
same directory you must employ a workaround. A simple option is to
adjust your p4 client before each import to only include a single
view.
Another option is to create multiple symlinks locally which all point to the same directory in your git repository and then use one per "view" instead of listing the actual directory.
The tag associated with the HEAD commit is also how git-p4import determines if there are new changes to incrementally import from the Perforce repository.
If you import from a repository with many thousands of changes you will have an equal number of p4/xxxx git tags. Git tags can be expensive in terms of disk space and repository operations. If you don't need to perform further incremental imports, you may delete the tags.
Author information is automatically determined by querying the Perforce "users" table using the id associated with each change. However, if you want to manually supply these mappings you can do so with the "--authors" option. It accepts a file containing a list of mappings with each line containing one mapping in the format:
perforce_id = Full Name <AUTHOR
Written by Sean Estabrooks <seanlkml@sympatico.ca>
GIT
Part of the (7) suite