From 5eab58ee908e2ce7b24e2785096dd3d4560f5597 Mon Sep 17 00:00:00 2001 From: Andrii Shyshkalov Date: Wed, 7 Feb 2018 00:44:28 +0000 Subject: [PATCH] Revert "bot_update: allow rebasing the patch onto an older revision." MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit fa573785df6f584c03bb0836e8376ffd167de727. Reason for revert: broke CQ on branches. Example: https://ci.chromium.org/p/chromium/builders/luci.chromium.try/chromium_presubmit/28220 Original change's description: > bot_update: allow rebasing the patch onto an older revision. > > When applying a rebase, we normally go from an older base commit to a newer one. > > A ---- B ---- C ---- D -origin/master > \ > E -branch > > In this case, `git rebase D` would certainly work as expected. However, > writing `git rebase B` would NOT get us to the following state: > > A ---- B ---- C ---- D -origin/master > \ > E' -branch > > In fact, it would have no effect. > > This article http://matthew-brett.github.io/pydagogue/rebase_without_tears.html > explains the general invocation as > > `git rebase --onto ` > > If you don’t specify --onto, defaults to > > So what's happening is, by writing `git rebase B` we're rebasing onto B, > excluding commits that are in B. Commit C is not "in" B so it is kept and we're > back to the starting point. > > So I suggest to change the invocation to `git rebase --onto B origin/master`, > which rebases onto B, excluding commits that are in origin/master. This works > more generally and allows rebasing "backwards". > > Bug: None > Change-Id: I68e4d805811530b585550bc75099354fef4e9c15 > Reviewed-on: https://chromium-review.googlesource.com/904004 > Reviewed-by: Andrii Shyshkalov > Commit-Queue: Oleh Prypin TBR=iannucci@chromium.org,tandrii@chromium.org,oprypin@chromium.org Change-Id: I7243641d84428bf4504ee798bf31ad0afbfd4865 No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: None Reviewed-on: https://chromium-review.googlesource.com/905862 Commit-Queue: Andrii Shyshkalov Reviewed-by: Andrii Shyshkalov --- recipes/recipe_modules/bot_update/resources/bot_update.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/recipe_modules/bot_update/resources/bot_update.py b/recipes/recipe_modules/bot_update/resources/bot_update.py index a76562f46..0efe82a16 100755 --- a/recipes/recipe_modules/bot_update/resources/bot_update.py +++ b/recipes/recipe_modules/bot_update/resources/bot_update.py @@ -784,7 +784,7 @@ def apply_gerrit_ref(gerrit_repo, gerrit_ref, root, gerrit_reset, try: git('-c', 'user.name=chrome-bot', '-c', 'user.email=chrome-bot@chromium.org', - 'rebase', '--onto', base_rev, 'origin/master', cwd=root) + 'rebase', base_rev, cwd=root) except SubprocessFailed: # Abort the rebase since there were failures. git('rebase', '--abort', cwd=root)