We had an issue with the Gaia repository getting slightly corrupted yesterday.  
In the process of fixing the gaia repository, the history for a couple of 
commits had to be revised.  A reminder: PLEASE DON'T MERGE TO FIX HISTORY.  
Simple rebasing will likely also break it again.  This will break the 
repository again.

You will more than likely fit into one of three cases.

==== Case 1 If you haven't pulled the revised history yet ====
If the latest commit on your master branch is 
c69d46215195d53c20b777512357982b0b23ac3f or older, you are lucky and are not 
affected by this issue.  I verified that with a local copy of a repository that 
has a latest commit older than c69d46215195d53c20b777512357982b0b23ac3f will 
update cleanly 

==== Case 2 you have the affected history in your repository but have no local 
changes to keep ====
If you only keep Gaia around to build the rest of B2G, or have a clone of Gaia 
that you haven't started working on yet, please delete and reclone it, it's the 
easiest thing to do here.  If your gaia is managed by repo, you will want to:

1) rm -rf .repo/projects/gaia.git
2) sed -i "" -e '/gaia/d' .repo/project.list
3) ./repo sync

NOTE: Releng has set up a new mirror, so nightly builds can happen

==== Case 3: you have the affected history and local changes that matter ====
I *highly* recommend taking a backup copy of your gaia repository before doing 
anything in this case.

If you manually clone gaia, "tar cf gaia-backup.tar gaia" will do a complete 
backup for you.  If you use repo sync or config.sh to manage gaia, you need to 
do a little more because of the funny stuff that repo does.  In your top level 
B2G directory, you'll want to back up the repository completely by running: 
"tar cf gaia-backup.tar gaia .repo/projects/gaia.git"

I cannot emphasize enough that you should take a backup before you try anything.

I've tested the following procedure with a single short lived branch that forks 
from master, has changes then merges back in with no further work done on it.  
If you have branches that pull from other branches, you'll have to cascade this 
process.  My assumption is that your local branching is very complicated, 
you'll know your environment better than I will.

1) Fetch the new diffs (don't do "git pull" as that automatically merges):

git fetch origin # may be 'b2g' if you use repo
# If you see something similar to " + 030bd8c...2465ff1 master     -> 
origin/master  (forced update)", you need to fix your branches

2) Rename your old master and topic branch and make a new master branch

git branch -m master old-master
git branch -m topic old-topic
git checkout -t origin/master -b master

3) create new topic branch for each of the branches that you want to move to 
the new master branch

git checkout -t origin/master -b topic

4) Find the commits that you care about:

git log old-master..old-topic --pretty=oneline --topo-order --reverse  
# this sorts by structure instead of date, and presents the commits in order to 
cherry-pick

5) Cherry pick those changes from the old-topic branch to the new topic branch:

git cherry-pick <commit_in_order>
# If your cherry pick isn't needed, you should see "nothing to commit (working 
directory clean)" in the output

6) Repeat step 5 for all the commits in the log for the branches that you care 
about.  Repeat steps 3-6 for each branch that you'd like to move over to the 
new gaia history.

7) When you're done, you can either delete your github repository and restart, 
or you could force push your changes to your remote branches.

AGAIN, PLEASE DO NOT USE MERGE OR BASIC REBASING TO FIX YOUR FETCHING ISSUES.  
If you are using either of these tools, please be careful that you aren't 
bringing back old history.  You'll end up bring the breakage back

Before you push to your github account, make sure that what you're pushing is 
actually what you want.  You can preview a push using git push -n if needed.  
That will give you a range of commits you can use with git log to preview 
what's going to be pushed for each branch.  As with anything relating to 
VCS/Git, I am sure there are different, better and faster ways to do this.  If 
you have a slick method for doing this, please do reply with it to this email 
address.  We did not do this on a whim and really appreciate your understanding 
in the matter.  We have a #git channel on IRC.mozilla.org, #git on freenode.  
There are also lots of people in #b2g and #gaia that I am sure would be able to 
help out if you need help. 

Thanks for your understanding and patience,

John Ford
_______________________________________________
dev-b2g mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-b2g

Reply via email to