On Wed, Aug 22, 2012 at 04:12:30PM -0700, Justin Lebar wrote:
> bholley and I have a script for doing this in git.  With thanks to
> glandium for telling us how to do it:
> 
> 0. Fetch the prtypes change, and merge it into your local master branch.
> 
> 1. Let your git checkout be directory |src|.
> 
> 2. Save the script at the end of this message as src/../convert.sh.
> 
> 3. For each branch B that you want to rebase over this change, do:
> 
> a. $ git checkout B.  Maybe make a note of the hash, so you can
> reset --hard in case something goes wrong.

If something goes wrong, you can check the reflog (git reflog show B)
and reset --hard to the old version of B that is not broken, most likely
B@{1}.

> b. Let P be the parent changeset of B.  This is the result of |git
> qparent|, if you have moz-git-tools [1] installed.  Otherwise it's
> |git merge-base B origin/master|, assuming that your branch is
> upstream from origin/master.
> 
> c. $ git filter-branch --tree-filter /absolute/path/to/convert.sh P^..
> 
> Note that it's "P^.." and not "P..".  This is because we want to
> convert P and also all of the commits in B (and the rev range P.. does
> not include P).  We're effectively applying the pr-types change to P
> and all changesets in B.
> 
> d. Let P' be the new parent changeset of B.  (The hash has changed,
> since we rewrote this commit.)
> 
> e. $ git rebase --onto master P'
> 
> Note that |git rebase master| will not do what you want, because
> that will try to move P' onto master.  But P' is already in master!
> If in doubt, do rebase --interactive, so you can see what git is going
> to try to do.
> 
> 
> The git apologist in me feels compelled to admit that this is, in
> fact, much more complicated than the equivalent task in hg.  :)

If you want to do the equivalent task from hg, you can:

a) git format-patch -o /some/where P..
b) patch the patches
c) git checkout master
d) git am /some/where/*

Mike
_______________________________________________
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform

Reply via email to