Always fetch before cherry-picking changes
We cannot cherry-pick changes without having something to cherry-pick
them on top of.
Change-Id: Iee44bc0c824f6db6a1578d9dfcaf6d143ee7f6d2
Reviewed-on: https://gn-review.googlesource.com/1300
Reviewed-by: Scott Graham <scottmg@chromium.org>
diff --git a/infra/recipes/gn.expected/cq_linux.json b/infra/recipes/gn.expected/cq_linux.json
index 06ec6c6..306e218 100644
--- a/infra/recipes/gn.expected/cq_linux.json
+++ b/infra/recipes/gn.expected/cq_linux.json
@@ -19,12 +19,39 @@
"cmd": [
"git",
"fetch",
+ "https://gn.googlesource.com/gn",
+ "refs/heads/master"
+ ],
+ "cwd": "[START_DIR]/gn",
+ "infra_step": true,
+ "name": "git.fetch",
+ "~followup_annotations": [
+ "@@@STEP_NEST_LEVEL@1@@@"
+ ]
+ },
+ {
+ "cmd": [
+ "git",
+ "checkout",
+ "FETCH_HEAD"
+ ],
+ "cwd": "[START_DIR]/gn",
+ "infra_step": true,
+ "name": "git.checkout",
+ "~followup_annotations": [
+ "@@@STEP_NEST_LEVEL@1@@@"
+ ]
+ },
+ {
+ "cmd": [
+ "git",
+ "fetch",
"https://gn-review.googlesource.com/gn",
"refs/changes/00/1000/1"
],
"cwd": "[START_DIR]/gn",
"infra_step": true,
- "name": "git.fetch",
+ "name": "git.fetch 1000/1",
"~followup_annotations": [
"@@@STEP_NEST_LEVEL@1@@@"
]
@@ -37,7 +64,7 @@
],
"cwd": "[START_DIR]/gn",
"infra_step": true,
- "name": "git.cherry-pick",
+ "name": "git.cherry-pick 1000/1",
"~followup_annotations": [
"@@@STEP_NEST_LEVEL@1@@@"
]
diff --git a/infra/recipes/gn.expected/cq_mac.json b/infra/recipes/gn.expected/cq_mac.json
index 06ec6c6..306e218 100644
--- a/infra/recipes/gn.expected/cq_mac.json
+++ b/infra/recipes/gn.expected/cq_mac.json
@@ -19,12 +19,39 @@
"cmd": [
"git",
"fetch",
+ "https://gn.googlesource.com/gn",
+ "refs/heads/master"
+ ],
+ "cwd": "[START_DIR]/gn",
+ "infra_step": true,
+ "name": "git.fetch",
+ "~followup_annotations": [
+ "@@@STEP_NEST_LEVEL@1@@@"
+ ]
+ },
+ {
+ "cmd": [
+ "git",
+ "checkout",
+ "FETCH_HEAD"
+ ],
+ "cwd": "[START_DIR]/gn",
+ "infra_step": true,
+ "name": "git.checkout",
+ "~followup_annotations": [
+ "@@@STEP_NEST_LEVEL@1@@@"
+ ]
+ },
+ {
+ "cmd": [
+ "git",
+ "fetch",
"https://gn-review.googlesource.com/gn",
"refs/changes/00/1000/1"
],
"cwd": "[START_DIR]/gn",
"infra_step": true,
- "name": "git.fetch",
+ "name": "git.fetch 1000/1",
"~followup_annotations": [
"@@@STEP_NEST_LEVEL@1@@@"
]
@@ -37,7 +64,7 @@
],
"cwd": "[START_DIR]/gn",
"infra_step": true,
- "name": "git.cherry-pick",
+ "name": "git.cherry-pick 1000/1",
"~followup_annotations": [
"@@@STEP_NEST_LEVEL@1@@@"
]
diff --git a/infra/recipes/gn.expected/cq_win.json b/infra/recipes/gn.expected/cq_win.json
index 0bd3b48..124a4a7 100644
--- a/infra/recipes/gn.expected/cq_win.json
+++ b/infra/recipes/gn.expected/cq_win.json
@@ -19,12 +19,39 @@
"cmd": [
"git",
"fetch",
+ "https://gn.googlesource.com/gn",
+ "refs/heads/master"
+ ],
+ "cwd": "[START_DIR]\\gn",
+ "infra_step": true,
+ "name": "git.fetch",
+ "~followup_annotations": [
+ "@@@STEP_NEST_LEVEL@1@@@"
+ ]
+ },
+ {
+ "cmd": [
+ "git",
+ "checkout",
+ "FETCH_HEAD"
+ ],
+ "cwd": "[START_DIR]\\gn",
+ "infra_step": true,
+ "name": "git.checkout",
+ "~followup_annotations": [
+ "@@@STEP_NEST_LEVEL@1@@@"
+ ]
+ },
+ {
+ "cmd": [
+ "git",
+ "fetch",
"https://gn-review.googlesource.com/gn",
"refs/changes/00/1000/1"
],
"cwd": "[START_DIR]\\gn",
"infra_step": true,
- "name": "git.fetch",
+ "name": "git.fetch 1000/1",
"~followup_annotations": [
"@@@STEP_NEST_LEVEL@1@@@"
]
@@ -37,7 +64,7 @@
],
"cwd": "[START_DIR]\\gn",
"infra_step": true,
- "name": "git.cherry-pick",
+ "name": "git.cherry-pick 1000/1",
"~followup_annotations": [
"@@@STEP_NEST_LEVEL@1@@@"
]
diff --git a/infra/recipes/gn.py b/infra/recipes/gn.py
index c27d851..33012fb 100644
--- a/infra/recipes/gn.py
+++ b/infra/recipes/gn.py
@@ -23,27 +23,25 @@
with api.context(cwd=src_dir):
build_input = api.buildbucket.build_input
- if build_input.gerrit_changes:
- for change in build_input.gerrit_changes:
- api.step('fetch', [
- 'git', 'fetch',
- 'https://%s/gn' % change.host,
- 'refs/changes/%s/%s/%s' %
- (str(change.change)[-2:], change.change, change.patchset)
- ])
- api.step('cherry-pick', ['git', 'cherry-pick', 'FETCH_HEAD'])
- else:
- ref = (
- build_input.gitiles_commit.id
- if build_input.gitiles_commit else 'refs/heads/master')
- api.step('fetch',
- ['git', 'fetch', 'https://gn.googlesource.com/gn', ref])
- api.step('checkout', ['git', 'checkout', 'FETCH_HEAD'])
+ ref = (
+ build_input.gitiles_commit.id
+ if build_input.gitiles_commit else 'refs/heads/master')
+ api.step('fetch', ['git', 'fetch', 'https://gn.googlesource.com/gn', ref])
+ api.step('checkout', ['git', 'checkout', 'FETCH_HEAD'])
+ for change in build_input.gerrit_changes:
+ api.step('fetch %s/%s' % (change.change, change.patchset), [
+ 'git', 'fetch',
+ 'https://%s/gn' % change.host,
+ 'refs/changes/%s/%s/%s' %
+ (str(change.change)[-2:], change.change, change.patchset)
+ ])
+ api.step('cherry-pick %s/%s' % (change.change, change.patchset),
+ ['git', 'cherry-pick', 'FETCH_HEAD'])
with api.context(infra_steps=True):
cipd_dir = api.path['start_dir'].join('cipd')
packages = {
- 'infra/ninja/${platform}': 'version:1.8.2',
+ 'infra/ninja/${platform}': 'version:1.8.2',
}
api.cipd.ensure(cipd_dir, packages)