Jump to content


submittable stream "import"s (or sharing between streams)

stream import

  • Please log in to reply
12 replies to this topic

#1 SergeyN

SergeyN

    Member

  • Members
  • PipPip
  • 29 posts

Posted 22 February 2014 - 10:05 PM

Hello.

Sorry if my question sounds noobie, I'm new to perforce.

In stream specification "import" directive is useful for bringing in 3rd party folders. I have a situation where many project share the same source code. However, from time to time the shared code gets improved when working on one specific project, and those improvements I would like to get automatically propagated to all other projects sharing the same common code. According to the docs, if shared code brought via "import" directive, then I can't submit changes to it.

Could you please help me set this up right with perforce ?

Thanks.

#2 P4Matt

P4Matt

    Advanced Member

  • Members
  • PipPipPip
  • 1383 posts

Posted 24 February 2014 - 05:27 AM

There's a really nice way to handle this using shelves that maintains the goal of changes only ever impacting one stream, while allowing you to get changes where they need to be. While you can't submit to the imports, you can shelve changes against them. Make the changes you want to your imported paths, and then use the 'shelve' command to stash that work on the server. Now you can either switch to a workspace that can submit those files, or if those files are owned by another group, you can have them review and submit your changes.

It is a bit tedious to do this in two phases, but when we were designing streams one of our goals was to use them to enforce SCM best practices. Many times we saw people making the same change across four or five codelines in one change instead of making it one place and then propagating the change. The read-only imports are an attempt to enforce that rule.

#3 phopkins

phopkins

    Advanced Member

  • Members
  • PipPipPip
  • 97 posts

Posted 24 February 2014 - 05:33 AM

Check out shelving and the 'Change Ownership' functionality, it's quite a useful feature. So what you can do is this

Developer Team A clientspec
share TeamASource/...
import TeamBSource //root/TeamB

Developer Team B clientspec
share TeamBSource/...
import TeamASource //root/TeamA

So when TeamA want to make changes to TeamB stuff, they can check out and edit they just can't check in right? So what you can do is 'Shelve' the changes (which you should be doing for code reviews anyway), then change the ownership of the shelved files to the TeamB guys and when they are happy with the changes and code review, bam they can unshelve it or commit it from the unshelving.

This workflow came naturally to us due to how our software is designed and is great for multiple teams working on code owned by one team.

Disclaimer: I'm not a perforce guy, just a perforce user, perforce guys might have a better option for you.

#4 phopkins

phopkins

    Advanced Member

  • Members
  • PipPipPip
  • 97 posts

Posted 24 February 2014 - 05:34 AM

Hah!  Matt beat me to it, but it sounds like he has the same advice. Whatever I'm doing, I'm doing it right :)

#5 SergeyN

SergeyN

    Member

  • Members
  • PipPip
  • 29 posts

Posted 24 February 2014 - 08:03 PM

Thank you very much for your answers and the "Shelving" tip! Will try this approach.

For you information, I like how svn externals fit for my case, and I'm looking for a similar approach I could do with perforce.

#6 P4Matt

P4Matt

    Advanced Member

  • Members
  • PipPipPip
  • 1383 posts

Posted 24 February 2014 - 09:46 PM

At this point using shelving with imports is your best bet. I would like to see us introduce a variant of import that allows submits for people who really need that flexibility. Outside of svn supporting content from other servers are there other aspects of externals that you're looking for?

#7 SergeyN

SergeyN

    Member

  • Members
  • PipPip
  • 29 posts

Posted 26 February 2014 - 11:58 AM

My code base is quite small, but with a bunch of reusable functionality between projects. All I'm hunting for at the moment is:

1.) a way to easily share same code between many projects (which imports successfully achieve).
2.) Easy modifications from inside one of the projects. With svn externals I just do one submit with all the modifications in the project, including changes in the shared part, and that's it. I don't even have the shared part checked out separately - very convenient.

Note that at this point in time I don't care about branching/tagging the contents of shared code. Perhaps this will be more of an issue in the future for me.

#8 SergeyN

SergeyN

    Member

  • Members
  • PipPip
  • 29 posts

Posted 10 April 2014 - 12:45 AM

Hi again,

I've tried the shelving method. It works. A bit too much clicking, but it works. (unshelve, commit, switch back, delete shelved files, delete created changed list whin I shelved them)

