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
32978d96
Commit
32978d96
authored
Nov 01, 2016
by
agable
Committed by
Commit bot
Nov 01, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
git-cl-land: print url of final commit location
BUG=661187 Review-Url:
https://codereview.chromium.org/2466953003
parent
86fe47d1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
25 additions
and
0 deletions
+25
-0
gerrit_util.py
gerrit_util.py
+6
-0
git_cl.py
git_cl.py
+13
-0
git_cl_test.py
tests/git_cl_test.py
+6
-0
No files found.
gerrit_util.py
View file @
32978d96
...
...
@@ -483,6 +483,12 @@ def GetChangeDetail(host, change, o_params=None):
return
ReadHttpJsonResponse
(
CreateHttpConn
(
host
,
path
))
def
GetChangeCommit
(
host
,
change
,
revision
=
'current'
):
"""Query a gerrit server for a revision associated with a change."""
path
=
'changes/
%
s/revisions/
%
s/commit?links'
%
(
change
,
revision
)
return
ReadHttpJsonResponse
(
CreateHttpConn
(
host
,
path
))
def
GetChangeDescriptionFromGitiles
(
url
,
revision
):
"""Query Gitiles for actual commit message for a given url and ref.
...
...
git_cl.py
View file @
32978d96
...
...
@@ -2497,6 +2497,14 @@ class _GerritChangelistImpl(_ChangelistCodereviewBase):
raise
GerritIssueNotExists
(
issue
,
self
.
GetCodereviewServer
())
return
data
def
_GetChangeCommit
(
self
,
issue
=
None
):
issue
=
issue
or
self
.
GetIssue
()
assert
issue
,
'issue is required to query Gerrit'
data
=
gerrit_util
.
GetChangeCommit
(
self
.
_GetGerritHost
(),
str
(
issue
))
if
not
data
:
raise
GerritIssueNotExists
(
issue
,
self
.
GetCodereviewServer
())
return
data
def
CMDLand
(
self
,
force
,
bypass_hooks
,
verbose
):
if
git_common
.
is_dirty_git_tree
(
'land'
):
return
1
...
...
@@ -2535,6 +2543,11 @@ class _GerritChangelistImpl(_ChangelistCodereviewBase):
self
.
SubmitIssue
(
wait_for_merge
=
True
)
print
(
'Issue
%
s has been submitted.'
%
self
.
GetIssueURL
())
links
=
self
.
_GetChangeCommit
()
.
get
(
'web_links'
,
[])
for
link
in
links
:
if
link
.
get
(
'name'
)
==
'gerrit'
and
link
.
get
(
'url'
):
print
(
'Landed as
%
s'
%
link
.
get
(
'url'
))
break
return
0
def
CMDPatchWithParsedIssue
(
self
,
parsed_issue_arg
,
reject
,
nocommit
,
...
...
tests/git_cl_test.py
View file @
32978d96
...
...
@@ -2118,11 +2118,17 @@ class TestGitCl(TestCase):
'labels'
:
{},
'current_revision'
:
'deadbeaf'
,
}
cl
.
_codereview_impl
.
_GetChangeCommit
=
lambda
:
{
'commit'
:
'deadbeef'
,
'web_links'
:
[{
'name'
:
'gerrit'
,
'url'
:
'https://git.googlesource.com/test/+/deadbeef'
}],
}
cl
.
_codereview_impl
.
SubmitIssue
=
lambda
wait_for_merge
:
None
out
=
StringIO
.
StringIO
()
self
.
mock
(
sys
,
'stdout'
,
out
)
self
.
assertEqual
(
0
,
cl
.
CMDLand
(
force
=
True
,
bypass_hooks
=
True
,
verbose
=
True
))
self
.
assertRegexpMatches
(
out
.
getvalue
(),
'Issue.*123 has been submitted'
)
self
.
assertRegexpMatches
(
out
.
getvalue
(),
'Landed as .*deadbeef'
)
BUILDBUCKET_BUILDS_MAP
=
{
'9000'
:
{
...
...
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