Documentation / git-p4import.txton commit Merge branch 'master' into next (ada5853)
   1git-p4import(1)
   2===============
   3
   4NAME
   5----
   6git-p4import - Import a Perforce repository into git
   7
   8
   9SYNOPSIS
  10--------
  11`git-p4import` [-q|-v] [--authors <file>] [-t <timezone>] <//p4repo/path> <branch>
  12
  13`git-p4import` --stitch <//p4repo/path>
  14
  15`git-p4import`
  16
  17
  18DESCRIPTION
  19-----------
  20Import a Perforce repository into an existing git repository.  When
  21a <//p4repo/path> and <branch> are specified a new branch with the
  22given name will be created and the initial import will begin.
  23
  24Once the initial import is complete you can do an incremental import
  25of new commits from the Perforce repository.  You do this by checking
  26out the appropriate git branch and then running `git-p4import` without
  27any options.
  28
  29The standard p4 client is used to communicate with the Perforce
  30repository; it must be configured correctly in order for `git-p4import`
  31to operate (see below).
  32
  33
  34OPTIONS
  35-------
  36-q::
  37        Do not display any progress information.
  38
  39-v::
  40        Give extra progress information.
  41
  42\--authors::
  43        Specify an authors file containing a mapping of Perforce user
  44        ids to full names and email addresses (see Notes below).
  45
  46\--stitch::
  47        Import the contents of the given perforce branch into the
  48        currently checked out git branch.
  49
  50\--log::
  51        Store debugging information in the specified file.
  52
  53-t::
  54        Specify that the remote repository is in the specified timezone.
  55        Timezone must be in the format "US/Pacific" or "Europe/London"
  56        etc.  You only need to specify this once, it will be saved in
  57        the git config file for the repository.
  58
  59<//p4repo/path>::
  60        The Perforce path that will be imported into the specified branch.
  61
  62<branch>::
  63        The new branch that will be created to hold the Perforce imports.
  64
  65
  66P4 Client
  67---------
  68You must make the `p4` client command available in your $PATH and
  69configure it to communicate with the target Perforce repository.
  70Typically this means you must set the "$P4PORT" and "$P4CLIENT"
  71environment variables.
  72
  73You must also configure a `p4` client "view" which maps the Perforce
  74branch into the top level of your git repository, for example:
  75
  76------------
  77Client: myhost
  78
  79Root:   /home/sean/import
  80
  81Options:   noallwrite clobber nocompress unlocked modtime rmdir
  82
  83View:
  84        //public/jam/... //myhost/jam/...
  85------------
  86
  87With the above `p4` client setup, you could import the "jam"
  88perforce branch into a branch named "jammy", like so:
  89
  90------------
  91$ mkdir -p /home/sean/import/jam
  92$ cd /home/sean/import/jam
  93$ git init-db
  94$ git p4import //public/jam jammy
  95------------
  96
  97
  98Multiple Branches
  99-----------------
 100Note that by creating multiple "views" you can use `git-p4import`
 101to import additional branches into the same git repository.
 102However, the `p4` client has a limitation in that it silently
 103ignores all but the last "view" that maps into the same local
 104directory.  So the following will *not* work:
 105
 106------------
 107View:
 108        //public/jam/... //myhost/jam/...
 109        //public/other/... //myhost/jam/...
 110        //public/guest/... //myhost/jam/...
 111------------
 112
 113If you want more than one Perforce branch to be imported into the
 114same directory you must employ a workaround.  A simple option is
 115to adjust your `p4` client before each import to only include a
 116single view.
 117
 118Another option is to create multiple symlinks locally which all
 119point to the same directory in your git repository and then use
 120one per "view" instead of listing the actual directory.
 121
 122
 123Tags
 124----
 125A git tag of the form p4/xx is created for every change imported from
 126the Perforce repository where xx is the Perforce changeset number.
 127Therefore after the import you can use git to access any commit by its
 128Perforce number, eg. git show p4/327.
 129
 130The tag associated with the HEAD commit is also how `git-p4import`
 131determines if there are new changes to incrementally import from the
 132Perforce repository.
 133
 134If you import from a repository with many thousands of changes
 135you will have an equal number of p4/xxxx git tags.  Git tags can
 136be expensive in terms of disk space and repository operations.
 137If you don't need to perform further incremental imports, you
 138may delete the tags.
 139
 140
 141Notes
 142-----
 143You can interrupt the import (eg. ctrl-c) at any time and restart it
 144without worry.
 145
 146Author information is automatically determined by querying the
 147Perforce "users" table using the id associated with each change.
 148However, if you want to manually supply these mappings you can do
 149so with the "--authors" option.  It accepts a file containing a list
 150of mappings with each line containing one mapping in the format:
 151
 152------------
 153    perforce_id = Full Name <email@address.com>
 154------------
 155
 156
 157Author
 158------
 159Written by Sean Estabrooks <seanlkml@sympatico.ca>
 160
 161
 162GIT
 163---
 164Part of the gitlink:git[7] suite
 165