This adds a setting for choosing which of {name, email, username} to use
as "author" when constructing the name for the branch to where a change
is downloaded.
The rationale is that sometimes the given "name" is just long and
unwieldy (when displaying the branch in the shell prompt, for example),
and one may be already used to the "username".
Change-Id: Ieed465f69ed0c0864979a92f609bd8f58cd8e883
git_credentials() was converting the stdin argument to bytes. However
according to the Python3 documentation subprocess.communicate() expects
a string when universal_newlines=True is passed to Popen.
The symptom was that git review would fail in p.communicate(stdin) on
line 156 with the message "'bytes' object has no attribute 'encode'".
This was observed with Python version 3.6.9 when running git-review
against a gerrit repo over https, where the repo requires username and
password to authenticate.
Change-Id: I0c0314c3f7b0eb631e72e4ac187a9d443a2bc82b
In our setup branch names are not designed to contain topics and are in
certain cases also dictated by other tools. To avoid having git-review
constantly overwrite the topics it is useful to set --no-topic to be the
default state when running git-review.
Change-Id: I1e77e062d73d47f1cceeb34b3418c074d06c9005
Officially removes support for py27, which was already broken for
3+ months (unmaintained test tools).
Change-Id: I38c966d4e1680592f5cd94695051710695d41f71
Related: https://github.com/testing-cabal/subunit/pull/32
As of gerrit 2.15 and later, draft workflow is replaced with
work-in-progress and private workflow. See this CL: [1] and this
issue upstream: [2].
Even though support for draft worklfow was removed, the drafts magic
draft option was preserved, and is mapped to creation of the private
change when pushed first time, or creation of change edit on subsequent
pushes. These behaviour was alaways controvesial, but was kept in place
because 2 major Gerrit clients: repo and git-review were still
referencing drafts magic branch. In upcoming gerrit releases the support
for drafts magic branch option is discontinued, and thus removed from
both repo and git-review: [3].
[1] https://gerrit-review.googlesource.com/c/gerrit/+/97230
[2] https://crbug.com/gerrit/6880
[3] https://gerrit-review.googlesource.com/c/gerrit/+/238898
Sem-Ver: api-break
Change-Id: I08a590d42e1ebaa230da960cd192c0b1df528332
Fixes an issue we're seeing in the python3-based gate plus some other
random things.
Change-Id: I417c0a7669090ee3419c406024f6f3e3289b4c4b
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
The docs testenv in tox.ini was attempting to use Python 2.7.x with
Sphinx 2.x, which is not a compatible combination. This caused tox
failures like this:
2019-05-08 12:45:48.060953 | TASK [tox : Run tox without tests]
2019-05-08 12:45:48.759277 | ubuntu-bionic | docs create: /home/zuul/src/opendev.org/openstack/os-resource-classes/.tox/docs
2019-05-08 12:45:52.775007 | ubuntu-bionic | docs installdeps: -r/home/zuul/src/opendev.org/openstack/os-resource-classes/doc/requirements.txt
2019-05-08 12:45:53.838450 | ubuntu-bionic | ERROR: invocation failed (exit code 1), logfile: /home/zuul/src/opendev.org/openstack/os-resource-classes/.tox/docs/log/docs-1.log
2019-05-08 12:45:53.838669 | ubuntu-bionic | ================================== log start ===================================
2019-05-08 12:45:53.838995 | ubuntu-bionic | DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7.
2019-05-08 12:45:53.839207 | ubuntu-bionic | Looking in indexes: http://mirror.iad.rax.openstack.org/pypi/simple, http://mirror.iad.rax.openstack.org/wheel/ubuntu-18.04-x86_64
2019-05-08 12:45:53.839421 | ubuntu-bionic | Collecting sphinx!=1.6.6,!=1.6.7,>=1.6.2 (from -r /home/zuul/src/opendev.org/openstack/os-resource-classes/doc/requirements.txt (line 1))
2019-05-08 12:45:53.839619 | ubuntu-bionic | Downloading http://mirror.iad.rax.openstack.org/wheel/ubuntu-18.04-x86_64/sphinx/Sphinx-2.0.1-py2.py3-none-any.whl (3.2MB)
2019-05-08 12:45:53.839749 | ubuntu-bionic | ERROR: Sphinx requires Python '>=3.5' but the running Python is 2.7.15
2019-05-08 12:45:53.839778 | ubuntu-bionic |
2019-05-08 12:45:53.839912 | ubuntu-bionic | =================================== log end ====================================
2019-05-08 12:45:53.840347 | ubuntu-bionic | ERROR: could not install deps [-r/home/zuul/src/opendev.org/openstack/os-resource-classes/doc/requirements.txt]; v = InvocationError(u'/home/zuul/src/opendev.org/openstack/os-resource-classes/.tox/docs/bin/pip install -r/home/zuul/src/opendev.org/openstack/os-resource-classes/doc/requirements.txt', 1)
So switch to Python 3 for building docs.
Change-Id: If04bd7cf8c316f3ae621c182a05aebc779b4d5b4
When the git configuration value push.followTags is set and a repo has
tags, git-review pushes are rejected:
! [remote rejected] TAG -> TAG
(cannot combine normal pushes and magic pushes)
This change ensures that git-review never pushes with followTags.
Change-Id: Ifbd13284b16bad1165e73d25b99f17344180d423
If usepushurl is set, then it's likely that the pushurl is pointing
to the code review system while the normal url is pointing to a read
only mirror. If the read-only mirror in question doesn't contain
the gerrit refs (like opendev.org currently) then git fetch origin
won't work properly. However, we already calculate the correct
URL at the top of the function for use in query_reviews, and fetch
will happily work with a full url rather than a named remote.
Update the function to use the remote_url so that usepushurl works
even if the mirror url does not contain refs/changes.
Change-Id: Ib72afe97e65cb1dcaf95e28450dfe6e7d5f88965
Our company-internal Gerrit uses federated logins (Shibboleth/SAML), and
the login names happen to include the at-signs. This needed a patch to
Gerrit ([1], released in 2.13.10) to allow them. Cloning using regular
git tools as well as through the gertty work, but `git-review --list`
complained because it couldn't parse these URLs.
[1] https://gerrit-review.googlesource.com/c/94914/
Change-Id: I6c1c75a585184ee3fb2847c1e6d30802e53f8b4c
Adopts use of newer stestr for running the test suite.
Passing TERM is needed or stestr will ignore the --color option when
run under tox.
Change-Id: Id2d4ce36cdfedd5a847e0428854753d2cf4140ee
This allows user to define JAVA_HOME in order to control which version
of Java will be used by Gerrit during tox testing.
Avoid Gerrit startup failure due to use of wrong version of Java,
even if `java -version` would have reported the right version.
On systems with multiple versions of Java 8/9/10 it was impossible to
run tox because the launcher would have always picked the latest
version which is clearly not compatible with Gerrit war archive used
for testing.
In the future we will start using a gerrit container for testing and
avoid dependency on local Java version.
Change-Id: I05b6f7125393a009e1fdcf556b17df158c10eea0
When something is not found in git config, the --verbose option logs the
wrong value "None", example:
2018-12-12 Running: git config --get gitreview.branch
2018-12-12 using default: None
2018-12-12 Running: git config --get gitreview.scheme
2018-12-12 using default: None
2018-12-12 Running: git config --get remote.gerrit.pushurl
2018-12-12 using default: None
2018-12-12 Running: git config --get remote.gerrit.url
2018-12-12 result: ssh://marc@review.openstack.org:29418/openstack-infra/git-review
From a --verbose user perspective this is plain wrong for (at least) all the
options defined in the DEFAULTS list.
Change --verbose message to look like this instead:
2018-12-12 Running: git config --get gitreview.branch
2018-12-12 Config['branch'] = master
2018-12-12 Running: git config --get gitreview.scheme
2018-12-12 Config['scheme'] = ssh
2018-12-12 Running: git config --get remote.gerrit.pushurl
2018-12-12 Running: git config --get remote.gerrit.url
2018-12-12 ... remote.gerrit.url = ssh://marc@review.openstack.org:29418/openstack-infra/git-review
If git_config_get_value('new_option',... ) is ever invoked in the future
with a not None, default="fubar" parameter then --verbose will print these
lines:
2018-12-19 Running: git config --get gitreview.new_option
2018-12-19 ... nothing in git config, returning func parameter: fubar
This logging issue is especially misleading considering the many levels of
defaults and fallbacks: git config x3; .gitreview; DEFAULTS list,
git_config_get_value(default=...) parameter, options parser logic, etc.
Change-Id: I6cee46e88b90b8f11689be3875d64ec5e577f12f
Add: 'passenv = http_proxy https_proxy' whitelist to tox.ini because there's
basically never any good reason to throw away proxy configuration.
The addition of http_proxy allows downloading
http://tarballs.openstack.org/ci/gerrit/gerrit-<version>.war
behind a proxy.
https_proxy is not needed right now but added for consistency and
"future-proofing"
_JAVA_OPTIONS is added but only as a clue and commented out by default
because it could hold non-proxy configuration which would defeat tox'
environment cleaning and introduce test variability.
This is just the tox.ini source code part of the larger
I764ed51314c8e2d0572d1f01c9792bee0a40c7e6
includes documentation of workarounds and troubleshooting tips.
Change-Id: I764ed51314c8e2d0572d1f01c9792bee0a40c7e7
Newer versions of git quote branch names in their output; at least git
2.16.3 does. This causes all test_uploads_with_nondefault_rebase tests to
fail like this:
testtools.matchers._impl.MismatchError:
'Branch test_branch set up to track remote branch maint from origin.'
not in
u"Switched to a new branch 'test_branch'\n\
Branch 'test_branch' set up to track remote branch 'maint' from 'origin'."
Add a testtools.matchers.MatchesRegex() to support both styles.
Change-Id: I9f1417c53de2f7d638e845f553df3bd426a4c750
From: https://www.openssh.com/txt/release-7.8 change log:
* ssh-keygen(1): write OpenSSH format private keys by default
instead of using OpenSSL's PEM format. The OpenSSH format,
supported in OpenSSH releases since 2014 and described in the
PROTOCOL.key file in the source distribution, offers substantially
better protection against offline password guessing and supports
key comments in private keys. If necessary, it is possible to write
old PEM-style keys by adding "-m PEM" to ssh-keygen's arguments
when generating or updating a key.
This fixes all tests failing with this error:
[2018-12-04 17:46:24,130] WARN org.apache.sshd.common.keyprovider.FileKeyPairProvider :
Unable to read key /home/mherber2/pip/src/git-review/.gerrit/site-5123/etc/ssh_host_rsa_key
java.io.IOException: unrecognised object: OPENSSH PRIVATE KEY
at org.bouncycastle.openssl.PEMParser.readObject(Unknown Source)
at org.apache.sshd.common.keyprovider.FileKeyPairProvider.doLoadKey(FileKeyPairProvider.java:124)
Change-Id: Id10f9b5be928f2ba57847fa32814e9db979375f5
Python2 has default encoding as ascii which means
that is likely that some print() commands would
fails with UnicodeEncodeError.
This hack changes default encoding in order to
avoid such errors.
Change-Id: I4e21e6e32d4bb815693b7d6ce35efb6a5cca2fc2
Refactoring to improve code style as suggested by pep8.
- "rc" and "status" variables cannot be None beacause the process is
terminated after the "run_command_status"
- It's better to ignore an empty "username"
Change-Id: I8a34f4ab9e05d91786ce6d62e4db96811787b633
Unnecessary dynamic GitReviewException.EXIT_CODE attribute
lookup refactored into static to benefit static analyzers.
Default process exit code changed from 127 (command not found error)
to 1 (general error)
Change-Id: I1fcb583a740bf32c4427a587e208d099712a7bc4
This is included as a note on the usage page for want of a better place
to put it.
Change-Id: I647cc8239e04e1f064aef3e0942ca94b0d5b4025
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
Story: 2000431
Task: 2663