[p4] Branch rename question

Rick Macdonald rickmacd at shaw.ca
Tue Jan 30 21:21:22 PST 2007


This is a resend; the first wasn't accepted by the mailing list (I sent 
it from the wrong account)

Smith, Jeff wrote:
> We have a situation that requires us to rename a branch and then use the
> old name for a new branch.  No comments on ways to avoid this are
> necessary :-)  We are aware of what has led to this and are taking steps
> to avoid it in the future.
>  
> What I would like is any experiences solving this problem.  The best
> solution is one which makes looking through history and performing
> future integrations as clean as possible.
>  
> Problem: Given 2 branches (BR1 and BR2), we need BR2 renamed to BR3 and
> BR1 branched to create a new BR2.  Note that the existing BR2 was
> created from BR1 at some point in the past.
>  
> Solution 1:
> integrate BR2->B3
> integrate BR1->BR2 (accepting source)
>  
> Solution 2:
> integrate BR2->B3
> delete BR2
> integrate BR1->BR2
>  
> Solution 3:
> integrate BR2->B3
> obliterate BR2
> integrate BR1->BR2
>  
> Solution 4:
> use checkpoint surgery to rename BR2->BR3
> integrate BR1->BR2
>  
> It looks like solution 4 is the cleanest but also the most risky.  I am
> interested in comments from anyone who has been through a similar
> exercise and their experiences with any solutions they've used.

I'd say Solution 2 is the one, with a few command line flags added. See
Laura's book, page 280. She calls this "Reparenting a branch".

After branching BR2 -> BR3, you are ready for the reparenting:

p4 delete BR2
p4 submit
p4 integ -f -d -i BR1 BR2
p4 submit

Her point is that (her words) "This makes a clean break in file
histories and makes future integrations easier", which is what you asked
for.

...RickM...



More information about the perforce-user mailing list