Support forums : The Future

How branching and core work

The future of this project but not in a "I want a pony" sort of way. This is all about everything meta about Quam Plures. The general direction, the support tools, stuff like that.

Moderator: Dracones

How branching and core work

Postby EdB » Fri Aug 19, 2011 10:09 pm

* I had a book here that I figured was way too long. So I'm gonna try the "no scroll bar" approach instead.

Core is the product right now in LP.
A branch is a copy of core with changes.
There can be many branches that all have different changes.
Branches can be recommended for merging into core.
A branch has to be approved to be merged (core team does that).
Merging a branch is the only way core gets changed (gatekeepers team does that).

Hopefully that sort of explains why it is possible to see a branch that fixes a caption problem then see other branches that do not have that solution. In fact, any problem in core that is fixed in one branch will NOT be fixed elsewhere until the branch is approved and merged. Oh and just because a branch gets merged doesn't mean all other branches magically get the new code. The branch author has to apply the new core to their branch(es).

No scroll bar :D
EdB
Dracone
User avatar
 
Posts: 2072
Joined: Sun Nov 22, 2009 7:20 am
Location: Maricopa Arizona

Re: How branching and core work

Postby EdB » Fri Aug 19, 2011 10:26 pm

A great example might go like this. There is a spelling error AND a functional problem with ... creating a blog. Someone creates a branch to fix the spelling error, and someone else creates a branch to fix the functional problem. While discussing the solution to the flaw, someone else comes up with an improvement to blog creations.

When each of those branches get to merge they won't have the changes in the other one. In other words the spelling branch will still have the flaw and won't have the feature, and the flaw branch will still have the spelling errors and won't have the feature, and the feature branch will still have the spelling error and the flaw. After one gets merged the others don't automagically get the fix - the branch authors have to do that.

Eventually core gets all 3, and the next branch created has no spelling problem and no flaw in blog creation and a new feature.

Is this helping?
EdB
Dracone
User avatar
 
Posts: 2072
Joined: Sun Nov 22, 2009 7:20 am
Location: Maricopa Arizona

Re: How branching and core work

Postby Kimberly » Sat Aug 20, 2011 3:02 am

I am begging to see this more clearly. I am guessing that the review process helps to prevent two different branches from changing the same code at the same time. I take it the revisions keep up with what code was changed and only inserts (merges) that bit of code and nothing else. That would prevent one revision from overwriting changes another revision made. Is that correct? What if you have a lower revision pending being merged that changes the same code as a higher revision that is being merged. If you merge the higher revision first, would the lower revision still overwrite that code?

If I want to create a branch that fixes something, how do I start? Do I grab the core and work off of that? I tried doing something once but had a bit of trouble with it.
Kimberly
Dracone
User avatar
 
Posts: 842
Joined: Mon Jul 19, 2010 4:44 pm

Re: How branching and core work

Postby EdB » Sat Aug 20, 2011 4:53 am

Kimberly wrote:I am begging to see this more clearly. I am guessing that the review process helps to prevent two different branches from changing the same code at the same time.
Reviewing is supposed to focus on the nature and quality of the coding effort. The idea of two branches playing in the same section is more a part of merging. Only one branch can be merged at a time, so if 2 are tweaking the same bits somehow LP figures it out.

Plus by the way this is why a branch author really needs to keep their branch up to date. When something gets merged into core, each branch author should update their branch(es) with the new core. That way conflicts happen at the branch level, and the branch author owns fixing them. Saves a burden on gatekeepers is the thing.

Kimberly wrote:I take it the revisions keep up with what code was changed and only inserts (merges) that bit of code and nothing else. That would prevent one revision from overwriting changes another revision made. Is that correct?
Yes, correct. Also LP knows stuff like "your branch was born at core-10 and core is now at core-20 so your branch isn't allowed to undo 10 things". Plus see the plus above.

Kimberly wrote:What if you have a lower revision pending being merged that changes the same code as a higher revision that is being merged. If you merge the higher revision first, would the lower revision still overwrite that code?
If I follow you, no it would not. Somehow LP is smart enough to figure out "this branch started 27 changes ago and I'll be damned if I'll undo 27 things just because this branch author was too lazy to keep his/her shit up to date". It then merges in only the changes made to that branch relative to the point the branch was born.

And this is seriously why branch authors MUST keep their shit up to date. Too many merges into core might result in a situation where LP says "this branch you just told me to merge is so old I have no idea what y'all want me to do with it so fuck it I give up I ain't doin' nothing". It says it politely of course, but it has happened. Let something get too old and the odds of it not being mergable keep going up and up and up.

So core always wins. An old branch won't undo merged changes.

Kimberly wrote:If I want to create a branch that fixes something, how do I start? Do I grab the core and work off of that? I tried doing something once but had a bit of trouble with it.
Yes, exactly. I do it with bazaar explorer, Tblue is into cli. Either way it's all the same.

  • Create a branch from core on your computer with a smart name.
  • Push it back to LP so LP now has "core with a new name".
  • (for me I unbind it from core then rebind it to the place I just pushed it)
  • Make your changes and commit them to your branch, both locally and to LP.
  • Change commit change commit until you are satisfied the branch is everything and a tin of biscuits.
  • On LP you tell it you want that branch in the review process via the "propose for merging" text link on the branch's page.

