[Python-modules-commits] [git-review] 04/11: New upstream version 1.26.0

Ondrej Novy onovy at debian.org
Sun Jan 21 13:05:00 UTC 2018


This is an automated email from the git hooks/post-receive script.

onovy pushed a commit to branch master
in repository git-review.

commit 12475bd0282c9ccd59feef33107048a786c2ec22
Author: Ondřej Nový <onovy at debian.org>
Date:   Sun Jan 21 13:45:42 2018 +0100

    New upstream version 1.26.0
---
 AUTHORS                                  |  19 ++
 CONTRIBUTING.rst                         |  10 +
 ChangeLog                                | 103 +++++---
 HACKING.rst                              |   2 +-
 PKG-INFO                                 |  17 +-
 doc/source/installation.rst              |  23 +-
 git-review.1                             |  40 +--
 git_review.egg-info/PKG-INFO             |  17 +-
 git_review.egg-info/SOURCES.txt          |   1 +
 git_review.egg-info/pbr.json             |   2 +-
 git_review.egg-info/requires.txt         |   1 -
 git_review/cmd.py                        | 402 ++++++++++++++++++++-----------
 git_review/tests/__init__.py             | 131 ++++++++--
 git_review/tests/check_test_id_hashes.py |  57 +++++
 git_review/tests/test_git_review.py      | 216 ++++++++++++-----
 git_review/tests/test_unit.py            |  90 +++++--
 requirements.txt                         |   1 -
 setup.cfg                                |   7 +-
 test-requirements.txt                    |   3 +-
 tox.ini                                  |   1 +
 20 files changed, 849 insertions(+), 294 deletions(-)

diff --git a/AUTHORS b/AUTHORS
index 0ecc870..cfabcbc 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -1,20 +1,26 @@
 Aaron Schulz <aschulz4587 at gmail.com>
 Alexander Jones <alex at weej.com>
 Anders Kaseorg <andersk at mit.edu>
+Andreas Jaeger <aj at suse.com>
 Andreas Jaeger <aj at suse.de>
 Andrew Karnani <andrew at akarnani.com>
 Anita Kuno <akuno at lavabit.com>
 Antoine Musso <hashar at free.fr>
+Atsushi SAKAI <sakaia at jp.fujitsu.com>
+Benjamin Pflanz <bpflanz at thombelle.com>
 Carlo Marcelo Arenas Belon <carenas at sajinet.com.pe>
 Catrope <roan.kattouw at gmail.com>
 Cedric Brandily <zzelle at gmail.com>
 Chmouel Boudjnah <chmouel at chmouel.com>
 Christian Berendt <berendt at b1-systems.de>
+Christoph Settgast <christoph.settgast at methodpark.com>
 Clark Boylan <clark.boylan at gmail.com>
 Clint Adams <clint at gcfm.net>
+Daniel Lublin <daniel at lublin.se>
 Daniel P. Berrange <berrange at redhat.com>
 Darragh Bailey <daragh.bailey at gmail.com>
 Darragh Bailey <dbailey at hp.com>
+David Caro <dcaroest at redhat.com>
 David Ostrovsky <david at ostrovsky.org>
 Dereckson <dereckson at espace-win.org>
 Dexter Fryar <dexter.fryar at outlook.com>
@@ -23,17 +29,23 @@ Dina Belova <dbelova at mirantis.com>
 Dmitry Ratushnyy <dratushn at cisco.com>
 Doug Hellmann <doug at doughellmann.com>
 Eric Harney <eharney at redhat.com>
+Frederic Lepied <frederic.lepied at enovance.com>
 Hugh Saunders <hugh at wherenow.org>
+Ian Wienand <iwienand at redhat.com>
+Ian Y. Choi <ianyrchoi at gmail.com>
 JC Delay <jcd.delay at gmail.com>
 James E. Blair <james.blair at rackspace.com>
+James E. Blair <jeblair at linux.vnet.ibm.com>
 Jason Axelson <bostonvaulter at gmail.com>
 Jeremy Stanley <fungi at yuggoth.org>
 John Vandenberg <jayvdb at gmail.com>
 Julien Danjou <julien at danjou.info>
 K Jonathan Harker <code at gentlydownthe.net>
+Khai Do <zaro0508 at gmail.com>
 Kiall Mac Innes <kiall at managedit.ie>
 Krenair <krenair at gmail.com>
 Lorin Hochstein <lorin at isi.edu>
+Lukas Bednar <lbednar at redhat.com>
 Marcin Cieslak <saper at saper.info>
 Mark McLoughlin <markmc at redhat.com>
 Matthieu Baerts <matttbe at gmail.com>
@@ -50,14 +62,21 @@ Paul Belanger <paul.belanger at polybeacon.com>
 Pavel Sedlák <psedlak at redhat.com>
 Pete Zaitcev <zaitcev at kotori.zaitcev.us>
 Roger Luethi <rl at patchworkscience.org>
+Sachi King <nakato at nakato.io>
 Saggi Mizrahi <smizrahi at redhat.com>
+Sorin Sbarnea <ssbarnea at redhat.com>
 Steve Kowalik <steven at wedontsleep.org>
+Swapnil Kulkarni (coolsvap) <me at coolsvap.net>
 Thomas Goirand <thomas at goirand.fr>
