From 0b69b469257424bcf015b7d3d03303c015c133f8 Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Tue, 20 Mar 2007 22:41:00 +0100 Subject: Start of the git-p4 documentation. Signed-off-by: Simon Hausmann --- contrib/fast-import/git-p4.txt | 74 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100644 contrib/fast-import/git-p4.txt (limited to 'contrib/fast-import/git-p4.txt') diff --git a/contrib/fast-import/git-p4.txt b/contrib/fast-import/git-p4.txt new file mode 100644 index 0000000000..b87efc6af9 --- /dev/null +++ b/contrib/fast-import/git-p4.txt @@ -0,0 +1,74 @@ +git-p4.py - Perforce <-> Git converter using git-fast-import + +Usage +===== + +git-p4 supports two main modes: Importing from Perforce to a Git repository is +done using "git-p4.py sync". Submitting changes from Git back to Perforce is +done using "git-p4.py submit". + +Importing +========= + +The procedure is simple: + + mkdir repo-git + cd repo-git + git init + git-p4.py sync //path/in/your/perforce/depot + +This will import the current head revision of the specified depot path into the +master branch of your git repository. You can use the --branch=mybranch option +to let git-p4 import from Perforce into a git branch of your choice. + +If you want to import the entire history of a given depot path just use + + git-p4.py sync //path/in/depot@all + + +Support for Perforce integrations is still work in progress. Don't bother +trying it unless you want to hack on it :) + + +Incremental Imports +=================== + +After an initial import you can easily synchronize your git repository with +newer changes from the Perforce depot by just calling + + git-p4.p4 sync + +in your git repository. git-p4 stores the depot path of the original import in +the .git/config file and remembers the last imported p4 revision as a git tag +called p4/ . + +Submitting +========== + +git-p4 has EXPERIMENTAL support for submitting changes from a git repository +back to a Perforce depot. This requires a Perforce checkout separate to your +git repository. This is the basic procedure: + + cd path/to/your/perforce/checkout + git-p4.py submit --git-dir=/path/to/your/git/repository + +This will create a temporary git branch, use git-rev-list to find out which git +commits are in your current branch but not in the "origin" branch. You can +override the name of the "origin" branch by using the --origin=mybranch option. +The "origin" branch has to be the branch populated with git-p4's sync +operation. + +After some preparations (which might take a while) git-p4 enters a loop where +it will first show a Perforce submit template and a diff of the change to +apply. After quitting the pager with 'q' git-p4 asks for confirmation for +issuing the "p4 submit" command and also gives you the option of editing the +submit template using "e". + +If a submit fails you may have to "p4 resolve" and submit manually. You can +continue importing the remaining changes with + + git-p4.py submit --git-dir=/path/to/your/git/repository --continue + +After submitting you should sync your origin branch from Perforce using +git-p4's sync command. + -- cgit v1.2.3 From b4aa8d12b48af84242a4a484673bc41326566ac9 Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Wed, 21 Mar 2007 08:27:33 +0100 Subject: Documentation enhancements. Signed-off-by: Simon Hausmann --- contrib/fast-import/git-p4.txt | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'contrib/fast-import/git-p4.txt') diff --git a/contrib/fast-import/git-p4.txt b/contrib/fast-import/git-p4.txt index b87efc6af9..4b4fcde72b 100644 --- a/contrib/fast-import/git-p4.txt +++ b/contrib/fast-import/git-p4.txt @@ -25,6 +25,8 @@ If you want to import the entire history of a given depot path just use git-p4.py sync //path/in/depot@all +To achieve optimal compression you may want to run 'git repack -a -d -f' after +a big import. This may take a while. Support for Perforce integrations is still work in progress. Don't bother trying it unless you want to hack on it :) @@ -42,6 +44,10 @@ in your git repository. git-p4 stores the depot path of the original import in the .git/config file and remembers the last imported p4 revision as a git tag called p4/ . +It is recommended to run 'git repack -a -d -f' from time to time when using +incremental imports to optimally combine the individual git packs that each +incremental import creates through the use of git-fast-import. + Submitting ========== -- cgit v1.2.3 From e7f0d0d9b9dc99a3f748ed686625cc9f87d9a267 Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Thu, 22 Mar 2007 09:13:01 +0100 Subject: Removed the .py extension from git-p4 as it's annoying to type every time. Signed-off-by: Simon Hausmann --- contrib/fast-import/git-p4.txt | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'contrib/fast-import/git-p4.txt') diff --git a/contrib/fast-import/git-p4.txt b/contrib/fast-import/git-p4.txt index 4b4fcde72b..5786bffad4 100644 --- a/contrib/fast-import/git-p4.txt +++ b/contrib/fast-import/git-p4.txt @@ -1,11 +1,11 @@ -git-p4.py - Perforce <-> Git converter using git-fast-import +git-p4 - Perforce <-> Git converter using git-fast-import Usage ===== git-p4 supports two main modes: Importing from Perforce to a Git repository is -done using "git-p4.py sync". Submitting changes from Git back to Perforce is -done using "git-p4.py submit". +done using "git-p4 sync". Submitting changes from Git back to Perforce is +done using "git-p4 submit". Importing ========= @@ -15,7 +15,7 @@ The procedure is simple: mkdir repo-git cd repo-git git init - git-p4.py sync //path/in/your/perforce/depot + git-p4 sync //path/in/your/perforce/depot This will import the current head revision of the specified depot path into the master branch of your git repository. You can use the --branch=mybranch option @@ -23,7 +23,7 @@ to let git-p4 import from Perforce into a git branch of your choice. If you want to import the entire history of a given depot path just use - git-p4.py sync //path/in/depot@all + git-p4 sync //path/in/depot@all To achieve optimal compression you may want to run 'git repack -a -d -f' after a big import. This may take a while. @@ -56,7 +56,7 @@ back to a Perforce depot. This requires a Perforce checkout separate to your git repository. This is the basic procedure: cd path/to/your/perforce/checkout - git-p4.py submit --git-dir=/path/to/your/git/repository + git-p4 submit --git-dir=/path/to/your/git/repository This will create a temporary git branch, use git-rev-list to find out which git commits are in your current branch but not in the "origin" branch. You can @@ -73,7 +73,7 @@ submit template using "e". If a submit fails you may have to "p4 resolve" and submit manually. You can continue importing the remaining changes with - git-p4.py submit --git-dir=/path/to/your/git/repository --continue + git-p4 submit --git-dir=/path/to/your/git/repository --continue After submitting you should sync your origin branch from Perforce using git-p4's sync command. -- cgit v1.2.3 From f5816a5522763f46e075cc618eab12110107a917 Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Thu, 22 Mar 2007 20:36:28 +0100 Subject: Changed the default branch for imports from "master" to "p4" Signed-off-by: Simon Hausmann --- contrib/fast-import/git-p4.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'contrib/fast-import/git-p4.txt') diff --git a/contrib/fast-import/git-p4.txt b/contrib/fast-import/git-p4.txt index 5786bffad4..0d30aff64c 100644 --- a/contrib/fast-import/git-p4.txt +++ b/contrib/fast-import/git-p4.txt @@ -17,9 +17,9 @@ The procedure is simple: git init git-p4 sync //path/in/your/perforce/depot -This will import the current head revision of the specified depot path into the -master branch of your git repository. You can use the --branch=mybranch option -to let git-p4 import from Perforce into a git branch of your choice. +This will import the current head revision of the specified depot path into a +"p4" branch of your git repository. You can use the --branch=mybranch option +to use a different branch. If you want to import the entire history of a given depot path just use -- cgit v1.2.3 From 179caebff4a917dc35c8166ec183bc5c76df53e1 Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Thu, 22 Mar 2007 22:17:42 +0100 Subject: Brand new smart incremental import that doesn't need tags or git repo-config :) Signed-off-by: Simon Hausmann --- contrib/fast-import/git-p4.txt | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'contrib/fast-import/git-p4.txt') diff --git a/contrib/fast-import/git-p4.txt b/contrib/fast-import/git-p4.txt index 0d30aff64c..4319c82dcd 100644 --- a/contrib/fast-import/git-p4.txt +++ b/contrib/fast-import/git-p4.txt @@ -38,11 +38,9 @@ Incremental Imports After an initial import you can easily synchronize your git repository with newer changes from the Perforce depot by just calling - git-p4.p4 sync + git-p4 sync -in your git repository. git-p4 stores the depot path of the original import in -the .git/config file and remembers the last imported p4 revision as a git tag -called p4/ . +in your git repository. It is recommended to run 'git repack -a -d -f' from time to time when using incremental imports to optimally combine the individual git packs that each -- cgit v1.2.3 From 9512497bcf574a2f70e43be0bcb58e35fb6aaba8 Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Fri, 23 Mar 2007 09:16:07 +0100 Subject: Make it possible to run git-p4 submit from within the git repository Signed-off-by: Simon Hausmann --- contrib/fast-import/git-p4.txt | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) (limited to 'contrib/fast-import/git-p4.txt') diff --git a/contrib/fast-import/git-p4.txt b/contrib/fast-import/git-p4.txt index 4319c82dcd..8bf0805c74 100644 --- a/contrib/fast-import/git-p4.txt +++ b/contrib/fast-import/git-p4.txt @@ -51,28 +51,27 @@ Submitting git-p4 has EXPERIMENTAL support for submitting changes from a git repository back to a Perforce depot. This requires a Perforce checkout separate to your -git repository. This is the basic procedure: +git repository. All it should take is calling - cd path/to/your/perforce/checkout - git-p4 submit --git-dir=/path/to/your/git/repository + git-p4 submit -This will create a temporary git branch, use git-rev-list to find out which git -commits are in your current branch but not in the "origin" branch. You can -override the name of the "origin" branch by using the --origin=mybranch option. -The "origin" branch has to be the branch populated with git-p4's sync -operation. +in your git repository. This will attempt to locate the perforce checkout +corresponding to your imported depot path. By default the changes between your +current branch and the "p4" branch will be submitted. If there is no "p4" +branch the "origin" branch will be used as reference instead. You can override +this with the --origin=mysourcebranch option. The "origin" branch has to be the +branch populated with git-p4's sync operation. After some preparations (which might take a while) git-p4 enters a loop where it will first show a Perforce submit template and a diff of the change to -apply. After quitting the pager with 'q' git-p4 asks for confirmation for -issuing the "p4 submit" command and also gives you the option of editing the -submit template using "e". +apply in the editor. After saving and exiting the editor you will be asked whether +you really want to submit the change or not. If a submit fails you may have to "p4 resolve" and submit manually. You can continue importing the remaining changes with - git-p4 submit --git-dir=/path/to/your/git/repository --continue + git-p4 submit --continue -After submitting you should sync your origin branch from Perforce using -git-p4's sync command. +After submitting you should sync your perforce import branch ("p4" or "origin") +from Perforce using git-p4's sync command. -- cgit v1.2.3 From c9b50e6307aa9931e18b6cd4d00de817b8e4a4c2 Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Thu, 29 Mar 2007 19:15:24 +0200 Subject: Fix the docs for git-p4 submit and turn git-p4 submit --master=foo into simply git-p4 submit mytopicbranch. Signed-off-by: Simon Hausmann --- contrib/fast-import/git-p4.txt | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) (limited to 'contrib/fast-import/git-p4.txt') diff --git a/contrib/fast-import/git-p4.txt b/contrib/fast-import/git-p4.txt index 8bf0805c74..30e2cb9a55 100644 --- a/contrib/fast-import/git-p4.txt +++ b/contrib/fast-import/git-p4.txt @@ -49,23 +49,19 @@ incremental import creates through the use of git-fast-import. Submitting ========== -git-p4 has EXPERIMENTAL support for submitting changes from a git repository -back to a Perforce depot. This requires a Perforce checkout separate to your -git repository. All it should take is calling +git-p4 has support for submitting changes from a git repository back to the +Perforce depot. This requires a Perforce checkout separate to your git +repository. To submit all changes that are in the current git branch but not in +the "p4" branch (or "origin" if "p4" doesn't exist) simply call git-p4 submit -in your git repository. This will attempt to locate the perforce checkout -corresponding to your imported depot path. By default the changes between your -current branch and the "p4" branch will be submitted. If there is no "p4" -branch the "origin" branch will be used as reference instead. You can override -this with the --origin=mysourcebranch option. The "origin" branch has to be the -branch populated with git-p4's sync operation. +in your git repository. If you want to submit changes in a specific branch that +is not your current git branch you can also pass that as an argument: -After some preparations (which might take a while) git-p4 enters a loop where -it will first show a Perforce submit template and a diff of the change to -apply in the editor. After saving and exiting the editor you will be asked whether -you really want to submit the change or not. + git-p4 submit mytopicbranch + +You can override the reference branch with the --origin=mysourcebranch option. If a submit fails you may have to "p4 resolve" and submit manually. You can continue importing the remaining changes with @@ -74,4 +70,3 @@ continue importing the remaining changes with After submitting you should sync your perforce import branch ("p4" or "origin") from Perforce using git-p4's sync command. - -- cgit v1.2.3 From 01ce1fe9676e3f714f3a2d068bf8cfe021f4073c Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Sat, 7 Apr 2007 23:46:50 +0200 Subject: Added git-p4 rebase convenience Signed-off-by: Simon Hausmann --- contrib/fast-import/git-p4.txt | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'contrib/fast-import/git-p4.txt') diff --git a/contrib/fast-import/git-p4.txt b/contrib/fast-import/git-p4.txt index 30e2cb9a55..5f7251c2d6 100644 --- a/contrib/fast-import/git-p4.txt +++ b/contrib/fast-import/git-p4.txt @@ -40,12 +40,24 @@ newer changes from the Perforce depot by just calling git-p4 sync -in your git repository. +in your git repository. By default the "p4" branch is updated. It is recommended to run 'git repack -a -d -f' from time to time when using incremental imports to optimally combine the individual git packs that each incremental import creates through the use of git-fast-import. +Updating +======== + +A common working pattern is to fetch the latest changes from the Perforce depot +and merge them with local uncommitted changes. The recommended way is to use +git's rebase mechanism to preserve linear history. git-p4 provides a convenient + + git-p4 rebase + +command that calls git-p4 sync followed by git rebase to rebase the current +working branch. + Submitting ========== -- cgit v1.2.3 From f9a3a4f796461276bbbcfef965984086e8e00b46 Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Sun, 8 Apr 2007 10:08:26 +0200 Subject: Added git-p4 clone convenience command Signed-off-by: Simon Hausmann --- contrib/fast-import/git-p4.txt | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) (limited to 'contrib/fast-import/git-p4.txt') diff --git a/contrib/fast-import/git-p4.txt b/contrib/fast-import/git-p4.txt index 5f7251c2d6..99ae85bd7b 100644 --- a/contrib/fast-import/git-p4.txt +++ b/contrib/fast-import/git-p4.txt @@ -10,7 +10,25 @@ done using "git-p4 submit". Importing ========= -The procedure is simple: +You can simply start with + + git-p4 clone //depot/path/project + +or + + git-p4 clone //depot/path/project myproject + +This will create an empty git repository in a subdirectory called "project" (or +"myproject" with the second command), import the head revision from the +specified perforce path into a git "p4" branch, create a master branch off it +and check it out. If you want the entire history (not just the head revision) then +you can simply append a "@all" to the depot path: + + git-p4 clone //depot/project/main@all myproject + + + +If you want more control you can also use the git-p4 sync command directly: mkdir repo-git cd repo-git @@ -31,6 +49,9 @@ a big import. This may take a while. Support for Perforce integrations is still work in progress. Don't bother trying it unless you want to hack on it :) +For convenience there's also the git-p4 clone command that works similar to +git-clone and combines the creation of the git repository with the the initial +import and the branch setup Incremental Imports =================== -- cgit v1.2.3 From 7243b350b3469eb78be950331290ea16e57c3de8 Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Sun, 8 Apr 2007 10:21:56 +0200 Subject: Added a simple example of usage to the "documentation" :) Signed-off-by: Simon Hausmann --- contrib/fast-import/git-p4.txt | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'contrib/fast-import/git-p4.txt') diff --git a/contrib/fast-import/git-p4.txt b/contrib/fast-import/git-p4.txt index 99ae85bd7b..4f6a680f95 100644 --- a/contrib/fast-import/git-p4.txt +++ b/contrib/fast-import/git-p4.txt @@ -103,3 +103,25 @@ continue importing the remaining changes with After submitting you should sync your perforce import branch ("p4" or "origin") from Perforce using git-p4's sync command. + + +Example +======= + +# Clone a repository + git-p4 clone //depot/path/project +# Enter the newly cloned directory + cd project +# Do some work... + vi foo.h +# ... and commit locally to gi + git commit foo.h +# In the meantime somebody submitted changes to the Perforce depot. Rebase your latest +# changes against the latest changes in Perforce: + git-p4 rebase +# Submit your locally committed changes back to Perforce + git-p4 submit +# ... and synchronize with Perforce + git-p4 rebase + + -- cgit v1.2.3 From ff5dba20e324fb394b7077d0b1d1c5eb4357959f Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Tue, 1 May 2007 18:28:38 +0200 Subject: Doc cleanups. Signed-off-by: Simon Hausmann --- contrib/fast-import/git-p4.txt | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'contrib/fast-import/git-p4.txt') diff --git a/contrib/fast-import/git-p4.txt b/contrib/fast-import/git-p4.txt index 4f6a680f95..d36a1cf18c 100644 --- a/contrib/fast-import/git-p4.txt +++ b/contrib/fast-import/git-p4.txt @@ -4,8 +4,8 @@ Usage ===== git-p4 supports two main modes: Importing from Perforce to a Git repository is -done using "git-p4 sync". Submitting changes from Git back to Perforce is -done using "git-p4 submit". +done using "git-p4 sync" or "git-p4 rebase". Submitting changes from Git back +to Perforce is done using "git-p4 submit". Importing ========= @@ -49,10 +49,6 @@ a big import. This may take a while. Support for Perforce integrations is still work in progress. Don't bother trying it unless you want to hack on it :) -For convenience there's also the git-p4 clone command that works similar to -git-clone and combines the creation of the git repository with the the initial -import and the branch setup - Incremental Imports =================== -- cgit v1.2.3 From a844b7406f17ac6e069e617509a2997d7e128500 Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Mon, 7 May 2007 20:14:17 +0200 Subject: Document some implementation details, for the curious... :) Signed-off-by: Simon Hausmann --- contrib/fast-import/git-p4.txt | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'contrib/fast-import/git-p4.txt') diff --git a/contrib/fast-import/git-p4.txt b/contrib/fast-import/git-p4.txt index d36a1cf18c..ff0da9d0c8 100644 --- a/contrib/fast-import/git-p4.txt +++ b/contrib/fast-import/git-p4.txt @@ -121,3 +121,20 @@ Example git-p4 rebase +Implementation Details... +========================= + +* Changesets from Perforce are imported using git fast-import. +* The import does not require anything from the Perforce client view as it just uses + "p4 print //depot/path/file#revision" to get the actual file contents. +* Every imported changeset has a special [git-p4...] line at the + end of the log message that gives information about the corresponding + Perforce change number and is also used by git-p4 itself to find out + where to continue importing when doing incremental imports. + Basically when syncing it extracts the perforce change number of the + latest commit in the "p4" branch and uses "p4 changes //depot/path/...@changenum,#head" + to find out which changes need to be imported. +* git-p4 submit uses "git rev-list" to pick the commits between the "p4" branch + and the current branch. + The commits themselves are applied using git diff-tree ... | patch -p1 + -- cgit v1.2.3 From c6d44cb1a1a9bca58d91ef414b9dbaa393d2de3a Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Thu, 17 May 2007 20:57:05 +0200 Subject: Changed the default p4 import branch to be refs/remotes/p4/{HEAD,master} instead of refs/heads/p4. Signed-off-by: Simon Hausmann --- contrib/fast-import/git-p4.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'contrib/fast-import/git-p4.txt') diff --git a/contrib/fast-import/git-p4.txt b/contrib/fast-import/git-p4.txt index ff0da9d0c8..32aeb0ac0b 100644 --- a/contrib/fast-import/git-p4.txt +++ b/contrib/fast-import/git-p4.txt @@ -20,9 +20,9 @@ or This will create an empty git repository in a subdirectory called "project" (or "myproject" with the second command), import the head revision from the -specified perforce path into a git "p4" branch, create a master branch off it -and check it out. If you want the entire history (not just the head revision) then -you can simply append a "@all" to the depot path: +specified perforce path into a git "p4" branch (remotes/p4 actually), create a +master branch off it and check it out. If you want the entire history (not just +the head revision) then you can simply append a "@all" to the depot path: git-p4 clone //depot/project/main@all myproject -- cgit v1.2.3 From ef48f9093ced75ca20295f42b993bd390873573d Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Thu, 17 May 2007 22:17:49 +0200 Subject: Added support for git-p4 sync/rebase --with-origin. See git-p4.txt for details :) Signed-off-by: Simon Hausmann --- contrib/fast-import/git-p4.txt | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'contrib/fast-import/git-p4.txt') diff --git a/contrib/fast-import/git-p4.txt b/contrib/fast-import/git-p4.txt index 32aeb0ac0b..ac8e6cff0b 100644 --- a/contrib/fast-import/git-p4.txt +++ b/contrib/fast-import/git-p4.txt @@ -63,6 +63,26 @@ It is recommended to run 'git repack -a -d -f' from time to time when using incremental imports to optimally combine the individual git packs that each incremental import creates through the use of git-fast-import. + +A useful setup may be that you have a periodically updated git repository +somewhere that contains a complete import of a Perforce project. That git +repository can be used to clone the working repository from and one would +import from Perforce directly after cloning using git-p4. If the connection to +the Perforce server is slow and the working repository hasn't been synced for a +while it may be desirable to fetch changes from the origin git repository using +the efficient git protocol. git-p4 supports this through + + git-p4 sync --with-origin + +or + + git-p4 rebase --with-origin + +In that case "git fetch origin" is called and if it turns out that the origin +branch is newer than the git "p4" import branch then the latter is updated from +the former and the direct import from Perforce is resumed, which will result in +fewer changes to be imported using the slower perforce connection. + Updating ======== -- cgit v1.2.3 From a396b292678838b4cae1b358c62da6b4e0929fc2 Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Wed, 23 May 2007 00:33:34 +0200 Subject: Doc updates Signed-off-by: Simon Hausmann --- contrib/fast-import/git-p4.txt | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'contrib/fast-import/git-p4.txt') diff --git a/contrib/fast-import/git-p4.txt b/contrib/fast-import/git-p4.txt index ac8e6cff0b..aa9f31e5fc 100644 --- a/contrib/fast-import/git-p4.txt +++ b/contrib/fast-import/git-p4.txt @@ -120,6 +120,13 @@ continue importing the remaining changes with After submitting you should sync your perforce import branch ("p4" or "origin") from Perforce using git-p4's sync command. +If you have changes in your working directory that you haven't committed into +git yet but that you want to commit to Perforce directly ("quick fixes") then +you do not have to go through the intermediate step of creating a git commit +first but you can just call + + git-p4 submit --direct + Example ======= @@ -156,5 +163,5 @@ Implementation Details... to find out which changes need to be imported. * git-p4 submit uses "git rev-list" to pick the commits between the "p4" branch and the current branch. - The commits themselves are applied using git diff-tree ... | patch -p1 + The commits themselves are applied using git diff/format-patch ... | git apply -- cgit v1.2.3 From 01265103fe3966abd720ebb0bba1882a5701f327 Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Fri, 25 May 2007 10:36:10 +0200 Subject: Make --with-origin the default for syncing. Signed-off-by: Simon Hausmann --- contrib/fast-import/git-p4.txt | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) (limited to 'contrib/fast-import/git-p4.txt') diff --git a/contrib/fast-import/git-p4.txt b/contrib/fast-import/git-p4.txt index aa9f31e5fc..c315158d8d 100644 --- a/contrib/fast-import/git-p4.txt +++ b/contrib/fast-import/git-p4.txt @@ -70,18 +70,10 @@ repository can be used to clone the working repository from and one would import from Perforce directly after cloning using git-p4. If the connection to the Perforce server is slow and the working repository hasn't been synced for a while it may be desirable to fetch changes from the origin git repository using -the efficient git protocol. git-p4 supports this through +the efficient git protocol. git-p4 supports this setup by calling "git fetch origin" +by default if there is an origin branch. You can disable this using - git-p4 sync --with-origin - -or - - git-p4 rebase --with-origin - -In that case "git fetch origin" is called and if it turns out that the origin -branch is newer than the git "p4" import branch then the latter is updated from -the former and the direct import from Perforce is resumed, which will result in -fewer changes to be imported using the slower perforce connection. + git config git-p4.syncFromOrigin false Updating ======== -- cgit v1.2.3 From 81b462a629c2feff9ab1dc43148643aad9571271 Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Mon, 11 Jun 2007 23:30:23 +0200 Subject: Mention remotes/p4/master also in the documentation. Signed-off-by: Simon Hausmann --- contrib/fast-import/git-p4.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'contrib/fast-import/git-p4.txt') diff --git a/contrib/fast-import/git-p4.txt b/contrib/fast-import/git-p4.txt index c315158d8d..b16a8384bc 100644 --- a/contrib/fast-import/git-p4.txt +++ b/contrib/fast-import/git-p4.txt @@ -36,8 +36,8 @@ If you want more control you can also use the git-p4 sync command directly: git-p4 sync //path/in/your/perforce/depot This will import the current head revision of the specified depot path into a -"p4" branch of your git repository. You can use the --branch=mybranch option -to use a different branch. +"remotes/p4/master" branch of your git repository. You can use the +--branch=mybranch option to use a different branch. If you want to import the entire history of a given depot path just use @@ -57,7 +57,7 @@ newer changes from the Perforce depot by just calling git-p4 sync -in your git repository. By default the "p4" branch is updated. +in your git repository. By default the "remotes/p4/master" branch is updated. It is recommended to run 'git repack -a -d -f' from time to time when using incremental imports to optimally combine the individual git packs that each -- cgit v1.2.3 From bc02acfc769a1ae19772feaa7f03acfaea18a36f Mon Sep 17 00:00:00 2001 From: Anand Kumria Date: Sun, 10 Aug 2008 19:26:33 +0100 Subject: Move git-p4.syncFromOrigin into a configuration parameters section Signed-off-by: Anand Kumria Signed-off-by: Junio C Hamano --- contrib/fast-import/git-p4.txt | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) (limited to 'contrib/fast-import/git-p4.txt') diff --git a/contrib/fast-import/git-p4.txt b/contrib/fast-import/git-p4.txt index b16a8384bc..0896abb933 100644 --- a/contrib/fast-import/git-p4.txt +++ b/contrib/fast-import/git-p4.txt @@ -63,18 +63,6 @@ It is recommended to run 'git repack -a -d -f' from time to time when using incremental imports to optimally combine the individual git packs that each incremental import creates through the use of git-fast-import. - -A useful setup may be that you have a periodically updated git repository -somewhere that contains a complete import of a Perforce project. That git -repository can be used to clone the working repository from and one would -import from Perforce directly after cloning using git-p4. If the connection to -the Perforce server is slow and the working repository hasn't been synced for a -while it may be desirable to fetch changes from the origin git repository using -the efficient git protocol. git-p4 supports this setup by calling "git fetch origin" -by default if there is an origin branch. You can disable this using - - git config git-p4.syncFromOrigin false - Updating ======== @@ -140,6 +128,22 @@ Example git-p4 rebase +Configuration parameters +======================== + +git-p4.syncFromOrigin + +A useful setup may be that you have a periodically updated git repository +somewhere that contains a complete import of a Perforce project. That git +repository can be used to clone the working repository from and one would +import from Perforce directly after cloning using git-p4. If the connection to +the Perforce server is slow and the working repository hasn't been synced for a +while it may be desirable to fetch changes from the origin git repository using +the efficient git protocol. git-p4 supports this setup by calling "git fetch origin" +by default if there is an origin branch. You can disable this using: + + git config [--global] git-p4.syncFromOrigin false + Implementation Details... ========================= -- cgit v1.2.3 From b87a659635f40b5301c6b18fa5e22c72ca79b830 Mon Sep 17 00:00:00 2001 From: Anand Kumria Date: Sun, 10 Aug 2008 19:26:34 +0100 Subject: Put some documentation in about the parameters that have been added Signed-off-by: Anand Kumria Signed-off-by: Junio C Hamano --- contrib/fast-import/git-p4.txt | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'contrib/fast-import/git-p4.txt') diff --git a/contrib/fast-import/git-p4.txt b/contrib/fast-import/git-p4.txt index 0896abb933..79a22e9c10 100644 --- a/contrib/fast-import/git-p4.txt +++ b/contrib/fast-import/git-p4.txt @@ -131,6 +131,38 @@ Example Configuration parameters ======================== +git-p4.user ($P4USER) + +Allows you to specify the username to use to connect to the Perforce repository. + + git config [--global] git-p4.user public + +git-p4.password ($P4PASS) + +Allows you to specify the password to use to connect to the Perforce repository. +Warning this password will be visible on the command-line invocation of the p4 binary. + + git config [--global] git-p4.password public1234 + +git-p4.port ($P4PORT) + +Specify the port to be used to contact the Perforce server. As this will be passed +directly to the p4 binary, it may be in the format host:port as well. + + git config [--global] git-p4.port codes.zimbra.com:2666 + +git-p4.host ($P4HOST) + +Specify the host to contact for a Perforce repository. + + git config [--global] git-p4.host perforce.example.com + +git-p4.client ($P4CLIENT) + +Specify the client name to use + + git config [--global] git-p4.client public-view + git-p4.syncFromOrigin A useful setup may be that you have a periodically updated git repository -- cgit v1.2.3 From 5b5aa22f00c315021ff58450f18134b20dfd5abd Mon Sep 17 00:00:00 2001 From: Anand Kumria Date: Sun, 10 Aug 2008 19:26:35 +0100 Subject: Put in the two other configuration elements found in the source I am not entirely clear what these parameters do but felt it useful to call them out in the documentation. Signed-off-by: Anand Kumria Signed-off-by: Junio C Hamano --- contrib/fast-import/git-p4.txt | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'contrib/fast-import/git-p4.txt') diff --git a/contrib/fast-import/git-p4.txt b/contrib/fast-import/git-p4.txt index 79a22e9c10..ac551d45f1 100644 --- a/contrib/fast-import/git-p4.txt +++ b/contrib/fast-import/git-p4.txt @@ -163,6 +163,10 @@ Specify the client name to use git config [--global] git-p4.client public-view +git-p4.allowSubmit + + git config [--global] git-p4.allowSubmit false + git-p4.syncFromOrigin A useful setup may be that you have a periodically updated git repository @@ -176,6 +180,10 @@ by default if there is an origin branch. You can disable this using: git config [--global] git-p4.syncFromOrigin false +git-p4.useclientspec + + git config [--global] git-p4.useclientspec false + Implementation Details... ========================= -- cgit v1.2.3 From f5f7e4a18cf656747be8f8447ca304ddf716c742 Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Sun, 24 Aug 2008 16:12:23 +0200 Subject: Clean up the git-p4 documentation This patch massages the documentation a bit for improved readability and cleans it up from outdated options/commands. Signed-off-by: Simon Hausmann Signed-off-by: Junio C Hamano --- contrib/fast-import/git-p4.txt | 69 +++++++++++++++++++++++------------------- 1 file changed, 38 insertions(+), 31 deletions(-) (limited to 'contrib/fast-import/git-p4.txt') diff --git a/contrib/fast-import/git-p4.txt b/contrib/fast-import/git-p4.txt index ac551d45f1..49b335921a 100644 --- a/contrib/fast-import/git-p4.txt +++ b/contrib/fast-import/git-p4.txt @@ -3,14 +3,16 @@ git-p4 - Perforce <-> Git converter using git-fast-import Usage ===== -git-p4 supports two main modes: Importing from Perforce to a Git repository is -done using "git-p4 sync" or "git-p4 rebase". Submitting changes from Git back -to Perforce is done using "git-p4 submit". +git-p4 can be used in two different ways: + +1) To import changes from Perforce to a Git repository, using "git-p4 sync". + +2) To submit changes from Git back to Perforce, using "git-p4 submit". Importing ========= -You can simply start with +Simply start with git-p4 clone //depot/path/project @@ -18,11 +20,18 @@ or git-p4 clone //depot/path/project myproject -This will create an empty git repository in a subdirectory called "project" (or -"myproject" with the second command), import the head revision from the -specified perforce path into a git "p4" branch (remotes/p4 actually), create a -master branch off it and check it out. If you want the entire history (not just -the head revision) then you can simply append a "@all" to the depot path: +This will: + +1) Create an empty git repository in a subdirectory called "project" (or +"myproject" with the second command) + +2) Import the head revision from the given Perforce path into a git branch +called "p4" (remotes/p4 actually) + +3) Create a master branch based on it and check it out. + +If you want the entire history (not just the head revision) then you can simply +append a "@all" to the depot path: git-p4 clone //depot/project/main@all myproject @@ -37,31 +46,40 @@ If you want more control you can also use the git-p4 sync command directly: This will import the current head revision of the specified depot path into a "remotes/p4/master" branch of your git repository. You can use the ---branch=mybranch option to use a different branch. +--branch=mybranch option to import into a different branch. -If you want to import the entire history of a given depot path just use +If you want to import the entire history of a given depot path simply use: git-p4 sync //path/in/depot@all + +Note: + To achieve optimal compression you may want to run 'git repack -a -d -f' after a big import. This may take a while. -Support for Perforce integrations is still work in progress. Don't bother -trying it unless you want to hack on it :) - Incremental Imports =================== -After an initial import you can easily synchronize your git repository with -newer changes from the Perforce depot by just calling +After an initial import you can continue to synchronize your git repository +with newer changes from the Perforce depot by just calling git-p4 sync in your git repository. By default the "remotes/p4/master" branch is updated. -It is recommended to run 'git repack -a -d -f' from time to time when using -incremental imports to optimally combine the individual git packs that each -incremental import creates through the use of git-fast-import. +Advanced Setup +============== + +Suppose you have a periodically updated git repository somewhere, containing a +complete import of a Perforce project. This repository can be cloned and used +with git-p4. When updating the cloned repository with the "sync" command, +git-p4 will try to fetch changes from the original repository first. The git +protocol used with this is usually faster than importing from Perforce +directly. + +This behaviour can be disabled by setting the "git-p4.syncFromOrigin" git +configuration variable to "false". Updating ======== @@ -79,7 +97,7 @@ Submitting ========== git-p4 has support for submitting changes from a git repository back to the -Perforce depot. This requires a Perforce checkout separate to your git +Perforce depot. This requires a Perforce checkout separate from your git repository. To submit all changes that are in the current git branch but not in the "p4" branch (or "origin" if "p4" doesn't exist) simply call @@ -97,17 +115,6 @@ continue importing the remaining changes with git-p4 submit --continue -After submitting you should sync your perforce import branch ("p4" or "origin") -from Perforce using git-p4's sync command. - -If you have changes in your working directory that you haven't committed into -git yet but that you want to commit to Perforce directly ("quick fixes") then -you do not have to go through the intermediate step of creating a git commit -first but you can just call - - git-p4 submit --direct - - Example ======= -- cgit v1.2.3