411 Commits

Author SHA1 Message Date
Jenkins
e0e96f536d Merge "Better determine git directories" 2013-02-03 23:46:13 +00:00
Marcin Cieslak
686f1b0c6b Document gitreview.username
Document git-review specific options
in the Git configuration system.

Currently we have only gitreview.username,
but another one (gitreview.rebase) is
pending in change I96dfab1af48d8f1592766fea4b97e0f35c03d8a5.

Change-Id: I5b34effee355e0075fa3c2c2acea4429198d7e85
2013-01-31 02:30:29 +01:00
Marcin Cieslak
ddcfafda07 Better determine git directories
- Call "git-rev-parse" only once, not twice
- In case where current directory is unreadable,
the current message is:

No '.gitreview' file found in this repository.
We don't know where your gerrit is. Please manually create
a remote named gerrit and try again.

(which is not true, because .gitreview *is* present)

After this change it fails a bit better:

Cannot determine where .git directory is
The following command failed with exit code 128
    "git rev-parse --show-toplevel --git-dir"
-----------------------
fatal: Unable to read current working directory: No such
file or directory
-----------------------

Change-Id: Idbb1e68b689f226d9434db131db5d9765752a315
2013-01-31 00:56:44 +01:00
Jenkins
21da8d546c Merge "Don't fetch remote outside of rebase flow." 2013-01-30 20:07:09 +00:00
Monty Taylor
4898ca5b67 Don't fetch remote outside of rebase flow.
The assert_one_change code checks your changes against the set of changes in
the branch that you're submitting to. It's not necessary to have the absolute
latest changes to do the safety check ... the worst that will happen is that
you'll be prompted about a patch that's already merged.

However, if you run without -R, you'll get the update fetched anyway.

If you run _WITH_ -R, then we're doing a network access that you don't need
anyway.

Change-Id: I466aa81a521f784d9afc1dbae914c68a33ff79f5
2013-01-25 11:57:06 +11:00
Miklos Vajna
e1e9d2ccfa Make it possible to cherry-pick a change
Option -d already makes it possible to get a change into a separate
branch, but for large projects and trivial changes, it makes sense to
also be able to just cherry-pick the change to the currently active
local branch.

Also add modes that invokes "git cherry-pick -n" or "git cherry-pick
-x".  Program exits with exit code 69 whenever "git cherry-pick" fails.

This feature was subsequently amended by Marcin Cieślak
<saper@saper.info>.

Change-Id: I0a30052fb2baf357ed81e3f1ef4618bf786cb7ee
2013-01-24 09:30:07 +01:00
Yuriy Taraday
b8f228118e Check HEAD for extra commits instead of master
Removes noise if one pushes to master from detached HEAD or just another branch

Change-Id: Icd62c2ee359b95877097a57a3b517434d9f7f5e0
2013-01-23 17:25:56 +00:00
Krenair
47d99c7756 Check that the owner of a change has name defined
Sometimes Gerrit might not return owner name
due to some internal misconfiguration or database
problem. Since we are using owner name here to
generate the name of a local git branch, instead
of failing here we should try to just go ahead
with 'unknown'.

More information about this error:

https://bugzilla.wikimedia.org/show_bug.cgi?id=40061#c5
https://gerrit.wikimedia.org/r/#/c/37771/

Change-Id: Icaa9baa453e3fd7d54adf9138a9435e4271cee0a
2013-01-23 17:20:35 +00:00
Marcin Cieslak
cac1cb7a6b Topic name should be determined only for git push
When setting up git-review, it tries to acquire a topic name although
that is of no use to setup.  A side effect is that git-review can not be
setup whenever the git remote is a fresh repository since it get no
branch. Solve this by moving it after the setup routines.

Inform the user why the particular topic name has been selected.

Change-Id: Iaa942b8dc77b0c3f720085358c38e8295138025a
2013-01-23 17:13:48 +00:00
Marcin Cieslak
a5c4a4d042 Fix regression in repeated -d of the same change.
Fixes bug 1092943.