+Tim Burke <tim.burke at gmail.com>
 Tim Landscheidt <tim at tim-landscheidt.de>
 Vishvananda Ishaya <vishvananda at gmail.com>
 Yuriy Taraday <yorik.sar at gmail.com>
+Zane Bitter <zbitter at redhat.com>
+Zuul <zuul at review.openstack.org>
 david <dlenwell at gmail.com>
 gholt <z-launchpad at brim.net>
 julien.marinfrisonroche <julien.marinfrisonroche at thalesgroup.com>
 liuyang1 <lujing.zui at gmail.com>
+pangwa <pangwa at gmail.com>
 saper <saper at saper.info>
diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst
index 333d221..f125621 100644
--- a/CONTRIBUTING.rst
+++ b/CONTRIBUTING.rst
@@ -2,6 +2,16 @@
  Contributing to git-review
 ============================
 
+This tool is considered mostly feature-complete by its authors. It
+is meant to provide a simple, convenient tool for users of basic
+Gerrit change workflows. Contributions fixing bugs or regressions,
+maintaining support for newer Gerrit/Git releases and improving test
+coverage are welcome and encouraged. It is not, however, intended as
+an all-encompassing Gerrit client (there are plenty of other tools
+available supporting more advanced interactions), so proposed
+feature additions may make more sense implemented as complimentary
+``git`` subcommands or similar related but separate projects.
+
 To get the latest code, see: https://git.openstack.org/cgit/openstack-infra/git-review
 
 Bugs are handled at: https://storyboard.openstack.org/#!/project/719
diff --git a/ChangeLog b/ChangeLog
index e2d973a..fffa070 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,49 @@
 CHANGES
 =======
 
+1.26.0
+------
+
+* Add a note about contribution priorities
+* Add a note on Windows and Unicode
+* Fix output printing with python3
+* Handle http queries below /
+* Support git 2.15 and newer
+* show the config value result after fetching it in verbose mode
+* Actually output the warning
+* Fix listing changes over SSH for 2.14
+* Provide link to MediaWiki platform specific page
+* Better username detection for add\_remote()
+* Refactor displaying of reviews
+* Added topic field to the list output
+* Switch to string format to avoid interpolation issues
+* Refactor Isolated Env to use in unit tests
+* Set author and committer explicitly
+* Use hash of test ID to pick Gerrit ports in tests
+* Clarify that submitting multiple commits is OK
+* Remove discover from test-requirements
+* Install bc libs when running testsuite
+* Add several missing options to the man page
+* Fix AttributeError when can not connect to Gerrit
+* Set a default EXIT\_CODE for GitReviewException
+* Use consistent formatting for deprecations
+* Fix git-review -d behavior with branches
+* Support git without git credential
+* Remove worthless print
+* Fix no\_git\_dir UnboundLocalError in except block
+* Update gerrit version for testing
+* Remove argparse from requirements
+* Correct metadata URLs
+* Avoid AttributeError when raising raw GitReviewExceptions
+* fix encoding issue on Windows
+* Fix one typo on git-review documentation
+* Use git push-url instead of a second remote
+* Don't parse git log header for topic
+* Ignore .eggs cruft
+* Fix H238 violation and enable check for that rule
+* Update to newer hacking checks
+* Remove spurious mdoc directives
+
 1.25.0
 ------
 
@@ -18,22 +61,22 @@ CHANGES
 * Add utf-8 char support
 * Choose tracked branch for rebase when submitting
 * pbr should install the manpage
-* get_remote_url(): also honor url.*.pushInsteadOf
-* Support authentication in run_http_exc
+* get\_remote\_url(): also honor url.\*.pushInsteadOf
+* Support authentication in run\_http\_exc
 * Split README.rst into separate doc files
-* Handle correctly http error raise in run_http_exc
+* Handle correctly http error raise in run\_http\_exc
 * Fix encoding header
 * Workflow documentation is now in infra-manual
 * Update tests to use Gerrit 2.9.2
-* Use 'no_proxy' env variable in addition to uppercase
+* Use 'no\_proxy' env variable in addition to uppercase
 * Enable color support based on tty and config
-* get_remote_url(): honor any "url.<base>.insteadOf" config setting
-* Convert add_remote to use GitReviewExceptions
+* get\_remote\_url(): honor any "url.<base>.insteadOf" config setting
+* Convert add\_remote to use GitReviewExceptions
 * Prefer git-config over git-review config files
 * Isolate tests from user/system config
 * Switched documentation to point to storyboard
 * Fix ---list and "departement" typos in man page
-* Align git-review and python -m git_review.cmd behaviors
+* Align git-review and python -m git\_review.cmd behaviors
 * Define -T/--no-topic to disable review submit with topic
 * Work toward Python 3.4 support and testing
 * -F/--force-rebase has no effect if rebase is disabled by config
@@ -60,34 +103,34 @@ CHANGES
 * Ignore newline in bp/bug search in commit message
 * Restrict tests SSH auth to only the provided key
 * Disable proxies for tests that clone over http
-* Keep track of gerrit.war and golden_site versions
+* Keep track of gerrit.war and golden\_site versions
 * Fix typo in manpage s/gireview/gitreview/
 * Correct git review -l over http(s)
 * Topic: do not use '(detached' when detached
 * Use gerrit 2.8.5 instead of gerrit 2.6.1 in tests
 * Allow to specify default scheme in .gitreview file
