Commit Graph

449 Commits

Author SHA1 Message Date
Tony Breeds a97ace7eb8 Retire Packaging Deb project repos
This commit is part of a series to retire the Packaging Deb
project. Step 2 is to remove all content from the project
repos, replacing it with a README notification where to find
ongoing work, and how to recover the repo if needed at some
future point (as in
https://docs.openstack.org/infra/manual/drivers.html#retiring-a-project).

Change-Id: Idb6639333fd4d976be89a151d8ef32cf1e9def89
2017-09-12 15:38:14 -06:00
Jenkins 089e8e64b1 Merge "Refactor displaying of reviews" 2017-07-21 16:05:47 +00:00
Jenkins b3e0cac1aa Merge "Added topic field to the list output" 2017-07-21 16:04:12 +00:00
Jenkins 54221b1075 Merge "Switch to string format to avoid interpolation issues" 2017-07-21 15:54:05 +00:00
Jenkins 50cb05db6a Merge "Provide link to MediaWiki platform specific page" 2017-05-16 04:48:40 +00:00
Ian Y. Choi e6c8e644b2 Provide link to MediaWiki platform specific page
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
2017-05-16 14:20:10 +10:00
Sorin Sbarnea 72175104dd Better username detection for add_remote()
Change-Id: Ia083ec9d5f19bff4944080559672b5947d4e43ee
2017-02-23 15:42:51 +00:00
David Caro 60f46a5a65 Refactor displaying of reviews
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
2016-11-16 15:13:49 +00:00
David Caro ef4711d695 Added topic field to the list output
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>
2016-11-16 15:13:46 +00:00
Darragh Bailey efb5126e67 Switch to string format to avoid interpolation issues
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
2016-11-16 15:10:18 +00:00
Jenkins 67dbbc2e59 Merge "Set a default EXIT_CODE for GitReviewException" 2016-08-30 14:33:40 +00:00
Jenkins 051f37c1c8 Merge "Support git without git credential" 2016-08-30 14:33:35 +00:00
Jenkins 59f87fe3d6 Merge "Fix no_git_dir UnboundLocalError in except block" 2016-08-30 14:26:37 +00:00
Jenkins 535202f579 Merge "fix encoding issue on Windows" 2016-08-30 14:25:30 +00:00
Jenkins 58851ab314 Merge "Avoid AttributeError when raising raw GitReviewExceptions" 2016-08-30 14:25:10 +00:00
Jenkins 66da56d895 Merge "Remove worthless print" 2016-08-30 14:24:27 +00:00
Jenkins 8cdabbf90d Merge "Fix AttributeError when can not connect to Gerrit" 2016-08-30 14:22:34 +00:00
Jenkins cc0fbc286e Merge "Add several missing options to the man page" 2016-08-30 14:22:29 +00:00
Jenkins c2c3418ede Merge "Refactor Isolated Env to use in unit tests" 2016-08-30 14:22:23 +00:00
Jenkins f747ca3d1f Merge "Set author and committer explicitly" 2016-08-30 14:09:28 +00:00
Jenkins 6b056e4d0b Merge "Use hash of test ID to pick Gerrit ports in tests" 2016-08-30 14:06:54 +00:00
Jenkins 9149685eea Merge "Remove discover from test-requirements" 2016-08-30 14:06:42 +00:00
Jenkins 3de21e4075 Merge "Remove argparse from requirements" 2016-08-26 16:15:11 +00:00
Darragh Bailey 817bdf3059 Refactor Isolated Env to use in unit tests
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
2016-08-15 18:04:30 +01:00
Darragh Bailey d64f004bdb Set author and committer explicitly
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
2016-08-15 17:51:30 +01:00
Yuriy Taraday 33081ce1d6 Use hash of test ID to pick Gerrit ports in tests
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
2016-08-15 17:41:30 +01:00
Zane Bitter cf4e7cdb5f Clarify that submitting multiple commits is OK
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
2016-08-12 11:36:05 -04:00
Swapnil Kulkarni (coolsvap) 7e9b63f418 Remove discover from test-requirements
It's only needed for python < 2.7 which is not supported

Change-Id: I5adfe5ccc0f64c8788a8e985f40c9450a599bd0e
2016-07-22 04:54:22 +00:00
Clark Boylan c99d3a4f2b Install bc libs when running testsuite
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
2016-07-13 15:44:48 -07:00
Jenkins 69e240352a Merge "Update gerrit version for testing" 2016-07-12 00:10:42 +00:00
Pete Zaitcev c4e25e5539 Add several missing options to the man page
The bulk of this patch is based on suggestions by Robert P.J. Day,
as found here:
  https://bugzilla.redhat.com/show_bug.cgi?id=1266468

Change-Id: I6411adec228950623a3cc1269701d47df38e8e62
2016-06-29 16:05:45 -06:00
Lukas Bednar 9ebdef990d Fix AttributeError when can not connect to Gerrit
Change-Id: I0c29bc29b9364c8203184a4dedc397e71e7ed437
Story: #2000586
2016-06-15 17:56:59 +02:00
Julien Danjou 652b8cb04c Set a default EXIT_CODE for GitReviewException
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
2016-06-14 11:45:01 +02:00
Jeremy Stanley 6eee79466a Use consistent formatting for deprecations
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
2016-06-07 14:44:51 +00:00
Frederic Lepied 47cbee9687 Fix git-review -d behavior with branches
- 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
2016-04-29 14:50:05 +00:00
Cedric Brandily 997c20bb37 Support git without git credential
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
2016-04-18 19:26:55 +02:00
Tim Burke a17d2a75df Remove worthless print
The traceback isn't even formatted, so we just get something like

  <traceback object at 0x7fd30809f440>

Change-Id: Iacbb01bdcede40e07058b46d907cd3184bfa4880
2016-04-11 10:58:05 -07:00
Sachi King 58a23a938a Fix no_git_dir UnboundLocalError in except block
In Python 3, exception blocks clean their variables up, and we get
a UnbloundLocalError when we try to reference the target outside
of the except block.

To pass the exception out we set a variable from the target.

Also pull --license above raising the error, as it should work
outside a git repo too.

https://www.python.org/dev/peps/pep-3110/#semantic-changes

Change-Id: I298ac3648068cd07c4cf232e32ab3daaaf8e549d
2016-03-30 11:59:47 +11:00
Khai Do d1ae86427c Update gerrit version for testing
Openstack is now running a fork of Gerrit 2.11.4 so we should update
the tests to validate against something similar.

Change-Id: I62eeef6df47f79a249ed6f7d4b0565ddef79d52d
2016-02-18 14:16:08 -08:00
Andreas Jaeger 5792ece9e1 Remove argparse from requirements
argparse was external in python 2.6 but not anymore, remove it from
requirements. This project is not supporting Python 2.6 anymore.

Change-Id: Ib7e74912b36c1b5ccb514e31fac35efeff57378d
2016-02-07 12:50:08 +00:00
James E. Blair aaa416e697 Correct metadata URLs
Change-Id: Id1969eae49095ca7d2434a37366806863fea0eef
2016-02-02 15:52:39 -08:00
Tim Burke 26e2f72b26 Avoid AttributeError when raising raw GitReviewExceptions
Previously, if a GitReviewException was raised (not, for example, a
BranchTrackingMismatch or GitDirectoriesException which subclasses it,
but an actual GitReviewException), it would still get handled in main(),
but it wouldn't have an EXIT_CODE attribute.

This happens, for example, in add_remote(), if test_remote_url() fails
both times.

Now, if the caught exception doesn't have an EXIT_CODE, it will default
to -1.

Change-Id: I8529b320795717ef8d19ca87d3fa6bd523ef93ae
2015-10-28 18:04:38 -07:00
pangwa 0027347209 fix encoding issue on Windows
git review will throw an encoding error while sending reviews
whose commit message contains Chinese characters on an English Windows。

To fix this issue,convert the output to the console encoding verbosely.

Change-Id: Ie834931a549175471af029a6ec4d5794543d8c92
2015-09-02 18:35:46 +08:00
Atsushi SAKAI cfb726e4a0 Fix one typo on git-review documentation
depenedencies => dependencies

Change-Id: Ic4fde22a932a66145ecb821419cba421dcf2177f
2015-08-10 11:18:58 +09:00
Cedric Brandily 44707a1e79 Use git push-url instead of a second remote
Having a gerrit remote means that we fetch changes twice. It's also
not necessary since the push-url can be set on the origin remote. As
a first step, add a config option that changes the default for defaultremote
to origin and then reworks the logic to add the remote url to origin as a
push-url instead of creating a gerrit remote.

Since this will cause people with an existing gerrit remote to have a
push url added and the gerrit remote orpahned, a follow on commit will
come that will look for a gerrit remote and, if it exists, use it as the
source of url for the push-url and then delete the old remote.

Change-Id: Ief5d092a796516de9605b7df64e7b902c3b47351
2015-07-21 12:21:25 +00:00
Jenkins f5619a6f85 Merge "Remove spurious mdoc directives" 2015-06-20 14:14:08 +00:00
Jenkins 7ff674a3d0 Merge "Don't parse git log header for topic" 2015-06-20 14:11:56 +00:00
Benjamin Pflanz d80b6cb346 Don't parse git log header for topic
When looking for candidate topic in bug or blueprint ID, get the
git log  without header lines, e.g., commit hash, author, committer,
dates, so that accidental matches such as commit hash (which could look
like a bug ID) or user name (which could look like anything) don't
accidentally get taken as the topic.

Change-Id: Ie45ed7509e7f873e566f078b55cadd547da704dd
Closes-Bug: #2000296
2015-06-18 13:22:37 -04:00
Jeremy Stanley bfbb9277bc Ignore .eggs cruft
Looks like possibly new setuptools has started leaving a .eggs
directory in the workspace. Add it to .gitignore with extreme
prejudice.

Change-Id: If53d9a2f03c8064265a6915a116983fb34de5f9a
2015-06-17 00:56:40 +00:00
Jeremy Stanley 55a91a6655 Fix H238 violation and enable check for that rule
Change-Id: I04f3d96acfc0be12393cc6cf5f0d3f7006939532
2015-06-17 00:53:01 +00:00