Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
C
Chromium_Depot_tools
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Linshizhi
Chromium_Depot_tools
Commits
2250d5b3
Commit
2250d5b3
authored
Aug 19, 2016
by
rmistry
Committed by
Commit bot
Aug 19, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add apply_gerrit_ref to bot_update api.
BUG=skia:5627 Review-Url:
https://codereview.chromium.org/2249983004
parent
2cbf79f3
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
105 additions
and
12 deletions
+105
-12
api.py
recipe_modules/bot_update/api.py
+21
-0
apply_gerrit_ref.json
...modules/bot_update/example.expected/apply_gerrit_ref.json
+26
-0
example.py
recipe_modules/bot_update/example.py
+25
-12
apply_gerrit.py
recipe_modules/bot_update/resources/apply_gerrit.py
+33
-0
No files found.
recipe_modules/bot_update/api.py
View file @
2250d5b3
...
...
@@ -53,6 +53,27 @@ class BotUpdateApi(recipe_api.RecipeApi):
def
last_returned_properties
(
self
):
return
self
.
_last_returned_properties
# DO NOT USE.
# The below method will be removed after there are no more callers of
# tryserver.maybe_apply_issue (skbug.com/5588).
def
apply_gerrit_ref
(
self
,
root
,
gerrit_no_reset
=
False
,
gerrit_rebase_patch_ref
=
True
,
**
kwargs
):
apply_gerrit_path
=
self
.
resource
(
'apply_gerrit.py'
)
kwargs
.
setdefault
(
'infra_step'
,
True
)
kwargs
.
setdefault
(
'env'
,
{})
.
setdefault
(
'PATH'
,
'
%(PATH)
s'
)
kwargs
[
'env'
][
'PATH'
]
=
self
.
m
.
path
.
pathsep
.
join
([
kwargs
[
'env'
][
'PATH'
],
str
(
self
.
_module
.
PACKAGE_REPO_ROOT
)])
cmd
=
[
'--gerrit_repo'
,
self
.
_repository
,
'--gerrit_ref'
,
self
.
_gerrit_ref
or
''
,
'--root'
,
str
(
root
),
]
if
gerrit_no_reset
:
cmd
.
append
(
'--gerrit_no_reset'
)
if
gerrit_rebase_patch_ref
:
cmd
.
append
(
'--gerrit_rebase_patch_ref'
)
return
self
.
m
.
python
(
'apply_gerrit'
,
apply_gerrit_path
,
cmd
,
**
kwargs
)
def
ensure_checkout
(
self
,
gclient_config
=
None
,
suffix
=
None
,
patch
=
True
,
update_presentation
=
True
,
force
=
False
,
patch_root
=
None
,
no_shallow
=
False
,
...
...
recipe_modules/bot_update/example.expected/apply_gerrit_ref.json
0 → 100644
View file @
2250d5b3
[
{
"cmd"
:
[
"python"
,
"-u"
,
"RECIPE_MODULE[depot_tools::bot_update]/resources/apply_gerrit.py"
,
"--gerrit_repo"
,
"chromium"
,
"--gerrit_ref"
,
""
,
"--root"
,
"/tmp/test/root"
,
"--gerrit_no_reset"
,
"--gerrit_rebase_patch_ref"
],
"env"
:
{
"PATH"
:
"%(PATH)s:RECIPE_PACKAGE_REPO[depot_tools]"
},
"name"
:
"apply_gerrit"
},
{
"name"
:
"$result"
,
"recipe_result"
:
null
,
"status_code"
:
0
}
]
\ No newline at end of file
recipe_modules/bot_update/example.py
View file @
2250d5b3
...
...
@@ -35,18 +35,25 @@ def RunSteps(api):
suffix
=
api
.
properties
.
get
(
'suffix'
)
gerrit_no_reset
=
True
if
api
.
properties
.
get
(
'gerrit_no_reset'
)
else
False
gerrit_rebase_patch_ref
=
bool
(
api
.
properties
.
get
(
'gerrit_rebase_patch_ref'
))
api
.
bot_update
.
ensure_checkout
(
force
=
force
,
no_shallow
=
no_shallow
,
patch
=
patch
,
with_branch_heads
=
with_branch_heads
,
output_manifest
=
output_manifest
,
refs
=
refs
,
patch_oauth2
=
oauth2
,
clobber
=
clobber
,
root_solution_revision
=
root_solution_revision
,
suffix
=
suffix
,
gerrit_no_reset
=
gerrit_no_reset
,
gerrit_rebase_patch_ref
=
gerrit_rebase_patch_ref
)
if
api
.
properties
.
get
(
'test_apply_gerrit_ref'
):
api
.
bot_update
.
apply_gerrit_ref
(
root
=
'/tmp/test/root'
,
gerrit_no_reset
=
gerrit_no_reset
,
gerrit_rebase_patch_ref
=
gerrit_rebase_patch_ref
)
else
:
api
.
bot_update
.
ensure_checkout
(
force
=
force
,
no_shallow
=
no_shallow
,
patch
=
patch
,
with_branch_heads
=
with_branch_heads
,
output_manifest
=
output_manifest
,
refs
=
refs
,
patch_oauth2
=
oauth2
,
clobber
=
clobber
,
root_solution_revision
=
root_solution_revision
,
suffix
=
suffix
,
gerrit_no_reset
=
gerrit_no_reset
,
gerrit_rebase_patch_ref
=
gerrit_rebase_patch_ref
)
def
GenTests
(
api
):
...
...
@@ -163,6 +170,12 @@ def GenTests(api):
slavename
=
'somehost'
,
gerrit_rebase_patch_ref
=
True
)
yield
api
.
test
(
'apply_gerrit_ref'
)
+
api
.
properties
(
repository
=
'chromium'
,
gerrit_rebase_patch_ref
=
True
,
gerrit_no_reset
=
1
,
test_apply_gerrit_ref
=
True
,
)
yield
api
.
test
(
'tryjob_v8'
)
+
api
.
properties
(
mastername
=
'tryserver.chromium.linux'
,
buildername
=
'linux_rel'
,
...
...
recipe_modules/bot_update/resources/apply_gerrit.py
0 → 100755
View file @
2250d5b3
#!/usr/bin/env python
# Copyright 2016 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import
optparse
import
sys
import
bot_update
# pylint: disable=relative-import
if
__name__
==
'__main__'
:
parse
=
optparse
.
OptionParser
()
parse
.
add_option
(
'--gerrit_repo'
,
help
=
'Gerrit repository to pull the ref from.'
)
parse
.
add_option
(
'--gerrit_ref'
,
help
=
'Gerrit ref to apply.'
)
parse
.
add_option
(
'--root'
,
help
=
'The location of the checkout.'
)
parse
.
add_option
(
'--gerrit_no_reset'
,
action
=
'store_true'
,
help
=
'Bypass calling reset after applying a gerrit ref.'
)
parse
.
add_option
(
'--gerrit_rebase_patch_ref'
,
action
=
'store_true'
,
help
=
'Rebase Gerrit patch ref after of checking it out.'
)
options
,
_
=
parse
.
parse_args
()
sys
.
exit
(
bot_update
.
apply_gerrit_ref
(
options
.
gerrit_repo
,
options
.
gerrit_ref
,
options
.
root
,
not
options
.
gerrit_no_reset
,
options
.
gerrit_rebase_patch_ref
)
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment