Importing a long history from Perforce into git using the git-p4 tool
can be especially challenging. The `git p4 clone` operation is based
on an all-or-nothing transactionality guarantee. Under real-world
conditions like network unreliability or a busy Perforce server,
`git p4 clone` and `git p4 sync` operations can easily fail, forcing a
user to restart the import process from the beginning. The longer the
history being imported, the more likely a fault occurs during the
process. Long enough imports thus become statistically unlikely to ever
My idea was to leverage the checkpoint feature of git fast-import.
I've included a patch which exposes a new option to the sync/clone
commands in the git-p4 tool. The option enables explict checkpoints on
a periodic basis (approximately every x seconds).
If the sync/clone command fails during processing of Perforce changes,
the user can craft a new git p4 sync command that will identify
changes that have already been imported and proceed with importing
only changes more recent than the last successful checkpoint.
In v2 of this patch series I've added some basic test scenarios,
documentation, and did some minor clean up of the implementation
based on feedback on v1.
Ori Rawlings (1):
git-p4: Add --checkpoint-period option to sync/clone
Documentation/git-p4.txt | 12 ++++++-
git-p4.py | 7 ++++-
t/t9830-git-p4-checkpoint-period.sh | 59 ++++++++++++++++++++++++++++++-
3 files changed, 78 insertions(+), 0 deletions(-)
create mode 100755 t/t9830-git-p4-checkpoint-period.sh