Jump to content


Best practices/how do you do it: blocking changes from integration

integrate branch

  • Please log in to reply
3 replies to this topic

#1 Jeff Varga

Jeff Varga

    Member

  • Members
  • PipPip
  • 15 posts

Posted 05 October 2018 - 07:03 PM

We maintain a relatively sane branch structure of mainline, legacy mainline, release branches.  In general, all changes "flow downstream" from release branches back into their parent and eventually into the main trunk stream.  There are occasionally spot patches that will get applied to a release branch or legacy mainline that we don't want to "flow".

Is there a good mechanism to, or does anyone have a good process for marking certain changes as "don't allow to be merged?"  This scenario is stopping us from implementing automatic merges from release back into main -- instead we rely on individual engineers to do their own integrations which is fraught with peril and angry looks.

#2 Sambwise

Sambwise

    Advanced Member

  • Members
  • PipPipPip
  • 664 posts

Posted 05 October 2018 - 09:07 PM

Ignore them:

p4 merge --from legacy @=1234
p4 resolve -ay
p4 submit

When you run the resolve, you'll see the message "ignored" -- this means that the content from the source (@=1234) is being ignored.  When you submit, the fact that you did the merge and ignored the content is recorded.  Future merges will disregard those changes.

If you're curious about the mechanics of this, see the section "Tracking ignored edits" in this white paper: https://swarm.worksh...ase Picking.pdf

Quote

An "ignored" integration record creates persistent divergence between two files -- in other words, it specifies that there are some changes that belong in one branch of a file but not another, and it requests that future merge operations preserve that relationship for those changes while continuing to propagate newer changes.


#3 Jeff Varga

Jeff Varga

    Member

  • Members
  • PipPip
  • 15 posts

Posted 05 October 2018 - 09:29 PM

I've done that in one-off situations, but asking my engineers to do it has not worked out (requires they have an instance of the parent stream, which also requires they're aware of the parent stream).  Was hoping that there was a better, global way.  Maybe a feature request for change description metadata like the stream "Options:" such as "Options: nomerge"?

#4 Sambwise

Sambwise

    Advanced Member

  • Members
  • PipPipPip
  • 664 posts

Posted 05 October 2018 - 09:59 PM

It's not hard at all to automate the task of "ignoring" a change into its parent -- maybe just write a commit trigger that looks for a description keyword like "#ignore" and then kicks off an ignore operation?  That way the user doesn't have to figure anything out beyond "this change should not go back to the parent".

# Get stream of submitting client, get parent of that stream, switch to it.
p4 -Ztag -F %Stream% client -o $CLIENT | p4 -x - -Ztag -F %Parent% stream -o | p4 -x - switch
# Merge submitted change from stream of submitting client.
p4 -Ztag -F "merge --from %Stream% @=$CHANGE" client -o $CLIENT | p4 -x - run
# Ignore and submit.
p4 resolve -ay
p4 submit -d "Ignoring $CHANGE"







Also tagged with one or more of these keywords: integrate, branch

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users