git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pete Wyckoff <pw@padd.com>
To: Vitor Antunes <vitor.hda@gmail.com>
Cc: git@vger.kernel.org, Tor Arvid Lund <torarvid@gmail.com>
Subject: Re: [PATCH v3 0/4] git-p4: Improve branch support
Date: Sat, 20 Aug 2011 15:14:07 -0400	[thread overview]
Message-ID: <20110820191407.GD7135@arf.padd.com> (raw)
In-Reply-To: <CAOpHH-WeLWyEZaktYRzVN+dfgqu3==o4bgrfzpvS-QUCQboPgg@mail.gmail.com>

vitor.hda@gmail.com wrote on Fri, 19 Aug 2011 15:30 +0100:
> On Fri, Aug 19, 2011 at 12:53 PM, Pete Wyckoff <pw@padd.com> wrote:
> > Patches 1 and 2 are great.  We should have gotten those in way
> > back when you first submitted them.  I happily ack those.
> >
> > I'm still a bit hung up on #3, mainly because I don't get branch
> > support.  Let me play around with your test.  Having this
> > playbook of how it is supposed to work will help to educate me.
> 
> (I am probably going in too much detail here. Please skip any
> redundant information.)
> 
> In general, you can see branches in P4 as you do in SVN. They are
> simple copies from one directory to another. For example:
> 
>     p4 integrate //depot/big/directory/path/myproj/version_A \
>                  //depot/big/directory/path/myproj/version_B
> 
> Now the history of "version_B" is tied to "version_A". If you want to
> integrate (merge, in this case) new updates from one of the
> directories to the other you can just rerun the above command
> (version_A and version_B order may change depending on the direction
> of the merge).
> 
> P4 also allows you to define "branch specs" that you can use as a
> short hand instead of having to type in the full directory paths. So,
> assuming that you have a branch named "myproj_B" with the following
> view defined:
> 
>     //depot/big/directory/path/myproj/version_A \
>         //depot/big/directory/path/myproj/version_B
> 
> When you want to integrate it again you can simply type:
> 
>     p4 integrate -b myproj_B
> 
> or, if you want to integrate from version_B into version_A instead:
> 
>     p4 integrate -b myproj_B -r
> 
> git-p4 is using these branch specs to identify branches. Without this
> extra information it is nearly impossible for it to identify branches
> because an integrate can be done of a single file.
> 
> But since P4 does not strictly require branch specs and because most
> of the time integrations are done through P4V, then most of the time
> no branch specs are created. Now, if this happens git-p4 will not be
> able to detect branches! And creating branches in P4 just for git-p4
> does not make much sense, right? This is the main reason behind the
> third patch... :)

Thank you for these useful comments.  I have taken a first stab
at documenting the bevy of confusing branch flags and settings
in git-p4.  Please correct my errors and add other information
that is missing.

In particular, a clear case of how to set up the branches for
the branchList example would be good.  My minimal test did not
exactly work.


		-- Pete

--------------8<----------------------

From 36608a6e195041e8738bab24b84fadd0bf386865 Mon Sep 17 00:00:00 2001
From: Pete Wyckoff <pw@padd.com>
Date: Sat, 20 Aug 2011 15:04:09 -0400
Subject: [PATCH 4/4] git-p4: branch detection documentation start

Initial stab at documentation for --detect-branches and the
new branchList config setting.

Signed-off-by: Pete Wyckoff <pw@padd.com>
---
 contrib/fast-import/git-p4.txt |   48 +++++++++++++++++++++++++++++++++++++++-
 1 files changed, 47 insertions(+), 1 deletions(-)

diff --git a/contrib/fast-import/git-p4.txt b/contrib/fast-import/git-p4.txt
index 52003ae..6d21557 100644
--- a/contrib/fast-import/git-p4.txt
+++ b/contrib/fast-import/git-p4.txt
@@ -265,11 +265,57 @@ Only use branch specifications defined by the selected username.
 
 git-p4.branchList
 
-List of branches to be imported when branch detection is enabled.
+List of branches to be imported when branch detection is enabled.  This
+example shows that branchA and branchB are both created off branch main.
 
   git config [--global] git-p4.branchList main:branchA
   git config [--global] --add git-p4.branchList main:branchB
 
+Branch Detection
+================
+
+There are a few options that try to automatically create branches in git
+corresponding to branches in p4.
+
+Unfortunately, the concept of branch in p4 is quite different:  a p4
+branch is a mapping from one area of the repository to another.  It is
+used as input to "p4 integrate" to specify the source and destination of
+an integration.
+
+If you have a repository where all the branches are below a single
+directory, you can use "--detect-branches" when cloning or syncing to
+have git-p4 automatically look up the p4 branches and use these to
+generate branches in git.  Example:
+
+    P4 repository structure:
+
+	//depot/main/...
+	//depot/branch1/...
+    
+    View section from "p4 branch -o branch1"
+
+	//depot/main/... //depot/branch1/...
+    
+    Git clone command:
+
+	git-p4 clone --detect-branches //depot@all
+
+    Produces a separate branch in remotes/p4 for
+    //depot/main (called "master"), and one for //depot/branch1
+    (called "depot/branch1").
+
+However, it is not necessary to create branches in p4 to be able to
+use them like branches.  It is quite difficult to detect this
+automatically, but a git configuration setting "git-p4.branchList" can be
+used to explicitly identify branch relationships.  It is a list of
+"source":"destination" pairs, like a simple p4 branch specification,
+where the "source" and "destination" are the path elements in the
+p4 repository.  The example above relied on the presence of the p4
+branch.  Without that, you can get the same results by setting:
+
+  git config git-p4.branchList main:branch1
+
+
 Implementation Details...
 =========================
 
-- 
1.7.5.4

  reply	other threads:[~2011-08-20 19:14 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-18 23:44 [PATCH v3 0/4] git-p4: Improve branch support Vitor Antunes
2011-08-18 23:44 ` [PATCH v3 1/4] git-p4: Correct branch base depot path detection Vitor Antunes
2011-08-18 23:44 ` [PATCH v3 2/4] git-p4: Allow filtering Perforce branches by user Vitor Antunes
2011-08-18 23:44 ` [PATCH v3 3/4] git-p4: Allow branch definition with git config Vitor Antunes
2011-08-18 23:44 ` [PATCH v3 4/4] git-p4: Add simple test case for branch import Vitor Antunes
2011-08-20 19:11   ` Pete Wyckoff
2011-08-19 11:53 ` [PATCH v3 0/4] git-p4: Improve branch support Pete Wyckoff
2011-08-19 14:30   ` Vitor Antunes
2011-08-20 19:14     ` Pete Wyckoff [this message]
2011-08-23 22:32       ` Vitor Antunes
2011-08-19 18:02 ` Junio C Hamano
2011-08-19 18:23   ` Vitor Antunes

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=20110820191407.GD7135@arf.padd.com \
    --to=pw@padd.com \
    --cc=git@vger.kernel.org \
    --cc=torarvid@gmail.com \
    --cc=vitor.hda@gmail.com \
    /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).