I've tried to use the same method to transfer files between streams (parent->child) and failed miserably - when I tried to unshelve in another stream, I got an error "files not in map view", ok, I used "map to this stream" option, that worked, files unshelved (and deleted from shelve) but not resolved. But then I try to resolve, I get an strange error saying something doesn't exist and resolving failes for all files. Reverting just deleted all the changes, and I ended up loosing my changes this way. What am I doing wrong ??

Thanks.

#9 P4Matt

P4Matt

    Advanced Member

  • Members
  • PipPipPip
  • 1383 posts

Posted 10 April 2014 - 04:29 AM

That should work. Is the workspace you are using synced to head before you unshelve? Can you get me the error message?

I did a video recently showing how to do this using a branch specification, but it's equally applicable to working with streams. Take a quick look to see if it matches up with what you are doing.


https://www.youtube....h?v=-3T29bqEiW0

#10 SergeyN

SergeyN

    Member

  • Members
  • PipPip
  • 29 posts

Posted 10 April 2014 - 11:02 AM

Hi Matt,

Thanks for response. I did exactly what video showed. Don't remember the exact error, had to react quickly and didn't copy it. Will record it next time I see this. I also noticed there is a newer version of perforce tools, maybe I've hit some bugs in the older one. Will keep you posted about the issue.

#11 SergeyN

SergeyN

    Member

  • Members
  • PipPip
  • 29 posts

Posted 11 May 2014 - 12:44 PM

Hello,
So far shelving/unshelving worked good, as far as there is a direct relation of the type parent->child betwen streams. Now I have a situation parent, child1, child2, and I'm trying unshelve files from child2 to child1. Sounds pretty straightforward, however, no matter what I put into "map unshelved files" field I always get "No target file(s) in both client and branch view."
What am I doing wrong ?

Thanks,
Sergey.

#12 Mailman Sync

Mailman Sync

    Advanced Member

  • Maillist Aggregator
  • 2495 posts

Posted 11 May 2014 - 03:20 PM

Originally posted to the perforce-user mailing list by: Michael Mirman


In order to unshelve sibling's shelves, you need to define a branch and use -b option.
You are probably doing exactly that.
Then, if you get "No target file(s) in both client and branch view" it is more likely that your target is not mapped by your branch. (Sure, it is also possible that the client doesn't map the right stuff, but in my experience it is more often about the branch view.)

Unfortunately, I don't think there is a way to see what file unshelve is complaining about.
You have to look at all the files in the shelve and see how they are mapped.
Maybe you can use "p4 where" to see if the files are mapped.

--Michael Mirman
MathWorks, Inc.
3 Apple Hill Drive, Natick, MA 01760
508-647-7555


-----Original Message-----
From: perforce-user-bounces@perforce.com [mailto:perforce-user-bounces@perforce.com] On Behalf Of SergeyN
Sent: Sunday, May 11, 2014 8:45 AM
To: perforce-user@perforce.com
Subject: Re: [p4] submittable stream "import"s (or sharing between streams)


Posted on behalf of forum user 'SergeyN'.

Hello,
So far shelving/unshelving worked good, as far as there is a direct relation of
the type parent->child betwen streams. Now I have a situation parent, child1,
child2, and I'm trying unshelve files from child2 to child1. Sounds pretty
straightforward, however, no matter what I put into "map unshelved
files" field I always get "No target file(s) in both client and branch
view."
What am I doing wrong ?

Thanks,
Sergey.



--
Please click here to see the post in its original format:
  http://forums.perfor...between-streams
_______________________________________________
perforce-user mailing list  -  perforce-user@perforce.com
http://maillist.perf...o/perforce-user
_______________________________________________
perforce-user mailing list  -  perforce-user@perforce.com
http://maillist.perf...o/perforce-user


#13 Lennart Kjellén

Lennart Kjellén

    Advanced Member

  • Members
  • PipPipPip
  • 30 posts
  • LocationSweden

Posted 12 May 2014 - 05:56 AM

There must be a direct relationship between the streams to be able to unshelve to another stream. If you want to unshelve files from child1 to child2 using only the stream defininitions in "Map unshelved files" you will probably have to do it in two steps. You could temporarily reparent one of the streams to have a direct parent-child relation or you could move the shelve in two steps child1->main main->child2.





Also tagged with one or more of these keywords: stream, import

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users