Jump to content


Trying to replicate hierarchy of P4 depot with DVCS streams

dvcs

  • Please log in to reply
4 replies to this topic

#1 abourlon

abourlon

    Newbie

  • Members
  • Pip
  • 3 posts

Posted 23 October 2017 - 09:09 PM

Hello,

I'm currently trying to use the DVCS mode of P4, having worked with Hg/Git a lot in the past, with a shared server depot of the form (no stream) :

//Depot
_/Releases
__/RelA -> release branch A
__/RelB
__/RelC
_/Main   -> mainline
_/Devs
__/AliceDEV -> dev branch Alice
__/BobDEV

I have branch mappings between Main and RelA/RelB/etc. and between Main and AliceDev/BobDEV/etc.

In my DVCS clone, I'm trying to figure out the best way to model those relashionships. I'm only interested in Main and AliceDEV (my personal working branch) for now.

My clone naturally created //stream/main to map to //Depot/Main, and I know that from here the idea should be to create streams from //stream/main. But I already have a branch with shared history I want to reuse (i.e. AliceDEV) so I'd like to have a child stream (//stream/dev) related to //stream/main that maps to //Depot/Devs/AliceDEV.

I tried fiddling with both the stream spec and the remote mapping, but whatever I tried, it's like both streams don't know about their common past history. Basically I'm invited to merge-down ALL my Main branch to AliceDEV and then copy-up the result back to Main (while there is absolutely no change between the branches currently).

Also I can only have one workspace in this mode (P4V don't show the New Workspace options in a DVCS repo) and I'd like to have each stream to sit in a different directory, like :
C:\p4-dvcs
_________\.p4root
_________\main -> where //stream/main should map
_________\dev   -> where //stream/dev should map

Any idea how to map my streams like my branch mappings used to ?

#2 P4Jen

P4Jen

    Advanced Member

  • Staff Moderators
  • 112 posts

Posted 24 October 2017 - 10:47 AM

Hi,

If your dev branch is a child of 'main', then the relationship should be visible, provided that both branches are fetched in to the DVCS server.

I cloned '//depot/main' and '//depot/dev' to a DVCS Server.

'//depot/main' was mapped to '//stream/main' and '//depot/dev' was mapped to '//stream/dev'.

This filelog output shows the relationships are still known:
bash-3.2$ p4 where
//stream/dev/... //jen-dvcs-1508410408/... /users/jen/Documents/perforce/tests/repro/dvcs/...
bash-3.2$ p4 filelog -i //stream/dev/...
//stream/dev/orca/.cvsignore
... #1 change 14 branch on 2017/10/19 by jen@ws_classic (text) 'Populate //depot/main/... //dep'
... ... branch from //stream/main/orca/.cvsignore#1
//stream/main/orca/.cvsignore
... #1 change 13 add on 2017/10/19 by jen@ws_classic (text) 'Adding orca files'
... ... branch into //stream/dev/orca/.cvsignore#1
... ... branch into //stream/rel/orca/.cvsignore#1
//stream/dev/orca/.git/config
... #1 change 14 branch on 2017/10/19 by jen@ws_classic (text) 'Populate //depot/main/... //dep'
... ... branch from //stream/main/orca/.git/config#1
//stream/main/orca/.git/config
... #1 change 13 add on 2017/10/19 by jen@ws_classic (text) 'Adding orca files'
... ... branch into //stream/dev/orca/.git/config#1
... ... branch into //stream/rel/orca/.git/config#1
  <Snip>

The way that your dev branch was created may impact the results, but I have not been able to test using 'p4 integrate' and 'p4 copy' instead of ''p4 populate'.

Hope this helps,
Jen.


#3 abourlon

abourlon

    Newbie

  • Members
  • Pip
  • 3 posts

Posted 24 October 2017 - 01:39 PM

Well, thank you very much for your feedback!

So you made me check the way my branch was created (I suspected maybe it wasn't "branched" but integrated or copied instead). It's actually worse than that.

About a year ago we migrated from a multiple servers setup to a one server to rule them all. All projects were migrated to the new server, and it happens that our project was simply populated into a new branch on the new server like that (found it in the logs):

Populate -f //old-server-import/team/project/... //team/project/....

In my current example, Releases, Main and Devs are all sublevels of project (//team/project/Releases/..., //team/project/Main/...), so on the new server that makes //team/project a child branch of the old repo's team/project, but I suppose the rest of the hierarchy was lost in the transition.

Am I wrong? Does P4 can still know that //team/project/Devs/AliceDEV is a child branch of //team/project/Main, or is //team/project just one big folder for P4 now?

#4 Sambwise

Sambwise

    Advanced Member

  • Members
  • PipPipPip
  • 358 posts

Posted 24 October 2017 - 05:28 PM

View Postabourlon, on 24 October 2017 - 01:39 PM, said:

Am I wrong? Does P4 can still know that //team/project/Devs/AliceDEV is a child branch of //team/project/Main, or is //team/project just one big folder for P4 now?

Perforce tracks all of its branching relationships on a per-file level.

I'm not 100% sure if I followed your story correctly, but I'm hazarding a guess that you've got an indirect branching relationship between your main and dev branches:

.........new-MAIN
........../
-----old-MAIN
..........\
........your-DEV

or something like that?  If that's the case and you only fetch/push new-MAIN and your-DEV, there's no history between them -- you need that old-MAIN level to connect them.  You could fix this by pulling old-MAIN in, potentially.

My recommendation would be to have your DVCS instance just map your dev branch, push everything to there, and do your merging on the main server.  It's possible to merge shared branches on a DVCS instance and push the result, but it's not really the way the use case that it was designed for.

#5 abourlon

abourlon

    Newbie

  • Members
  • Pip
  • 3 posts

Posted 24 October 2017 - 05:55 PM

Not exactly. I used to have a correct branching between my main and my dev : //old/team/project/main -> //old/team/project/dev. But when the migration occured, the admin simply branched at the project level : //old/team/project/... to //new/team/projet/... So on the new server main and dev are simply 2 subfolders of the /team/project "branch".

View PostSambwise, on 24 October 2017 - 05:28 PM, said:

My recommendation would be to have your DVCS instance just map your dev branch, push everything to there, and do your merging on the main server.
That's what I've been doing. But honestly it makes working with P4 DVCS harder than just using my regular branch, cause it's something like shared main <=> shared dev <=> dvcs dev. So I have to fetch/push from my shared dev to my dvcs and still merge/copy between my shared main and my shared dev.





Also tagged with one or more of these keywords: dvcs

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users