Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
G
git-repo
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
linux-tools
git-repo
Commits
52185ee3
Commit
52185ee3
authored
Apr 13, 2013
by
Matthias Putz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix ssh upload
parent
aa8d35a5
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
5 deletions
+27
-5
git_config.py
git_config.py
+27
-5
No files found.
git_config.py
View file @
52185ee3
...
@@ -563,15 +563,12 @@ class Remote(object):
...
@@ -563,15 +563,12 @@ class Remote(object):
return
None
return
None
u
=
self
.
review
u
=
self
.
review
if
not
u
.
startswith
(
'http:'
)
and
not
u
.
startswith
(
'https:'
):
u
=
'http://
%
s'
%
u
if
u
.
endswith
(
'/Gerrit'
):
if
u
.
endswith
(
'/Gerrit'
):
u
=
u
[:
len
(
u
)
-
len
(
'/Gerrit'
)]
u
=
u
[:
len
(
u
)
-
len
(
'/Gerrit'
)]
if
u
.
endswith
(
'/ssh_info'
):
if
u
.
endswith
(
'/ssh_info'
):
u
=
u
[:
len
(
u
)
-
len
(
'/ssh_info'
)]
u
=
u
[:
len
(
u
)
-
len
(
'/ssh_info'
)]
if
not
u
.
endswith
(
'/'
):
if
not
u
.
endswith
(
'/'
):
u
+=
'/'
u
+=
'/'
http_url
=
u
if
u
in
REVIEW_CACHE
:
if
u
in
REVIEW_CACHE
:
self
.
_review_url
=
REVIEW_CACHE
[
u
]
self
.
_review_url
=
REVIEW_CACHE
[
u
]
...
@@ -581,8 +578,33 @@ class Remote(object):
...
@@ -581,8 +578,33 @@ class Remote(object):
REVIEW_CACHE
[
u
]
=
self
.
_review_url
REVIEW_CACHE
[
u
]
=
self
.
_review_url
else
:
else
:
try
:
try
:
# NOTE: contrary to original repo: do not switch to ssh, since this is contra-intuitive
# NOTE: contrary to original repo: do not switch automatically to ssh, since this is contra-intuitive
self
.
_review_url
=
http_url
# try to fetch ssh infos from http gerrit server if protocol not specified
protocolSeperator
=
"://"
protocolSepIndex
=
u
.
find
(
protocolSeperator
)
if
protocolSepIndex
==
-
1
:
http_url
=
'http://
%
s'
%
u
info_url
=
http_url
+
'ssh_info'
info
=
portable
.
stream2str
(
urllib
.
request
.
urlopen
(
info_url
)
.
read
())
if
'<'
in
info
:
# Assume the server gave us some sort of HTML
# response back, like maybe a login page.
#
try
:
raise
UploadError
(
'
%
s: Cannot parse response'
%
info_url
)
except
Exception
as
e
:
Trace
(
"could not get ssh infos of
%
s from
%
s"
,
u
,
info_url
)
info
=
'NOT_AVAILABLE'
if
info
==
'NOT_AVAILABLE'
:
# Assume HTTP if SSH is not enabled.
self
.
_review_url
=
http_url
+
'p/'
Trace
(
"warning: proceed upload with http url
%
s since no protocol given and no infos could be retrieved from
%
s"
,
self
.
_review_url
,
info_url
)
else
:
host
,
port
=
info
.
split
()
self
.
_review_url
=
self
.
_SshReviewUrl
(
userEmail
,
host
,
port
)
else
:
self
.
_review_url
=
u
except
urllib
.
error
.
HTTPError
as
e
:
except
urllib
.
error
.
HTTPError
as
e
:
raise
UploadError
(
'
%
s:
%
s'
%
(
self
.
review
,
str
(
e
)))
raise
UploadError
(
'
%
s:
%
s'
%
(
self
.
review
,
str
(
e
)))
except
urllib
.
error
.
URLError
as
e
:
except
urllib
.
error
.
URLError
as
e
:
...
...
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