Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(343)

Issue 280023004: Don't have checkout.py's git apply_patch fail when files don't match (Closed)

Created:
6 years, 7 months ago by hinoka
Modified:
6 years, 7 months ago
Reviewers:
iannucci, M-A Ruel
CC:
chromium-reviews, Dirk Pranke, cmp-cc_chromium.org, iannucci+depot_tools_chromium.org, ilevy-cc_chromium.org, M-A Ruel
Visibility:
Public.

Description

Don't have checkout.py's git apply_patch fail when files don't match The contract for apply_patch is that it applies a patch on top of something, and it either all applies cleanly or it fails. The something that is applied on can be as clean or dirty without having apply_patch judge. The particular failure condition was that we want to patch DEPS first (into the index), do some stuff, then apply another patch on top of that. Apply_patch was failing because it saw that there was a DEPS in the index already when it wasn't expecting one. A fix that could've also worked is to run git diff --staged before applying the patch, then subtract that list from found_files, but it still gets tricky then because what if you want to apply an independent patch on top of an already patched index? Because apply_patch shouldn't need to be in the business of keeping track of what the state of everything is like before and after a patch (That's up to the patch application), the better thing would be to remove the assert alltogether, and rely on "git apply" to complain if something doesn't apply. BUG=370503 TBR=iannucci Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=269526

Patch Set 1 #

Total comments: 2
Unified diffs Side-by-side diffs Delta from patch set Stats (+8 lines, -4 lines) Patch
M checkout.py View 1 chunk +8 lines, -4 lines 2 comments Download

Messages

Total messages: 6 (0 generated)
hinoka
Tested with: apply_issue --issue 273953002 --patchset 170001 --blacklist device/bluetooth/bluetooth_adapter_chromeos.cc apply_issue --issue 273953002 --patchset 170001 --whitelist ...
6 years, 7 months ago (2014-05-10 04:35:41 UTC) #1
hinoka
The CQ bit was checked by hinoka@chromium.org
6 years, 7 months ago (2014-05-10 04:39:11 UTC) #2
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/hinoka@chromium.org/280023004/1
6 years, 7 months ago (2014-05-10 04:40:01 UTC) #3
commit-bot: I haz the power
Change committed as 269526
6 years, 7 months ago (2014-05-10 04:42:49 UTC) #4
iannucci
lgtm
6 years, 7 months ago (2014-05-10 21:47:52 UTC) #5
M-A Ruel
6 years, 7 months ago (2014-05-12 12:35:54 UTC) #6
Message was sent while issue was closed.
https://codereview.chromium.org/280023004/diff/1/checkout.py
File checkout.py (right):

https://codereview.chromium.org/280023004/diff/1/checkout.py#newcode714
checkout.py:714: print 'Found extra files: %r' % (extra_files,)
I disagree that checkout.py should ever "print" at all. It's the wrong layer.

It could have easily been fixed by noting what was staged first, before applying
patches, then using this information to not consider them. Or remove the assert
completely, it was more as an internal debugging tool.

https://codereview.chromium.org/280023004/diff/1/checkout.py#newcode718
checkout.py:718: 
One superfluous line.

Powered by Google App Engine
This is Rietveld 408576698