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
2653c7e0
Commit
2653c7e0
authored
Apr 15, 2013
by
Matthias Putz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
further improvement of review url selection
parent
cca15f81
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
14 deletions
+22
-14
git_config.py
git_config.py
+19
-13
upload.py
subcmds/upload.py
+3
-1
No files found.
git_config.py
View file @
2653c7e0
...
...
@@ -594,28 +594,34 @@ class Remote(object):
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.
#
protocols
=
[
"http"
,
"https"
]
for
prefix
in
protocols
:
http_url
=
'
%
s://
%
s'
%
(
prefix
,
u
)
info_url
=
http_url
+
'ssh_info'
info
=
None
try
:
raise
UploadError
(
'
%
s: Cannot parse response'
%
info_url
)
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.
#
raise
UploadError
(
'
%
s: Cannot parse response'
%
info_url
)
if
info
!=
'NOT_AVAILABLE'
:
host
,
port
=
info
.
split
()
self
.
_review_url
=
self
.
_SshReviewUrl
(
userEmail
,
host
,
port
)
except
Exception
as
e
:
Trace
(
"could not get ssh infos of
%
s from
%
s
"
,
u
,
info_url
)
Trace
(
"could not get ssh infos of
%
s from
%
s
(received
%
s), error
%
s"
,
u
,
info_url
,
info
,
e
)
info
=
'NOT_AVAILABLE'
if
info
==
'NOT_AVAILABLE'
:
if
not
self
.
_review_url
:
# 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
)
print
(
"detected
%
s as review url"
%
self
.
_review_url
)
else
:
self
.
_review_url
=
u
except
urllib
.
error
.
HTTPError
as
e
:
...
...
subcmds/upload.py
View file @
2653c7e0
...
...
@@ -244,7 +244,9 @@ Gerrit Code Review: http://code.google.com/p/gerrit/
else
x
for
x
in
script
]
script
=
portable
.
stream2str
(
Editor
.
EditString
(
"
\n
"
.
join
(
script
)))
.
split
(
"
\n
"
)
script
=
Editor
.
EditString
(
b
"
\n
"
.
join
(
script
))
script
=
script
.
split
(
"
\n
"
)
project_re
=
re
.
compile
(
r'^#?\s*project\s*([^\s]+)/:$'
)
branch_re
=
re
.
compile
(
r'^\s*branch\s*([^\s(]+)\s*\(.*'
)
...
...
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