* git-review(download_review): Earlier refactoring in commit 4511318
resulted in checking the wrong output for existing branch errors,
since it moved into the exception data. Fixed in this commit.

Change-Id: I761b01c70ab93e77b112ddf85c63a829d5334196
2012-12-21 20:23:55 +01:00
Marcin Cieslak
dd23f84ba1 Remove two else: blocks in main()
Don't check for status of finish_remote()
since an exception will be returned.

Remove else: blocks and use return to
make logic a bit more readable with
less intendation.

Change-Id: I83172dfeb786adc3e925116c39e7ffdc616de893
2012-12-19 00:58:14 +00:00
Jenkins
74a58a04d3 Merge "Use exceptions for list_reviews" 2012-12-19 00:44:13 +00:00
Jenkins
6dfb5e1ac1 Merge "Use exceptions for finish_review" 2012-12-19 00:43:21 +00:00
Jenkins
dc53a2ade9 Merge "Use exceptions for download_review" 2012-12-19 00:42:37 +00:00
Jenkins
8aabea8a2b Merge "git-review(1): explain exit code ranges" 2012-12-19 00:41:53 +00:00
Jenkins
84e3b83656 Merge "Introduce base exception classes" 2012-12-19 00:41:03 +00:00
Jenkins
8b74dac797 Merge "Update README for project move." 2012-12-16 20:27:15 +00:00
Jeremy Stanley
3ab3912588 Update README for project move.
* README.md: Correct .gitreview sample and Github URL.

Change-Id: I6aa23a54c3acd756141777513867d49873355027
2012-12-16 19:36:00 +00:00
Monty Taylor
61d0cac945 Updated .gitreview location
Change-Id: If0ea43e9b6d0b53f4bc9408e6e907c1b7006f3fa
2012-12-16 10:40:51 -08:00
James E. Blair
eda8d5f9aa Add mailing list to README.
Change-Id: Ib76d80227177ec4ab5aca6d417c0728b425f1f0f
2012-12-14 10:09:12 -08:00
Marcin Cieslak
4fbd426c9e Use exceptions for list_reviews
Add exceptions to errors that might
happend when listing open changes
for review.

Use exit codes 32 and 33 for exceptions.

Change-Id: I8a94fd0e13bbf1dbc9f01ca03a319628ca497d81
2012-12-13 22:04:04 +00:00
Marcin Cieslak
5e83096b8d Use exceptions for finish_review
Add exceptions to errors that might
happend when closing a branch.

Allocate exit codes 67,68 for
for errors related to removing
the branch.

Change-Id: I9ba37ca5a69ded1421845a8d1a40bd6be22addca
2012-12-13 21:56:52 +00:00
Marcin Cieslak
4511318b8d Use exceptions for download_review
Add exceptions to errors that might
happend when fetching a change
for review.