It's actually pretty cool. I dig on how the whole thing works even though every now and then a hole big enough to drive a truck through show up. And really stupid shit can happen. Generally though if we make a branch and keep it up to date with core and get it into the merge process in a reasonable time frame then nothing bad will happen.
EdB
Dracone
User avatar
 
Posts: 2072
Joined: Sun Nov 22, 2009 7:20 am
Location: Maricopa Arizona

Re: How branching and core work

Postby Kimberly » Sun Aug 28, 2011 10:52 pm

Trying to create a branch, following the guide on using Bazaar Explorer for Windows. Get this error message when trying to push, have pageant running with keys.

bzr: ERROR: Cannot lock LockDir(bzr+ssh://bazaar.launchpad.net/%2Bbranc ... ranch/lock): Transport operation not possible: readonly transport

I seem to recall that I had trouble with the push thing last time I tried this.
Kimberly
Dracone
User avatar
 
Posts: 842
Joined: Mon Jul 19, 2010 4:44 pm

Re: How branching and core work

Postby EdB » Mon Aug 29, 2011 12:43 am

in the field where you push it to ... heck lemme open one up.

Using bazaar, to branch I have "lp:quam-plures" in the source field, which puts quam-plures as the destination folder name. No good so I change that to my_branch and click go then get yelled at because I didn't sign in with the stupid Pageant thing. So I sign in and retry. And wait. And wait. I'm actually doing this so I don't drop a brain fart in your lap. That'd be way rude eh?

Okay yay finally done. I close the "create" thing then right-click the new folder to get to bazaar explorer. From there I select "Push", which is finally what you wanted to know about. In the location field I type one of the following bits:
lp:~edb/quam-plures/my_branch
lp:~quam-plures-core/quam-plures/my_branch
The first means only I can add to the branch (but anyone can get a copy), the second means others with permission can add to the branch. Anyway as soon as I type it I select the whole string and copy it to the clipboard because I'll need it soon. I click OK and it only takes a little bit to make the branch exist on LP. click close.

Now the weird stuff. Click "Work" and select "unbind" then close the thing that happens really fast. Click "Work" again and select "bind" and paste in the string you just typed and copied, then click OK. Again very fast, then close it.

NOW both you and launchpad have the branch, which is an exact copy of core at this moment. The unbind/bind thing means that now bazaar thinks when you commit changes you will want to commit them to the copy LP has - not core (which won't work).

Hope it helps :)
EdB
Dracone
User avatar
 
Posts: 2072
Joined: Sun Nov 22, 2009 7:20 am
Location: Maricopa Arizona

Re: How branching and core work

Postby Kimberly » Tue Aug 30, 2011 1:57 am

Just to be sure I am working with a copy of the core, how do I grab a copy of the core to use with Bazaar? I grabbed something but I probably should know for sure that I have the core before I start.
Kimberly
Dracone
User avatar
 
Posts: 842
Joined: Mon Jul 19, 2010 4:44 pm

Re: How branching and core work

Postby EdB » Tue Aug 30, 2011 2:36 am

Using bazaar explorer, click on "Log". You will get a popup that shows revs and messages. It should show 7618 with a message that matches what I see at https://code.launchpad.net/~quam-plures ... ures/trunk

The problem is that your branch will get new numbers and comments that won't align with core numbers and comments. So once you know you are starting correctly it'll be a bit trickier to ensure you're in sync down the road. If/when that needs to happen we'll figure out how :)

BTW in "Log" click on the little circles if they have a + sign in them. You will be able to see every commit along the way for each branch that got into core. Clicking on the circle for 7618 kinda tells me the branch that became 7618 was born at 7612 and had 3 commits made to it. The last one was "core to 7614", which is kinda shown with a line. I merged core to my branch then committed the change, and LP knows all that stuff. And bazaar knows how to display it.
EdB
Dracone
User avatar
 
Posts: 2072
Joined: Sun Nov 22, 2009 7:20 am
Location: Maricopa Arizona

Re: How branching and core work

Postby EdB » Thu Sep 01, 2011 9:21 pm

@Kimberly: core has seen a lot of activity lately. It therefore behooves you to do either a merge or update.

If your branch is still bound to core then all you need is an update. If you bound it to where you pushed it then you need to do a merge. In either case SAVE A COPY OF YOUR BRANCH ON YOUR COMPUTER AWAY FROM WHERE YOU UPDATE/MERGE. The risk is "conflict" which I still don't have a good handle on resolving. Each time lately we've had a few merges I have to update all my branches, and I always end up with conflicts somewhere.

A conflict example: "uncripple file manager" gets rid of all cases of "if( $popup whatever ) ..." which means it also gets rid of some tabs in the next few lines. Well when the "more manual links" branch merged in I had a conflict because my branch said a line is minus one tab but new core said that line has the other tab and a new bit of code. All it does is say "conflict", creates 3 files that don't help me at all, and a headache before I even start trying to figure it out.

Anyway just a heads up. To get the branch merged into core one day it needs to be "current core plus your changes" else the burden of conflict falls on the gatekeepers.
EdB
Dracone
User avatar
 
Posts: 2072
Joined: Sun Nov 22, 2009 7:20 am
Location: Maricopa Arizona

Re: How branching and core work

Postby Kimberly » Thu Sep 01, 2011 10:01 pm

Thanks for the information. I have yet to push anything and will update what I have locally.
Kimberly
Dracone
User avatar
 
Posts: 842
Joined: Mon Jul 19, 2010 4:44 pm


Return to The Future

Who is online

Users browsing this forum: No registered users and 4 guests

cron