usepushurl is a great setting - it reduces the number of actions git has
to do for things like a bare 'git fetch'. It is, unfortunately, not
documented in the manpage.
Change-Id: Ia7b179c6fcf6490454087aa359d891d1ff3af1a0
It's been poorly documented so far that the current git-review
maintainers are avoiding addition of new features. Gerrit-based
change workflows are already confusing enough to new users, and
providing them with too many complex options risks making things
worse. This tool's goal is to do a few things well and simply in
support of an opinionated workflow, without becoming everything to
everyone.
Since git-review sees broad usage outside the OpenStack contributor
community, it is subject to a lot of drive-by feature additions. Add
a note to the contributing document indicating its maintainers
consider it to be mostly complete (modulo bug fixes, compatibility
improvements, adding test coverage), so that readers will consider
strongly whether their particular improvement is well suited to the
existing scope of the tool.
Change-Id: I11b9f898286b75177493af31e209c2853d78f245
I'm not sure what print_safe_encoding is trying to do
(Ie834931a549175471af029a6ec4d5794543d8c92).
print(str.encode(sys.stdout.encoding, 'replace'))
means that print() ends up getting a bytes-object encoded in the
output encoding. Thus print() is then going to output this as raw
bytes... not only is unicode going to come out as "\x..\x.." etc, but
even newlines get squished and you end up with stuff like
$ /tmp/gitreview3/bin/git-review
b'remote: \rremote: Processing changes: updated: 1, refs: 1\rremote: Processing changes: updated: 1,
I think this problem stems from not ensuring that incoming data
(output of git) is encoded as a string. By setting
universal_newlines=True in run_command_status() we automatically
ensure that any incoming data is a unicode str, not bytes.
The final section, with the message about rhbz#1058167, appears to be
related to running git under an alternative locale where it's output
is translated. I1bf1124f0b09d6658a7b0703e3b9e74ed80f4eea changed
things to run the commands under C locale, so there shouldn't be
unicode in here I wouldn't think. But, by ensuring it's just a
string, we can print() it safely anyway.
Change-Id: I596dcba317ecfbaf437cb72d9850580ed6765fce
Previously git review could not properly query Gerrit servers via http
if the root of the Gerrit api was below /. This is because it was always
rooting the changes query api at /changes instead of /foo/changes if
hosted at /foo.
To fix this we read the project name from the config so that we can
remove the project name suffix from the urls then append changes/ to the
resulting url to get a properly rooted query url.
Note this was never a problem with ssh because ssh can't be hosted as
some subpath. Everything is rooted with ssh and gerrit.
Change-Id: I46e21dfdbbb7f60aa89a7b028501c0d953ae1d7f
The 2.15 release of git drops support for `git branch --set-upstream`
and replaces it with `git branch --set-upstream-to` which was added in
git 1.8. Move from --set-upstream to --set-upstream-to in order to
support git 2.15 and beyond. Note that this specifically affects the
`git review -d` functionality as it is what needs to update the
upstream.
This does drop support for git 1.7 and older though as this option did
not exist then. Polling linux distros and OS X the oldest git I can find
is on CentOS 7 which has 1.8 so this should be fine.
Story: 2001266
Co-Authored-By: Harry Mallon <Harry.Mallon@codex.online>
Change-Id: I5ded1ab39bb2c76bdc38655299bac11b4584e138
We show the command used to retrieve the config value, but don't show
what we find. Fix that, and also show cases where we are going to use
the default setting.
Change-Id: I53ee9ea6e3af4e951587c0845c8333874238f0c2
Signed-off-by: Doug Hellmann <doug@doughellmann.com>
The SSH query API changed from 2.13 to 2.14 from
{"number":"1", ...}
to
{"number":1, ...}
so we need to stringify everything in order to do len, encode etc. on
it.
Change-Id: I06bdd1b4b1181d00a27ce1e76f97baed8cde1284
Story: 2001095
Provide a link to the MediaWiki page on git-review installation, which
provides details for a range of platforms, including Windows and OS
X/macOS.
Change-Id: If030fa7614a7cea33c2a55605a6f0d68751173ea
Story: #2000481
Split the displaying of reviews into a separate class to make it easier
to alter the output and accommodate different display options.
Change-Id: I6007259686fc15ae21ae6843faa4ff7ad545cef1
Now you can pass multiple '-l' options like '-ll' and when doing so, it
will show also the topic of the patches
Change-Id: Iabc1107d66a17fde751f90d7fa33f15fe54c7f58
Signed-off-by: David Caro <dcaroest@redhat.com>
Co-Authored-By: Darragh Bailey <dbailey@hpe.com>
Convert to using python format to align and interpolate values to
ensure the correct output on python 2 & 3 when dealing with unicode and
str.
Interpolating strings using encode into '%s' and subsequently
interpolating the results into a second string results in the output
printing embedded byte strings on python 3.
$ git-review -l
b'226894' b'master' b'Add pem key parameter (WIP)'
b'199225' b'master' b'support urls as change-id input
Which occurs because after converting a string to unicode bytes, it was
then interpolated using '%s'.
Switching to using '.format()' method takes care of converting the
output to the correct string format for python 2 & 3 automatically.
Change-Id: Ia962d18bda34e0244fb05636a7be263045ecb256
Refactor the setup of the Environment and base test directories to
allow the same settings to be applied to the unit tests.
Change-Id: I554b4aa4f07fe4230c11d3ae62a77acbd66e7d84
With the isolated home area for the unit tests, either missing
GIT_COMMITTER_NAME and GIT_AUTHOR_NAME environment variables or failure
to set the user.name on the local repository config will cause tests to
fail with git complaining about needing to know who is performing the
commit.
Results in seeing the following error message:
Stdout: *** Please tell me who you are.
Run
git config --global user.email "you@example.com"
git config --global user.name "Your Name"
Change-Id: I4b87b6df3f19260c180af9beed77daf53dc6a7cc
This eliminates need for 127.* IPs mapped to loopback interface (which
is true only for Linux) and makes test site generation even more
predictable (name of site dir for a test is the same on any machine).
Hash function used is md5(test_id) % 10000 which is enough for now. This
function is checked for collisions before every run in tox.ini, so if
someone happens to add test that will cause a collision, it'll be
immediately visible. Hash function can be changed to anything else that
maps test ID string to a number in [0,10000].
Change-Id: Ib05d9b489a80e4f55c84db2f8bea20b88e959649
I've heard feedback that the message that appears when you send multiple
commits for the review appears to imply that Gerrit cannot handle
multiple patches in a series, and that users should avoid submitting
them in favour of squashing all of their patches before submission. Of
course nothing could be further from the truth, and Gerrit's ability to
gracefully handle patch series is one of its major advantages over other
code review tools.
This changes the message to clarify that multiple self-contained patches
are perfectly OK.
Change-Id: Ia659149ce9332909b4bdbf09a2817a2015ebafd2
Newer openssh clients refuse to connect to Gerrit when it doesn't have
bouncy castle libs installed bceause the available encryption methods
are not secure. Fix this by installing the bc libs making ssh clients
happy.
Note that this changes the war to one with working bouncy castle package
urls, it also reindexes after init to make this new war happy.
Change-Id: I1c5db09c53a56ffd856da24decf29566e86f9d87
This should avoid:
Could not connect to gerrit at ssh://some random string I typed@review.openstack.org:29418/openstack/repo.git
Traceback (most recent call last):
File "/usr/local/bin/git-review", line 11, in <module>
sys.exit(main())
File "/usr/local/lib/python2.7/site-packages/git_review/cmd.py", line 1534, in main
sys.exit(e.EXIT_CODE)
AttributeError: 'GitReviewException' object has no attribute 'EXIT_CODE'
Change-Id: I288dadd7bb2cc2766fb719171e2f0303aa250171
Add a warn() function for use in consistently displaying warning
messages, for use in things like deprecation warnings. Also make the
one current deprecation warning use this and be more explicit about
future removal.
Change-Id: I423524b30233ae45fbc04133566acf7a23828036
- Fix fetch_review to use the information from the correct branch.
- Improve the unit test for git review -d to exercice the backport
workflow using branches.
Change-Id: I47c2e0149648a1f4f558e7f1ad6204f7f551865a
Closes-Bug: #2000294
Old versions (typically 1.7.9) of git don't provide git credential
subcommand but it's required in some cases by git-review over http(s).
This change updates git-review in order to handle correctly such case.
Change-Id: I6db5aca67818ae48f1d7d84bcdffff9c0e48767a