Handle non-existing changeset number
better (don't fail on KeyError).

Better error message when the change
number is correct, but cannot be
fetched into the current project.

Allocate exit codes 34,35,36,37 and
64,65 for errors related to patchset
download.

Change-Id: I8bb7dd9418dc9488ff80b572a4494afa39472128
2012-12-13 21:50:28 +00:00
Marcin Cieslak
eb079de085 git-review(1): explain exit code ranges
32..63 - remote communication with gerrit/git repository
>64 - problems with local git repository

[reintroduction of previously reverted 78b6ace]

Change-Id: I0dbd87fd7566ff7c659bc1066643f347801daaa3
2012-12-13 21:21:38 +00:00
Marcin Cieslak
29d9741fc7 Introduce base exception classes
GitReviewException:

Handle also exceptions that are
not related to the failed external
commands at toplevel.

ChangeSetException:

For exceptions not related to the
execution of the external command;
such an exception is associated
with a change set identifier.

[reintroduction of previously re-re-reverted b744111]

Change-Id: I8b850ba0b611b452acbacb21393f86858e72099a
2012-12-13 21:12:04 +00:00
Krenair
241622990e Follow up I92b8637c: Fix Python 3 compatibility.
This should fix the error I get when trying to update from git-review 1.19:

alex@alex:/var/www/MediaWiki/Git/core$ sudo pip install -U git-review
[sudo] password for alex:
Downloading/unpacking git-review from http://pypi.python.org/packages/source/g/git-review/git-review-1.20.tar.gz#md5=d8446f99fd4ef2cc8090bef2c9eac294
  Downloading git-review-1.20.tar.gz
  Running setup.py egg_info for package git-review
    Traceback (most recent call last):
      File "<string>", line 16, in <module>
      File "/tmp/pip-build/git-review/setup.py", line 25, in <module>
        exec(open("git-review").read())
      File "<string>", line 864
        except CommandFailed, e:
                            ^
    SyntaxError: invalid syntax
[...]

Change-Id: I1aa43f7bb14bbf68c3a63f2225fb91d1ad53124b
2012-12-01 17:50:30 +00:00
Jenkins
62eaba8b4b Merge "Remove reference to nonexistent requirements.txt." 2012-11-21 22:33:36 +00:00
James E. Blair
8eb3225a0f Start development on 1.21.
Change-Id: I53ccd5a233b75f6f2f8c4cfe4e8ecee8d608149a
2012-11-20 13:19:05 -08:00
Jeremy Stanley
4529019f44 Remove reference to nonexistent requirements.txt.
* MANIFEST.in: There is no requirements.txt, so stop trying to
include it.

Change-Id: I8add2be8a89cfd81b08ae73c2310b848c7af8d67
2012-11-20 21:12:19 +00:00
Jeremy Stanley
4b286c2c44 Avoid symlinks in the manpage path.
* setup.py: This works around bug 1073766, what appears to be an
upstream installer issue exposed by e7b8dc61. When attempting to
idempotently create the full destination path, it will fail cryptically
on any existing symlink it finds (expecting only real directories).

Change-Id: I1e502b86854fd6ac57974b579af48cd75d3e7752
2012-11-02 02:31:51 +00:00
James E. Blair
a56046a21d Start development on 1.20.
Change-Id: I0b89336185bff7ce10438e45e3d997430cb91044
2012-10-31 18:23:06 +01:00
James E. Blair
69a5f54991 Revert "Introduce base exception classes"
This reverts commit 7486ca41531eba0d4a11eebcd5c3545397146c14
2012-10-31 16:58:48 +00:00
Monty Taylor
7486ca4153 Introduce base exception classes
This reverts commit b69864179f507c1a67be48ef26f84271f55ae313
2012-10-31 09:49:15 +00:00
Monty Taylor
b69864179f Revert "Introduce base exception classes"
This reverts commit b744111c80609321e83ddb84975339eba6b89e3c
2012-10-31 09:48:08 +00:00
Monty Taylor
0587086b4d Revert "git-review(1): explain exit code ranges"
This reverts commit 78b6aceec0977c6deed104571de485c1236d04cf
2012-10-31 09:45:57 +00:00
Marcin Cieslak
78b6aceec0 git-review(1): explain exit code ranges
32..63 - remote communication with gerrit/git repository
>64 - problems with local git repository

Change-Id: I490b150c68445d3d0297ffc977567a9119d123dc
2012-10-30 17:41:12 +01:00
Marcin Cieslak
b744111c80 Introduce base exception classes
GitReviewException:

Handle also exceptions that are
not related to the failed external
commands at toplevel.

ChangeSetException:

For exceptions not related to the
execution of the external command;
such an exception is associated
with a change set identifier.

Change-Id: I8d165d1dfee5ec4e61487565e90b033fb6f58acf
2012-10-30 15:46:11 +01:00
Jenkins
b4a9268301 Merge "Review list fields should have constant widths" 2012-10-29 16:16:34 +00:00
Marcin Cieslak
1f982d231e Review list fields should have constant widths
When asking for a list of review, the decimal change number can have a
vary length which could cause the list to not be properly aligned.

This patch keeps track of the widths of particular fields,
applies color control characters and crafs a format string.

Change# and branch are right justified, commit entry is
left justified.

Change-Id: I2d9114ed76a40cd029e96b69f5e1c2df9ff430f9
2012-10-28 22:54:22 -07:00
Carlo Marcelo Arenas Belon
a8945b8979 manpage minor fixes with no output changes
as shown by `groff -mdoc git-review.1`

* avoid warnings about empty input lines
* avoid warnings about .Bd not having a matching .Ed

Change-Id: Iba775f72f2ac7c6f694d2b89165fed27984641f3
2012-10-25 23:33:23 -07:00
Jenkins
10a65f4632 Merge "Make setup.py less Linux-specific, more UNIX-compliant." 2012-10-25 18:47:15 +00:00
Jenkins
8389bc5a35 Merge "Introduce CommandFailed exception for run_command" 2012-10-25 18:46:52 +00:00
Jenkins
7702dfeec5 Merge "Use run_command_status *argv for ssh and scp" 2012-10-25 18:46:33 +00:00
Jenkins
da8c497f22 Merge "Refactor run_command to use *args, **kwargs" 2012-10-25 18:46:26 +00:00
Jenkins
dc5b674d32 Merge "Get rid of "status" parameter in run_command" 2012-10-25 18:46:01 +00:00
Dereckson
e7b8dc6107 Make setup.py less Linux-specific, more UNIX-compliant.
- #!/usr/bin/python -> #!/usr/bin/env python
  BSD OS use /usr/local/bin/python

- Man pages location is OS specific.
  For example, this is /usr/local/man on FreeBSD
  or /usr/share/man on Debian.

  I checked several Python projects like Nose-devs,
  it seems there is a consensus to use 'man/manN'.

Change-Id: I584c80c23b1fb9cfe77025d8c93ab9494a7b6cf0
2012-10-22 00:21:45 +02:00
Dereckson
4001e19378 Fixing ponctuation issue.
Old argument description:
	-l, --list	list available reviews for the current project

New argument description:
	-l, --list	List available reviews for the current project

Change-Id: Ic7b46bed61944113549b9a98711ba6407ab5c9f0
2012-10-21 21:11:22 +02:00
Marcin Cieslak
d5f26eef4b Introduce CommandFailed exception for run_command
This exception should print the error message
as well as the offending command with the parameters
and its output.

This way lots of status checking code (if (status != 0))
can be removed in the future.

An example CannotInstallHook exception has been introduced.

Example output in case of failure:

Problems encountered installing commit-msg hook
The following command failed with exit code 1
    "scp -P 29418 saper@blabla:hooks/commit-msg .git/hooks/commit-msg"
-----------------------
ssh: Could not resolve hostname blabla: Name or service not known
-----------------------

This way only one place will be used to control output of errors,
it is also simple to introduce separate exit code for every error
in git-review.

Change-Id: I92b8637c87df3bdc328faef456a8391305fb92cb
2012-10-10 03:29:12 +02:00
Marcin Cieslak
4a4b6c5184 Use run_command_status *argv for ssh and scp
Refactor all ssh and scp invocations to use
the same form of run_command_status

Now SSH/SCP code duplication seems to be obvious

Change-Id: Id924746df65a615516dd7cb1dee249f2d59d0e78
2012-10-10 02:35:15 +02:00
Marcin Cieslak
77d449b871 Refactor run_command to use *args, **kwargs
Allow both

run_command("command", "arg1", "arg2")

and

run_command("command arg1 arg2")

Avoid nasty env=dict(ENVAR='sth') and use
ENVAR='sth' instead.

Change-Id: I75ea0ce5c12b9b1d9c62528db1be82145a19a409
2012-10-10 01:22:33 +02:00