monotone-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Monotone-devel] branches


From: Nathaniel Smith
Subject: Re: [Monotone-devel] branches
Date: Fri, 11 Jan 2008 01:25:20 +0000
User-agent: Mutt/1.5.13 (2006-08-11)

On Fri, Jan 11, 2008 at 12:01:37PM +1100, Brian May wrote:
> Hello
> 
> Can I please check my understanding?
> 
> I have the following tree:
> 
> A1
> |\
> | \
> |  \
> A2  B2
> |   |
> A3  B3
> |
> A4
> |
> A5
> 
> 
> At this stage, I realize that the B changes are going to require more
> work then I initially anticipated. I would like to move B into a
> separate branch.
> 
> I think this is easy, just add another branch certificate to B2 and
> B3.
> 
> However, won't monotone still see two heads in the original branch?

Yes.

> If so, what is the correct way to proceed?

The best approach is probably a "double-revert".  First, revert the
changes in the mainline branch:

$ mtn co -r B3
$ mtn pluck -r B3 -r A1  # note that these are listed "backwards"
$ mtn ci -b mainline  # should be default, but just to be clear

Now we have:

  A1
  |\
  | \
  |  \
  A2  B2
  |   |
  A3  B3
  |   |
  A4  B4 (= A1)
  |
  A5

Then, reapply them into the new branch:

$ mtn co -r B4   # or just use the same workspace from above
$ mtn pluck -r A1 -r B3  # note that these are listed "forwards" now
$ mtn ci -b newbranch

  A1
  |\
  | \
  |  \
  A2  B2
  |   |
  A3  B3
  |   |
  A4  B4 (= A1)
  |     \
  A5     B5 (= B3)


This approach is a little more cumbersome than just issuing certs, but
it means that future merging will all work as expected -- in
particular, mainline still has two heads (A5 and B4), but when you
merge them then A5 will win.  Also, merging from mainline into your
branch will work as expected, and eventually you will be able to merge
from you branch into mainline, and that will also work as expected.

(The main alternative would be to revert the B stuff on mainline, but
then just use B3 as the start of your branch -- if you did this, then
the first time you merged mainline and your branch, the merger would
happily say that the new reversion in B4 won over the changes in B3
and clobber your work.)

Cheers,
-- Nathaniel




reply via email to

[Prev in Thread] Current Thread [Next in Thread]