The tests here were failing because a couple of changes we made to the listings were not in sync witht he commit history of the branch in the book-example repo. Here's how I fixed things at a high level:
first, determine that the cause was due to the commits getting out of sync. I saw the error was that the Fts were failing when the book said they should be passing, and then I see it's at a part of the book where we say "now remove the early return", and I realised we didn't have a commit where we remove the early return.
I then realised we didn't have a commit for when we added the early return either! that's where we had the commit listing as ch13l???.
so I first added a commit for when we introduce the early return. I did this by:
checkout the chatper 13 branch
reset --hard to the commit just before where we want to add the early return code
add the early return, and make a new commit for it. I put --ch13l030-3-- at the end of the commit message
update the book to show this "commit id" (i also tweaked the comment message while i was at it)
git cherry-pick all the rest of the commits from the old commit history
that procedure, reset --hard <commit N> + commit <new commit N+1> + git cherry-pick <old-commit-N+1...end> is one i use quite often. it's a bit like a rebase, rewriting history.
Then I followed a similar procedure to introduce an extra commit for when we remove the early return as well. I added that to the book chapter text too.
Finally I noticed a problem with applying one of the later commits, it couldn't apply the commit patch successfully. I managed to figure out that was because of the change where we swapped the order of form.save() and form.full_clean(). SO for that I did a git rebase --interactive and marked the commit where we introduce that form.full_clean() for editing, and changed it to match the book.
that gave me a conflict at the end of the rebase, which is expected, and so i fixed that..... i'm aware this explanation is getting a little abstract probably. but i thought it was good to write it down.
happy to go over this sort of procedure in detail with you one of these days! there just never seems to be enough timeeeeeeee. but, you have to invest time to make time! so.
The tests here were failing because a couple of changes we made to the listings were not in sync witht he commit history of the branch in the
book-example
repo. Here's how I fixed things at a high level:ch13l???
.reset --hard
to the commit just before where we want to add the early return code--ch13l030-3--
at the end of the commit messagegit cherry-pick
all the rest of the commits from the old commit historythat procedure,
reset --hard <commit N>
+commit <new commit N+1>
+git cherry-pick <old-commit-N+1...end>
is one i use quite often. it's a bit like a rebase, rewriting history.Then I followed a similar procedure to introduce an extra commit for when we remove the early return as well. I added that to the book chapter text too.
Finally I noticed a problem with applying one of the later commits, it couldn't apply the commit patch successfully. I managed to figure out that was because of the change where we swapped the order of
form.save()
andform.full_clean()
. SO for that I did agit rebase --interactive
and marked the commit where we introduce that form.full_clean() for editing, and changed it to match the book.that gave me a conflict at the end of the rebase, which is expected, and so i fixed that..... i'm aware this explanation is getting a little abstract probably. but i thought it was good to write it down.
happy to go over this sort of procedure in detail with you one of these days! there just never seems to be enough timeeeeeeee. but, you have to invest time to make time! so.