-* Correct test_remote to support branchs without upstream
+* Correct test\_remote to support branchs without upstream
 * Remove parsing of --help and variants from our code
 * Python2: fixed UnicodeEncodeError
 * Skip invalid unicode in commit messages
 * Git review assumes the wrong ssh default port
-* Add http(s) protocol support to fetch_review and list_reviews
+* Add http(s) protocol support to fetch\_review and list\_reviews
 * git-review.1 manpage fix for groff warnings
 * Fix parsing of SCP-style URLs, as these are valid in Git itself
 * "git review --setup" failed in Chinese locale
 * Bump hacking version in requirements
 * Reduce testr concurrnecy to 2
-* Add http(s) protocol support to set_hooks_commit_msg
+* Add http(s) protocol support to set\_hooks\_commit\_msg
 * Retrieve remote pushurl independently of user's locale
-* Add http(s) protocol support to test_remote
+* Add http(s) protocol support to test\_remote
 * Verify if every attached file exists. Attach gerrig.config
 * Wrap exceptions that occur while running external process
 * Make Gerrit port and dir selection deterministic
-* Don't try to attach known_hosts if it's not there
+* Don't try to attach known\_hosts if it's not there
 * Remove tox locale overrides
 * Fix the regex for setting topic
 * Add 2m timeout to tests
-* Attach Gerrit logs and known_hosts to failed tests
+* Attach Gerrit logs and known\_hosts to failed tests
 * Change test gerrit ssh/http ports offset
 * Correct .Fl typo WRT --compare in the manual page
 * Ignore content of merge commits in reporting
@@ -127,13 +170,13 @@ CHANGES
 * Align to OpenStack Hacking guidelines
 * Switch to flake8 from pep8
 * Allow per-user override of -R setting
-* git_config_get_value to return None
+* git\_config\_get\_value to return None
 * Use the local branch name as topic only if it is different from remote
 * Jeremy's manpath workaround breaks on Fedora
 * Compare different Patch Sets of Review
 * bug/1144800: Fix fatal: both revision and filename
 * Changed the text of the manpage to read "make it easier to comprehend Gerrit"
-* Don't call get_branch_name from assert_one_change
+* Don't call get\_branch\_name from assert\_one\_change
 * Add custom scripts features
 * Download specific Patch Set for Review
 * Make README.md ReST-friendly
@@ -149,9 +192,9 @@ CHANGES
 * Update README for project move
 * Updated .gitreview location
 * Add mailing list to README
-* Use exceptions for list_reviews
-* Use exceptions for finish_review
-* Use exceptions for download_review
+* Use exceptions for list\_reviews
+* Use exceptions for finish\_review
+* Use exceptions for download\_review
 * git-review(1): explain exit code ranges
 * Introduce base exception classes
 * Follow up I92b8637c: Fix Python 3 compatibility
@@ -177,15 +220,15 @@ CHANGES
 * manpage minor fixes with no output changes
 * Make setup.py less Linux-specific, more UNIX-compliant
 * Fixing ponctuation issue
-* Introduce CommandFailed exception for run_command
-* Use run_command_status *argv for ssh and scp
-* Refactor run_command to use *args, **kwargs
-* Get rid of "status" parameter in run_command
+* Introduce CommandFailed exception for run\_command
+* Use run\_command\_status \*argv for ssh and scp
+* Refactor run\_command to use \*args, \*\*kwargs
+* Get rid of "status" parameter in run\_command
 * Due to gerrit bug regeneration of Change-Id must be nessecary
 * Don't rebase if the rebase doesn't conflict
 * Allow download of reviews from deleted accounts
 * Python 3 compatibility fixes
-* Add flag to push to refs/for/* for compatibilty
+* Add flag to push to refs/for/\* for compatibilty
 * Add Python 3 support
 * Just fixing a small typo
 * Revert to 1.17
@@ -210,12 +253,12 @@ CHANGES
 * Fix no-change detection
 * Fix pep8 errors with 1.3.1
 * Add optional 'submit' positional argument
-* Add flag to push to refs/for/* for compatibilty
+* Add flag to push to refs/for/\* for compatibilty
 * Add review scores to listing
 * Add Review, PatchSet and Hacker classes
-* Return a json result iterator from run_ssh_query()
+* Return a json result iterator from run\_ssh\_query()
 * Only list reviews for the current branch
-* Refactor out run_ssh_query() method
+* Refactor out run\_ssh\_query() method
 * Add Python 3 support
 * Just fixing a small typo
 * Start dev on 1.18
@@ -225,7 +268,7 @@ CHANGES
 
 * Fixed hook installation for git with submodules
 * Update publish ref from refs/for to refs/publish
-* Run 'git remote update' from assert_one_change
+* Run 'git remote update' from assert\_one\_change
 * Fix --list breakage in 3531a5bffd4f
 * Disable ssh X11 forwarding
 * Add support to list changes for review
@@ -289,7 +332,7 @@ CHANGES
 * Added dependencies in requirements.txt
 * Add myself to AUTHORS
 * Add support for Gerrit 2.2.2's "Draft" status
-* Remove useless username parameter from add_remote
+* Remove useless username parameter from add\_remote
 * Make the default branch configurable
 * Break out the config reading into its own method
 * Don't hardcode 'master'
@@ -338,7 +381,7 @@ CHANGES
 * Spruced up the README just a bit
 * Show branches and tags when showing git log
 * Better handling of the color git configuration
-* commit_msg declared but never used
+* commit\_msg declared but never used
 * In detached head, use the target branch as topic
 * Always show the list of outstanding commits
 * Fix multi-change confirmation testing
diff --git a/HACKING.rst b/HACKING.rst
index 17a97e4..e6ccb96 100644
--- a/HACKING.rst
+++ b/HACKING.rst
@@ -239,7 +239,7 @@ Running Tests
 -------------
 The testing system is based on a combination of tox and testr. The canonical
 approach to running tests is to simply run the command `tox`. This will
-create virtual environments, populate them with depenedencies and run all of
+create virtual environments, populate them with dependencies and run all of
 the tests that OpenStack CI systems run. Behind the scenes, tox is running
 `testr run --parallel`, but is set up such that you can supply any additional
 testr arguments that are needed to tox. For example, you can run:
diff --git a/PKG-INFO b/PKG-INFO
index d59a2eb..96eedb2 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,11 +1,12 @@
-Metadata-Version: 1.0
+Metadata-Version: 1.1
 Name: git-review
-Version: 1.25.0
+Version: 1.26.0
 Summary: Tool to submit code to Gerrit
-Home-page: https://docs.openstack.org/infra/git-review/
+Home-page: http://docs.openstack.org/infra/git-review/
 Author: OpenStack
 Author-email: openstack-infra at lists.openstack.org
 License: Apache License (2.0)
+Description-Content-Type: UNKNOWN
 Description: git-review
         ==========
         
@@ -22,3 +23,13 @@ Description: git-review
         
 Keywords: git gerrit review
 Platform: UNKNOWN
+Classifier: Programming Language :: Python :: 2
+Classifier: Programming Language :: Python :: 3
+Classifier: Programming Language :: Python
+Classifier: Development Status :: 5 - Production/Stable
+Classifier: Environment :: Console
+Classifier: Environment :: OpenStack
+Classifier: Intended Audience :: Developers
+Classifier: Intended Audience :: Information Technology
+Classifier: License :: OSI Approved :: Apache Software License
+Classifier: Operating System :: OS Independent
diff --git a/doc/source/installation.rst b/doc/source/installation.rst
index b290046..fa7cc4c 100644
--- a/doc/source/installation.rst
+++ b/doc/source/installation.rst
@@ -5,14 +5,29 @@
 Installing git-review
 =====================
 
-Install with pip install git-review
+``git-review`` can be often be installed via system packages, ``pypi``
+releases or other platform-specific methods.  See
+`<https://www.mediawiki.org/wiki/Gerrit/git-review>`__ for platform
+information.
 
-For assistance installing pip on your os check out get-pip:
-http://pip.readthedocs.org/en/latest/installing.html
+For assistance installing pacakges from ``pypi`` on your OS check out
+`get-pip.py <https://pip.pypa.io/en/stable/installing/>`__.
 
-For installation from source simply add git-review to your $PATH
+For installation from source simply add ``git-review`` to your $PATH
 after installing the dependencies listed in requirements.txt
 
+.. note:: ``git-review`` requires git version 1.8 or greater.
+
+Windows
+-------
+
+The Windows ``cmd`` console has a number of issues with Python and
+Unicode encodings which can manifest when reviews include non-ASCII
+characters.  Python 3.6 and beyond has addressed most issues and is
+recommended for Windows users.  For earlier Python versions,
+modifying the local install with `win-unicode-console
+<https://github.com/Drekin/win-unicode-console>`__ may also help.
+
 Setup
 =====
 
diff --git a/git-review.1 b/git-review.1
index 9ba4c7e..e7afcf4 100644
--- a/git-review.1
+++ b/git-review.1
@@ -60,13 +60,15 @@ can be
 .Ar changeNumber
 as obtained using
 .Fl \-list
-option, or it can be 
+option, or it can be
 .Ar changeNumber,patchsetNumber
 for fetching exact patchset from the change.
 In that case local branch name will have a \-patch[patchsetNumber] suffix.
 .Pp
 The following options are available:
 .Bl -tag -width indent
+.It Fl c , Fl \-compatible
+Push changes to refs compatible with Gerrit of versions before 2.3.
 .It Fl d Ar change , Fl \-download= Ns Ar change
 Download
 .Ar change
@@ -106,6 +108,9 @@ creating a local branch for it.
 .Pp
 If the current branch is different enough, the change may not apply at all
 or produce merge conflicts that need to be resolved by hand.
+.It Fl i , Fl \-new\-changeid
+Force the git-review to generate a new Change-Id, even if one already exists
+in the changelog.
 .It Fl m Ar change\-ps\-range , Fl \-compare= Ns Ar change\-ps\-range
 Download the specified  patchsets for
 .Ar change
@@ -131,6 +136,8 @@ to always skip rebasing.
 .It Fl f , Fl \-finish
 Close down the local branch and switch back to the target branch on
 successful submission.
+.It Fl F , Fl \-force\-rebase
+Force a rebase before doing anything else, even if not otherwise needed.
 .It Fl n , Fl \-dry\-run
 Don\(aqt actually perform any commands that have direct effects. Print them
 instead.
@@ -139,7 +146,7 @@ Git remote to use for Gerrit.
 .It Fl s , Fl \-setup
 Just run the repo setup commands but don\(aqt submit anything.
 .It Fl t Ar topic , Fl \-topic= Ns Ar topic
-Sets the target topic for this change on the gerrit server.
+Sets the target topic for this change on the Gerrit server.
 If not specified, a bug number from the commit summary will be used. Alternatively, the local branch name will be used if different from remote branch.
 .It Fl T , Fl \-no\-topic
 Submit review without topic.
@@ -148,11 +155,11 @@ Subscribe one or more reviewers to the uploaded patch sets.  Reviewers should be
 .It Fl u , Fl \-update
 Skip cached local copies and force updates from network resources.
 .It Fl l , Fl \-list
-List the available reviews on the gerrit server for this project.
+List the available reviews on the Gerrit server for this project.
 .It Fl y , Fl \-yes
 Indicate that you do, in fact, understand if you are submitting more than
 one patch.
-.It Fl v Fl \-verbose
+.It Fl v , Fl \-verbose
 Turns on more verbose output.
 .It Fl D , Fl \-draft
 Submit review as a draft. Requires Gerrit 2.3 or newer.
@@ -165,6 +172,13 @@ When submitting a change for review, you will usually want it to be based on the
 Also can be used for
 .Fl \-compare
 to skip automatic rebase of fetched reviews.
+.It Fl \-color Ar always|never|auto
+Enable or disable a color output. Default is "auto".
+.It Fl \-no\-color
+Same thing as \-\-color=never.
+.It Fl \-no\-custom\-script
+Do not run scripts, installed as hooks/{action}-review, where action
+is one of "pre", "draft", or "post".
 .It Fl \-track
 Choose the branch to submit the change against (and, if
 rebasing, to rebase against) from the branch being tracked
@@ -177,6 +191,9 @@ Ignore any branch being tracked by the current branch,
 overriding gitreview.track.
 This option is implied by providing a specific branch name
 on the command line.
+.It Fl \-use-pushurl
+Use the pushurl option for the origin remote rather than conventional
+separate Gerrit remotes.
 .It Fl \-version
 Print the version number and exit.
 .El
@@ -200,22 +217,16 @@ username=\fImygerrituser\fP
 .Ed
 .It gitreview.scheme
 This setting determines the default scheme (ssh/http/https) of gerrit remote
-.Ed
 .It gitreview.host
 This setting determines the default hostname of gerrit remote
-.Ed
 .It gitreview.port
 This setting determines the default port of gerrit remote
-.Ed
 .It gitreview.project
 This setting determines the default name of gerrit git repo
-.Ed
 .It gitreview.remote
 This setting determines the default name to use for gerrit remote
-.Ed
 .It gitreview.branch
 This setting determines the default branch
-.Ed
 .It gitreview.track
 Determines whether to prefer the currently-tracked branch (if any)
 and the branch against which the changeset was submitted to Gerrit
@@ -246,7 +257,6 @@ changes. This is the default value unless overridden by
 file, and is implied by providing a specific branch name on the
 command line.
 .El
-.Ed
 .It gitreview.rebase
 This setting determines whether changes submitted will
 be rebased to the newest state of the branch.
@@ -285,10 +295,10 @@ If you wish not to use color for any output. (default with Git older than 1.8.4)
 .El
 .Pp
 .Nm
-will query git credential system for gerrit user/password when
+will query git credential system for Gerrit user/password when
 authentication failed over http(s). Unlike git,
 .Nm
-does not persist gerrit user/password in git credential system for security
+does not persist Gerrit user/password in git credential system for security
 purposes and git credential system configuration stays under user responsibility.
 .Sh FILES
 To use
@@ -296,7 +306,7 @@ To use
 with your project, it is recommended that you create
 a file at the root of the repository named
 .Pa .gitreview
-and place information about your gerrit installation in it.  The format is similar to the Windows .ini file format:
+and place information about your Gerrit installation in it.  The format is similar to the Windows .ini file format:
 .Bd -literal -offset indent
 [gerrit]
 host=\fIhostname\fP
@@ -360,6 +370,8 @@ Particular patchset cannot be fetched from the remote git repository.
 Specified patchset number not found in the changeset.
 .It 39
 Invalid patchsets for comparison.
+.It 40
+Connection to Gerrit was closed.
 .It 64
 Cannot checkout downloaded patchset into the new branch.
 .It 65
diff --git a/git_review.egg-info/PKG-INFO b/git_review.egg-info/PKG-INFO
index d59a2eb..96eedb2 100644
--- a/git_review.egg-info/PKG-INFO
+++ b/git_review.egg-info/PKG-INFO
@@ -1,11 +1,12 @@
-Metadata-Version: 1.0
+Metadata-Version: 1.1
 Name: git-review
-Version: 1.25.0
+Version: 1.26.0
 Summary: Tool to submit code to Gerrit
-Home-page: https://docs.openstack.org/infra/git-review/
+Home-page: http://docs.openstack.org/infra/git-review/
 Author: OpenStack
 Author-email: openstack-infra at lists.openstack.org
 License: Apache License (2.0)
+Description-Content-Type: UNKNOWN
 Description: git-review
         ==========
         
@@ -22,3 +23,13 @@ Description: git-review
         
 Keywords: git gerrit review
 Platform: UNKNOWN
+Classifier: Programming Language :: Python :: 2
+Classifier: Programming Language :: Python :: 3
+Classifier: Programming Language :: Python
+Classifier: Development Status :: 5 - Production/Stable
+Classifier: Environment :: Console
+Classifier: Environment :: OpenStack
+Classifier: Intended Audience :: Developers
+Classifier: Intended Audience :: Information Technology
+Classifier: License :: OSI Approved :: Apache Software License
+Classifier: Operating System :: OS Independent
diff --git a/git_review.egg-info/SOURCES.txt b/git_review.egg-info/SOURCES.txt
index ee98c1c..ec344fc 100644
--- a/git_review.egg-info/SOURCES.txt
+++ b/git_review.egg-info/SOURCES.txt
@@ -30,6 +30,7 @@ git_review.egg-info/pbr.json
 git_review.egg-info/requires.txt
 git_review.egg-info/top_level.txt
 git_review/tests/__init__.py
+git_review/tests/check_test_id_hashes.py
 git_review/tests/prepare.py
 git_review/tests/test_git_review.py
 git_review/tests/test_unit.py
diff --git a/git_review.egg-info/pbr.json b/git_review.egg-info/pbr.json
index 33b64ba..4c3e535 100644
--- a/git_review.egg-info/pbr.json
+++ b/git_review.egg-info/pbr.json
@@ -1 +1 @@
-{"is_release": true, "git_version": "8020448"}
\ No newline at end of file
+{"git_version": "ad59206", "is_release": true}
\ No newline at end of file
diff --git a/git_review.egg-info/requires.txt b/git_review.egg-info/requires.txt
index e28f5fb..944892c 100644
--- a/git_review.egg-info/requires.txt
+++ b/git_review.egg-info/requires.txt
@@ -1,2 +1 @@
-argparse
 requests>=1.1
diff --git a/git_review/cmd.py b/git_review/cmd.py
index cac99a5..b06b06d 100755
--- a/git_review/cmd.py
+++ b/git_review/cmd.py
@@ -20,6 +20,7 @@ limitations under the License."""
 
 import argparse
 import datetime
+import getpass
 import json
 import os
 import re
@@ -57,7 +58,7 @@ GLOBAL_CONFIG = "/etc/git-review/git-review.conf"
 USER_CONFIG = os.path.join(CONFIGDIR, "git-review.conf")
 DEFAULTS = dict(scheme='ssh', hostname=False, port=None, project=False,
                 branch='master', remote="gerrit", rebase="1",
-                track="0")
+                track="0", usepushurl="0")
 
 _branch_name = None
 _has_color = None
@@ -67,14 +68,15 @@ _rewrites = None
 _rewrites_push = None
 
 
-class colors:
+class colors(object):
     yellow = '\033[33m'
     green = '\033[92m'
     reset = '\033[0m'
+    blue = '\033[36m'
 
 
 class GitReviewException(Exception):
-    pass
+    EXIT_CODE = 127
 
 
 class CommandFailed(GitReviewException):
@@ -110,6 +112,10 @@ def printwrap(unwrapped):
     print('\n'.join(textwrap.wrap(unwrapped)))
 
 
+def warn(warning):
+    printwrap("WARNING: %s" % warning)
+
+
 def parse_review_number(review):
     parts = review.split(',')
     if len(parts) < 2:
@@ -141,9 +147,8 @@ def run_command_status(*argv, **kwargs):
                          stdin=subprocess.PIPE if stdin else None,
                          stdout=subprocess.PIPE,
                          stderr=subprocess.STDOUT,
-                         env=newenv)
+                         env=newenv, universal_newlines=True)
     (out, nothing) = p.communicate(stdin)
-    out = out.decode('utf-8', 'replace')
     return (p.returncode, out.strip())
 
 
@@ -163,11 +168,13 @@ def run_command_exc(klazz, *argv, **env):
     return output
 
 
-def git_credentials(klazz, url):
-    """Get credentials using git credential."""
+def git_credentials(url):
+    """Return credentials using git credential or None."""
     cmd = 'git', 'credential', 'fill'
     stdin = 'url=%s' % url
-    out = run_command_exc(klazz, *cmd, stdin=stdin)
+    rc, out = run_command_status(*cmd, stdin=stdin.encode('utf-8'))
+    if rc:
+        return None
     data = dict(l.split('=', 1) for l in out.splitlines())
     return data['username'], data['password']
 
@@ -192,8 +199,10 @@ def run_http_exc(klazz, url, **env):
     try:
         res = requests.get(url, **env)
         if res.status_code == 401:
-            env['auth'] = git_credentials(klazz, url)
-            res = requests.get(url, **env)
+            creds = git_credentials(url)
+            if creds:
+                env['auth'] = creds
+                res = requests.get(url, **env)
     except klazz:
         raise
     except Exception as err:
@@ -261,9 +270,14 @@ def git_config_get_value(section, option, default=None, as_bool=False):
         __, git_dir = git_directories()
         cmd[2:2] = ['-f', os.path.join(git_dir, 'config')]
     try:
-        return run_command_exc(GitConfigException, *cmd).strip()
+        result = run_command_exc(GitConfigException, *cmd).strip()
+        if VERBOSE:
+            print(datetime.datetime.now(), "result:", result)
+        return result
     except GitConfigException as exc:
         if exc.rc == 1:
+            if VERBOSE:
+                print(datetime.datetime.now(), "using default:", default)
             return default
         raise
 
@@ -280,8 +294,9 @@ class Config(object):
             if os.path.exists(filename):
                 if filename != config_file:
                     msg = ("Using global/system git-review config files (%s) "
-                           "is deprecated")
-                    print(msg % filename)
+                           "is deprecated and will be removed in a future "
+                           "release")
+                    warn(msg % filename)
                 self.config.update(load_config_file(filename))
 
     def __getitem__(self, key):
@@ -369,15 +384,13 @@ def make_remote_url(scheme, username, hostname, port, project):
         return "%s://%s@%s/%s" % (scheme, username, hostport, project)
 
 
-def add_remote(scheme, hostname, port, project, remote):
+def add_remote(scheme, hostname, port, project, remote, usepushurl):
     """Adds a gerrit remote."""
     asked_for_username = False
 
     username = git_config_get_value("gitreview", "username")
     if not username:
-        username = os.getenv("USERNAME")
-    if not username:
-        username = os.getenv("USER")
+        username = getpass.getuser()
 
     remote_url = make_remote_url(scheme, username, hostname, port, project)
     if VERBOSE:
@@ -388,15 +401,20 @@ def add_remote(scheme, hostname, port, project, remote):
         remote_url = make_remote_url(scheme, username, hostname, port, project)
         print("Trying again with %s" % remote_url)
         if not test_remote_url(remote_url):
-            raise GitReviewException("Could not connect to gerrit at "
-                                     "%s" % remote_url)
+            raise GerritConnectionException(
+                "Could not connect to gerrit at %s" % remote_url
+            )
         asked_for_username = True
 
-    print("Creating a git remote called \"%s\" that maps to:" % remote)
+    if usepushurl:
+        cmd = "git remote set-url --push %s %s" % (remote, remote_url)
+        print("Adding a git push url to '%s' that maps to:" % remote)
+    else:
+        cmd = "git remote add -f %s %s" % (remote, remote_url)
+        print("Creating a git remote called '%s' that maps to:" % remote)
     print("\t%s" % remote_url)
-    cmd = "git remote add -f %s %s" % (remote, remote_url)
-    (status, remote_output) = run_command_status(cmd)
 
+    (status, remote_output) = run_command_status(cmd)
     if status != 0:
         raise CommandFailed(status, remote_output, cmd, {})
 
@@ -532,29 +550,49 @@ def parse_gerrit_ssh_params_from_git_url(git_url):
     return (hostname, username, port, project_name)
 
 
-def query_reviews(remote_url, change=None, current_patch_set=True,
-                  exception=CommandFailed, parse_exc=Exception):
+def query_reviews(remote_url, project=None, change=None,
+                  current_patch_set=True, exception=CommandFailed,
+                  parse_exc=Exception):
     if remote_url.startswith('http://') or remote_url.startswith('https://'):
         query = query_reviews_over_http
     else:
         query = query_reviews_over_ssh
     return query(remote_url,
+                 project=project,
                  change=change,
                  current_patch_set=current_patch_set,
                  exception=exception,
                  parse_exc=parse_exc)
 
 
-def query_reviews_over_http(remote_url, change=None, current_patch_set=True,
-                            exception=CommandFailed, parse_exc=Exception):
-    url = urljoin(remote_url, '/changes/')
+def query_reviews_over_http(remote_url, project=None, change=None,
+                            current_patch_set=True, exception=CommandFailed,
+                            parse_exc=Exception):
+    if project:
+        # Remove any trailing .git suffixes for project to url comparison
+        clean_url = os.path.splitext(remote_url)[0]
+        clean_project = os.path.splitext(project)[0]
+        if clean_url.endswith(clean_project):
+            # Get the "root" url for gerrit by removing the project from the
+            # url. For example:
+            # https://example.com/foo/project.git gets truncated to
+            # https://example.com/foo/ regardless of whether or not none,
+            # either, or both of the remote_url or project strings end
+            # with .git.
+            remote_url = clean_url[:-len(clean_project)]
+    url = urljoin(remote_url, 'changes/')
     if change:
         if current_patch_set:
             url += '?q=%s&o=CURRENT_REVISION' % change
         else:
             url += '?q=%s&o=ALL_REVISIONS' % change
     else:
-        project_name = re.sub(r"^/|(\.git$)", "", urlparse(remote_url).path)
+        if project:
+            project_name = re.sub(r"^/|(\.git$)", "",
+                                  project)
+        else:
+            project_name = re.sub(r"^/|(\.git$)", "",
+                                  urlparse(remote_url).path)
         params = urlencode({'q': 'project:%s status:open' % project_name})
         url += '?' + params
 
@@ -585,8 +623,9 @@ def query_reviews_over_http(remote_url, change=None, current_patch_set=True,
     return reviews
 
 
-def query_reviews_over_ssh(remote_url, change=None, current_patch_set=True,
-                           exception=CommandFailed, parse_exc=Exception):
+def query_reviews_over_ssh(remote_url, project=None, change=None,
+                           current_patch_set=True, exception=CommandFailed,
+                           parse_exc=Exception):
     (hostname, username, port, project_name) = \
         parse_gerrit_ssh_params_from_git_url(remote_url)
 
@@ -678,6 +717,7 @@ def load_config_file(config_file):
         'remote': 'defaultremote',
         'rebase': 'defaultrebase',
         'track': 'track',
+        'usepushurl': 'usepushurl',
     }
     config = {}
     for config_key, option_name in options.items():
@@ -732,42 +772,57 @@ def resolve_tracking(remote, branch):
     return remote, branch
 
 
-def check_remote(branch, remote, scheme, hostname, port, project):
+def check_remote(branch, remote, scheme, hostname, port, project,
+                 usepushurl=False):
     """Check that a Gerrit Git remote repo exists, if not, set one."""
 
-    has_color = check_color_support()
-    if has_color:
-        color_never = "--color=never"
+    if usepushurl:
+        push_url = git_config_get_value('remote.%s' % remote, 'pushurl', None)
+        if push_url:
+            return
     else:
-        color_never = ""
+        has_color = check_color_support()
+        if has_color:
+            color_never = "--color=never"
+        else:
+            color_never = ""
 
-    if remote in run_command("git remote").split("\n"):
+        if remote in run_command("git remote").split("\n"):
 
-        remotes = run_command("git branch -a %s" % color_never).split("\n")
-        for current_remote in remotes:
-            if (current_remote.strip() == "remotes/%s/%s" % (remote, branch)
-                    and not UPDATE):
-                return
-        # We have the remote, but aren't set up to fetch. Fix it
-        if VERBOSE:
-            print("Setting up gerrit branch tracking for better rebasing")
-        update_remote(remote)
-        return
+            remotes = run_command("git branch -a %s" % color_never).split("\n")
+            for current_remote in remotes:
+                remote_string = "remotes/%s/%s" % (remote, branch)
+                if (current_remote.strip() == remote_string and not UPDATE):
+                    return
+            # We have the remote, but aren't set up to fetch. Fix it
+            if VERBOSE:
+                print("Setting up gerrit branch tracking for better rebasing")
+            update_remote(remote)
+            return
 
     if hostname is False or project is False:
         # This means there was no .gitreview file
         printwrap("No '.gitreview' file found in this repository. We don't "
-                  "know where your gerrit is. Please manually create a remote "
-                  "named \"%s\" and try again." % remote)
+                  "know where your gerrit is.")
+        if usepushurl:
+            printwrap("Please set the push-url on your origin remote to the "
+                      "location of your gerrit server and try again")
+        else:
+            printwrap("Please manually create a remote "
+                      "named \"%s\" and try again." % remote)
         sys.exit(1)
 
     # Gerrit remote not present, try to add it
     try:
-        add_remote(scheme, hostname, port, project, remote)
+        add_remote(scheme, hostname, port, project, remote, usepushurl)
     except Exception:
-        print(sys.exc_info()[2])
-        printwrap("We don't know where your gerrit is. Please manually create "
-                  "a remote named \"%s\" and try again." % remote)
+        if usepushurl:
+            printwrap("We don't know where your gerrit is. Please manually"
+                      " add a push-url to the '%s' remote and try again."
+                      % remote)
+        else:
+            printwrap("We don't know where your gerrit is. Please manually"
+                      " create a remote named '%s' and try again." % remote)
         raise
 
 
@@ -809,13 +864,13 @@ def rebase_changes(branch, remote, interactive=True):
         print("Errors running %s" % cmd)
         if interactive:
             print(output)
-            print("It is likely that your change has a merge conflict. "
-                  "You may resolve it in the working tree now as "
-                  "described above and then run 'git review' again, or "
-                  "if you do not want to resolve it yet (note that the "
-                  "change can not merge until the conflict is resolved) "
-                  "you may run 'git rebase --abort' then 'git review -R' "
-                  "to upload the change without rebasing.")
+            printwrap("It is likely that your change has a merge conflict. "
+                      "You may resolve it in the working tree now as "
+                      "described above and then run 'git review' again, or "
+                      "if you do not want to resolve it yet (note that the "
+                      "change can not merge until the conflict is resolved) "
+                      "you may run 'git rebase --abort' then 'git review -R' "
+                      "to upload the change without rebasing.")
         return False
     return True
 
@@ -872,9 +927,12 @@ def assert_one_change(remote, branch, yes, have_hook):
         if not yes:
             printwrap("You are about to submit multiple commits. This is "
                       "expected if you are submitting a commit that is "
-                      "dependent on one or more in-review commits. Otherwise "
-                      "you should consider squashing your changes into one "
-                      "commit before submitting.")
+                      "dependent on one or more in-review commits, or if you "
+                      "are submitting multiple self-contained but dependent "
+                      "changes. Otherwise you should consider squashing your "
+                      "changes into one commit before submitting (for "
+                      "indivisible changes) or submitting from separate "
+                      "branches (for independent changes).")
             print("\nThe outstanding commits are:\n\n%s\n\n"
                   "Do you really want to submit the above commits?" % output)
             yes_no = do_input("Type 'yes' to confirm, other to cancel: ")
@@ -900,7 +958,14 @@ def get_topic(target_branch):
                          "for the topic of the change submitted",
                          "/".join(branch_parts[2:]))
... 1187 lines suppressed ...

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/git-review.git



More information about the Python-modules-commits mailing list