100 Commits

Author SHA1 Message Date
viktard
fd72a50e29 Force or replace local site theme on *.googlesource.com
Sample usage:
   ~/mitm-gerrit/mitm-theme.sh ./path/to/theme.html

Change-Id: I9c445d5c8354952771d73b1de0a29626787c8634
2019-01-10 15:59:48 -08:00
Viktar Donich
508f81ddce Scripts for UI plugins development using mitmproxy
Starts a local proxy that rewrites prod server responses, adding new
plugins, serving local files, enabling or disabling assets bundles.

Prerequisite: Docker
Target platform: OS X

Change-Id: I9abd94c816f987bf43e4335aff5be7ad17dd0fde
2018-12-21 15:22:16 -08:00
David Pursehouse
d69ad71df4 abandon_stale.py: Optionally exclude WIP changes
Including the "-is:wip" term by default causes the script to fail
when run against Gerrit server earlier than 2.15.

Add a new --exclude-wip option to optionally add "-is:wip".

Change-Id: Ia26ce274d9250a076fa9072af2b8260c7a8087f5
2018-08-30 16:14:45 +09:00
Paladox none
d823dfac81 Fix merge conflict in populate-fixture-data.py
Change-Id: I0b113eba725eeefcdfcd2d7aa101d01d3f071315
2018-05-31 19:06:53 +00:00
Chad Horohoe
691423248d Python cleanups, round 2: line too long, etc.
- Line too long (>80)
- Pointless continuation (\) characters
- Trailing semi-colon
- 'not foo in bar' -> 'foo not in bar'

Change-Id: I7acb7f166d2f945005bf5578a740b887b1654597
2018-05-19 22:48:43 +01:00
Chad Horohoe
dd22470db8 Python cleanups, round 1: whitespace
- Use 4 spaces instead of 2 for indentation. This is Python standard
  and is also in Google's styleguide for Python:
  https://google.github.io/styleguide/pyguide.html#Indentation
- Use 2 newlines between functions/classes

This does introduce a few line-too-long errors to clean up which will
be fixed in the follow-up commit, but wanted to keep this as easy to
review as possible (git diff -w should be minimal)

Change-Id: I463f18d11e72745107350ac0ae5588d1fb626ed6
2018-05-19 22:47:19 +01:00
Chad Horohoe
5c6fdf41d8 Py3 compat: xrange() -> range()
Yes, it's moderately slower, but for the uses here it's just fine

Change-Id: I23062a9b7ffdb85e0306664edf92759287d615f0
2018-05-17 12:00:52 -07:00
Chad Horohoe
bc8eca1cd6 Use print_function from __future__
Makes these scripts compatible with Python3

Change-Id: I45a96415c4a66f2de87267880885fe63cfcbbe87
2018-05-09 20:34:57 -07:00
Edwin Kempin
8df5c2ef63 Merge "gitiles script to generate/open gitiles URLs" 2018-04-18 21:00:58 +00:00
Dave Borowitz
4f69f03e18 git-push-review: Add flags for edits and WIP/ready
Change-Id: I79f50efc828f2b074fb57ccf3ca2de4e7abd1897
2018-04-12 04:01:53 -04:00
Han-Wen Nienhuys
6c51586ecd Parametrize populate-fixture-data.py
Add -p for setting the port, and -u for the user count.

Change-Id: I872607b3ce5707b8fc9e8b090292bc984bdfc535
2018-03-14 10:49:30 +01:00
Saša Živkov
40839ea8d4 gitiles script to generate/open gitiles URLs
We often use gitiles links to point to some source code which is
relevant for a discussion or code review. It often requires 10-15
mouse clicks in order to navigate to a path in gitiles and generate a
link. This is cumbersome and may discourage providing links to gitiles.

This script intends to provide a fast way to generate and open gitiles
links. It requires a one time setup of gitiles.url in .git/config file:

  [gitiles]
    url = https://gerrit.googlesource.com/gerrit

Once gitiles.url is setup we can generate gitiles URLs easily.

Examples
========

* print gitiles URL for the current HEAD and current directory:

  $ gitiles
  https://gerrit.googlesource.com/gerrit/+/d685ac1193e086b896cfc019ef4504d1b7ce455b/

* print gitiles URL for current HEAD and Documentation directory:

  $ gitiles Documentation

* print gitiles URL for branch stable-2.15 and current directory:

  $ gitiles -b stable-2.15

* print gitiles URL for current HEAD and a path relative to the current directory:

  $ pwd
  gerrit-server
  $ gitiles ./src/main/resources

The script also supports "open" command which open gitiles URL using
OS's native way of opening URLs:

  $ gitiles open
  $ gitiles open -b stable-2.15 Documentation

Change-Id: Icd31723711535e886313d3d17afb57caa4a710b1
2018-03-07 19:13:56 +00:00
David Pursehouse
4416d90d77 abandon_stale.py: Exclude WIP changes
Change-Id: Ib62aa783970e4d66ac37855bc0b2b92e0bf7f082
2018-02-21 08:29:06 +00:00
David Pursehouse
ab8e7d8b14 abandon_stale: Log project name
Log the project name of the change, except when the --project option
was specified exactly once (because in this case all the changes will
be from the same known project).

Change-Id: Ic3426244354e10717c866ae9a00aae631b66cad1
2017-12-20 08:16:51 +09:00
David Pursehouse
b40453a7ca abandon_stale: Only log change owner in verbose mode
Change-Id: I211d1e39e6d4081a83f9770d1d06c6d4ea56b313
2017-12-20 08:16:40 +09:00
David Pursehouse
9a8851bfbc abandon_stale: fix style warnings from flake8
Change-Id: I7d12bc2e9edc0fbbbb7e0aea61b4c7118d99fb2d
2017-10-23 10:11:49 +00:00
David Pursehouse
4e0011e3fc abandon_stale.py: add test mode
When running in test mode (--test option) the script will only query
for changes owned by the caller, having the 'test-abandon' topic, and
will not use the 'age' term.

With this option, it is possible to do live test of the script against
an own change that is private, without causing disruption to other
users if the script has unexpected behaviour.

Change-Id: Iedfd7547bd6f42436f9ec8d75614856943fc7ccc
2017-10-23 10:11:35 +00:00
David Pursehouse
3b2dbc401d abandon_stale.py: send data using json argument, not data argument
This is a fix for the change that was done in Idaaff88e981.

Sending through the data argument causes the abandon message to be
sent as "message" rather than the actual message.

Change-Id: I47108f4e1d3c328d832d09156a160dbf46706941
2017-09-27 13:49:55 +02:00
David Pursehouse
dbc9f6055f abandon_stale.py: send data as a dict, not a string
After a recent PR merged on pygerrit2 [1], sending data as a string
no longer works as expected; it must be sent as a dict.

[1] https://github.com/dpursehouse/pygerrit2/pull/10

Change-Id: Idaaff88e9811bf8ca90ef2719f13022ffd09cfad
2017-09-05 10:17:38 +00:00
David Pursehouse
b7e7885711 abandon_stale: Use DETAILED_ACCOUNTS option
Without this option the change owner name is not included in the
results, and is then displayed as "Unknown" in the log output.

Change-Id: I995d1f8f303af968a6e31c68dee143b24150ec08
2017-08-29 22:42:12 +09:00
David Pursehouse
10890e8b62 abandon_stale.py: minor documentation improvements
Change-Id: I4865811ed66816870743f96c33d0a6fe91a33c61
2017-08-29 21:50:52 +09:00
David Pursehouse
bd19a23a1a abandon_stale.py: Adapt to removal of digest authentication
HTTP Digest authentication was removed in Gerrit 2.14 and now only basic
authentication is supported.

Change the default authentication to basic, but still support digest
for backwards compatibility with previous Gerrit versions.

Change-Id: I7ccf9d2c506ed79f1209f995856c42c4936b4872
2017-04-21 14:51:59 +00:00
Changcheng Xiao
7b1264e2bd Replace digest auth with basic auth in 'populate-fixture-data.py'
Change-Id: I9ff111dd56a743b9307ca7eb31764afc99ccc4c8
2017-04-20 18:20:49 +02:00
Dave Borowitz
292fa154c1 Format all Java files with google-java-format
Having a standard tool for formatting saves reviewers' valuable time.
google-java-format is Google's standard formatter and is somewhat
inspired by gofmt[1]. This commit formats everything using
google-java-format version 1.2.

The downside of this one-off formatting is breaking blame. This can be
somewhat hacked around with a tool like git-hyper-blame[2], but it's
definitely not optimal until/unless this kind of feature makes its way
to git core.

Not in this change:
* Tool support, e.g. Eclipse. The command must be run manually [3].
* Documentation of best practice, e.g. new 100-column default.

[1] https://talks.golang.org/2015/gofmt-en.slide#3
[2] https://commondatastorage.googleapis.com/chrome-infra-docs/flat/depot_tools/docs/html/git-hyper-blame.html
[3] git ls-files | grep java$ | xargs google-java-format -i

Change-Id: Id5f3c6de95ce0b68b41f0a478b5c99a93675aaa3
Signed-off-by: David Pursehouse <dpursehouse@collab.net>
2017-02-07 10:04:39 +09:00
David Ostrovsky
fdbfcad77d Remove Buck based build
Bug: Issue 5302
Change-Id: I6e860446ef30ff0ad1c7c49fc0e39d39d921820b
2017-01-23 12:44:58 +00:00
David Pursehouse
3336c2de13 Remove unused/outdated Pylint configuration file
This configuration file is not in sync with the latest version
of pylint, and is not (as far as I am aware) being used by anyone.

Change-Id: Ia397f359f6ccd72244586f960e5b3c7838c68f54
2016-10-20 09:07:01 +09:00
Alice Kober-Sotzek
28deb034d0 Improve populate-fixture-data script
The script generated only users with the same first name. In
addition, only one change was created per user. In order to be able to
test whether users can be found by their first name, different first
names are used now. For each of those users, 1 to 5 changes are
created to reflect a more natural user base, on which statistics
don't yield the same values for all users. As we don't want to
possibly specify valid gmail accounts, we use another suffix for the
email address.

Change-Id: Ieea72bb45a374eebaa2c51ec74789b337f256958
2016-10-10 10:51:07 +02:00
Dave Borowitz
e7d88cd8f0 git-push-review: Handle reviewers with no explicit config
This "or r" was accidentally removed in I5ad5b617.

Change-Id: If4419e204b54e619559ed2a2a25c508fc2367d35
2016-10-04 11:48:17 -04:00
David Pursehouse
77abe31431 abandon_stale: Use pygerrit2 instead of pygerrit
Change-Id: I2cd6149800368e02805e60b854bc86604cce405f
2016-09-23 08:51:05 +02:00
Dave Borowitz
053b7a6ee0 git-push-review: Support #hashtag arguments
Change-Id: I5ad5b61720ca4854ea61390be209c7357b66d669
2016-09-22 09:21:36 +02:00
Patrick Hiesel
13ebf8cb6d Add a piece of go code to find mismatching lib versions in bzl/bck
Tested with:
go run contrib/build-consistency.go

Gives (before the current fix on master):
SHA1 of lib gson does not match: buck has
751f548c85fa49f330cecbb1875893f971b33c4e while bazel has
f1bc476cc167b18e66c297df599b2377131a8947
SHA1 of lib jsr305 does not match: buck has
f7be08ec23c21485b9b5a1cf1654c2ec8c58168d while bazel has
516c03b21d50a644d538de0f0369c620989cd8f0
SHA1 of lib auto_value does not match: buck has
b764e0fb7e11353fbff493b22fd6e83bf091a179 while bazel has
6873fed014fe1de1051aae2af68ba266d2934471
SHA1 of lib junit does not match: buck has
dc7edb9c3060655c7fb93ab9b9349e815bab266f while bazel has
4e031bb61df09069aeb2bffb4019e7a5034a4ee0
SHA1 of lib joda_time does not match: buck has
1c295b462f16702ebe720bbb08f62e1ba80da41b while bazel has
9f2785d7184b97d005a44241ccaf980f43b9ccdb
SHA1 of lib joda_convert does not match: buck has
675642ac208e0b741bc9118dcbcae44c271b992a while bazel has
35ec554f0cd00c956cc69051514d9488b1374dec
Can't parse lib sha1/name on target
maven_jars(name='lucene_core_and_backward_codecs',
srcs=[':backward_codecs_jar',':lucene_core',],visibility=['PUBLIC'],
SHA1 of lib lucene_core does not match: buck has
a74fd869bb5ad7fe6b4cd29df9543a34aea81164 while bazel has
c52b2088e2c30dfd95fd296ab6fb9cf8de9855ab
SHA1 of lib lucene_analyzers_common does not match: buck has
1e0e8243a4410be20c34683034fafa7bb52e55cc while bazel has
c2aa2c4e00eb9cdeb5ac00dc0495e70c441f681e
SHA1 of lib lucene_misc does not match: buck has
504d855a1a38190622fdf990b2298c067e7d60ca while bazel has
95f433b9d7dd470cc0aa5076e0f233907745674b
SHA1 of lib lucene_queryparser does not match: buck has
0fddc49725b562fd48dff0cff004336ad2a090a4 while bazel has
dccd5279bfa656dec21af444a7a66820eb1cd618
SHA1 of lib ow2_asm does not match: buck has
5ef31c4fe953b1fd00b8a88fa1d6820e8785bb45 while bazel has
dcc2193db20e19e1feca8b1240dbbc4e190824fa
SHA1 of lib ow2_asm_analysis does not match: buck has
6d1bf8989fc7901f868bee3863c44f21aa63d110 while bazel has
c7126aded0e8e13fed5f913559a0dd7b770a10f3
SHA1 of lib ow2_asm_commons does not match: buck has
25d8a575034dd9cfcb375a39b5334f0ba9c8474e while bazel has
a7111830132c7f87d08fe48cb0ca07630f8cb91c
SHA1 of lib ow2_asm_tree does not match: buck has
87b38c12a0ea645791ead9d3e74ae5268d1d6c34 while bazel has
287749b48ba7162fb67c93a026d690b29f410bed
SHA1 of lib ow2_asm_util does not match: buck has
b60e33a6bd0d71831e0c249816d01e6c1dd90a47 while bazel has
1512e5571325854b05fb1efce1db75fcced54389

Change-Id: I536b3eecf61a2cd1e7ce9d1c19335f1c2238b6c5
2016-08-26 17:01:50 +02:00
Patrick Hiesel
c8076c301b Added a script to populate some dummy data
This is just a first version of a py script that
populates a Gerrit instance with some data for
local monkey testing. I'll add some more sugar to
it when I have more time.

Change-Id: I49ecf1ce4f288c5f07254a445a7168cbf83ea2f2
2016-05-20 17:31:47 +00:00
Richard Fearn
626327ccae Add "threads" command to gerrit.sh bash_completion script
The command was added to gerrit.sh in commit ed819f30bc in change
I92b75d1ed.

Change-Id: Iba9cfd73f49390b9c89f07098d5c239a28429459
2016-03-23 17:40:35 +00:00
Sebastian Schuberth
f8602e1cab Add the original SVG images for the Diffy logo
People who would like to use the Diffy logo in their third-party
application for Gerrit probably would start looking for the original logo
sources in the Gerrit repository instead of the discussion group. So copy
the SVG images from [1] to the repository.

[1] https://groups.google.com/d/msg/repo-discuss/nLCvwG2POpM/ENLsQX3ldugJ

Change-Id: Ia9877d9c0a67a1a8c233d9bc49acd1ea3184f9a8
2016-03-16 10:30:46 +01:00
David Pursehouse
fa1a8280fe Merge "Don't hardcode bash location" 2016-02-26 00:15:57 +00:00
David Pursehouse
a55ed3dba4 abandon_stale.py: fix typo in option handling
Change-Id: I8950cd26fa852a394b1984e52b0f74092d6f8db5
2016-02-15 08:21:57 +00:00
David Pursehouse
0198978dc5 abandon_stale.py: Allow to limit by branch and project
Change-Id: Id73923c17ecfc62cb4b911dfbee793a4c9102a7d
2016-02-01 10:38:12 +09:00
Doug Kelly
920b1667d4 Correct issue with Bouncy Castle code signing
If the Bouncy Castle Crypto libraries are unsigned, issues result with
the Eclipse build, since they rely on the copy that exists in the
libraries copied by the download_file.py script.  As a workaround, use
a genrule in ConvertKey to unsign the JARs manually.

Change-Id: I44d6ad5b05a18258e8bf5400c42f1cbd159e59b2
2015-11-10 13:00:26 -08:00
Doug Kelly
1cbfe97c91 Changing the SSH key converter to BUCK
Since we're a BUCK shop, convert the SSH key converter accordingly.
This requires we mark Bouncy Castle as unsign, even though we
do not include this in our normal Gerrit builds.  Also, we had to
add slf4j-nop, since this app doesn't require logging.

Change-Id: I85031192f9172a90512d5f28cf1621c10ad6ebf4
2015-11-09 10:59:32 -08:00
Doug Kelly
bd3b9958a6 Simple tool for converting SSH keys
If SSH keys are created without Bouncy Castle, the keys are stored in
a non-standard format. These can be read back in and converted back to
standard OpenSSH format through the use of this tool.  This may be used
by anyone trying to support new key types after installing Bouncy
Castle.

Change-Id: I52c00fcd44a55c855b5e3a6ebac1283f860e08b8
2015-11-09 10:04:07 -08:00
Dan McGregor
26c0d09bfd Don't hardcode bash location
bash may not be installed in /bin, so don't make that assumption.

Change-Id: I04ae786c7558f829ddf9649c127cbba1457dcfd3
2015-08-26 09:03:24 -06:00
David Pursehouse
25bebb136b abandon_stale: Allow singular form of age parameter
Change-Id: I87396d6fd223f930e46a85c7f67419c0e2b74b4f
2015-07-06 12:12:28 +09:00
David Pursehouse
e766d2ca37 abandon_stale: Allow weeks as an age parameter
Change-Id: I206a3b137fa5cf69f9b8a54541cf32c16a372d83
2015-07-06 12:09:52 +09:00
David Pursehouse
522e4f8bd4 Script to abandon stale changes from the review server
Fetches a list of open changes that have not been updated since a
given age (default 6 months), and then abandons them.

Assumes that the user's credentials are in the .netrc file.  Supports
either basic or digest authentication.

Example to abandon changes that have not been updated for 3 years:

 ./abandon_stale --gerrit-url http://review.example.com/ --age 3years

Supports dry-run mode to only list the stale changes but not actually
abandon them.

Requires pygerrit (https://github.com/sonyxperiadev/pygerrit).

Change-Id: Ie0edb54847f9f2ab8204647e17e3893ed0a057ea
2015-06-30 14:02:00 +00:00
Björn Pedersen
c357cebdae tools: use python on path
Use the canonical syntax to specify the python executable to use.

Avoids a fatal error if /usr/bin/python is a too old version (< 2.7).

Change-Id: I3e8affb52be993d35c0dcf90774d962a59ef5635
2015-06-18 17:10:11 +02:00
David Pursehouse
686bfea7b3 Fix minor python code style issues
Fix some minor issues that were reported by pyflakes and pylint.

- Rename arguments to prevent redefinition of built-in 'dir'
- Rename method call to prevent redefinition of built-in 'help'
- Remove unused imports
- Prefix unused variable with underscore to prevent warning

Change-Id: Ia9e21c0f1a69af43f6e4566be46c31bdda540d2f
2014-12-18 02:51:06 +00:00
Dave Borowitz
1b46d67a93 contrib: Add a simple tool for pushing to named reviewers
This is a sort of simplified version of git-review[1] for users like
myself who don't mind most git command line tools, and therefore don't
feel the need to switch to a full git-review workflow, but still don't
like the HEAD:refs/for/master%r=user@domain.com syntax for specifying
reviewers during a push.

Reviewer aliases can be specified in a git config file:

[reviewer]
  sop = sop@google.com

$ git push-reviewer --dry-run sop
git push origin HEAD:refs/for/master%r=sop@google.com

[1] http://www.mediawiki.org/wiki/Gerrit/git-review

Change-Id: Ib0c8d609ed9eab17b71ddb13da417a9bfd013611
2014-11-06 14:42:37 -08:00
Edwin Kempin
5ba27bdc38 Allow to download reposize.sh script from Gerrit
Change-Id: Ic8d81a64a89fe0046fccc13e7892acbe52c55bc4
Signed-off-by: Edwin Kempin <edwin.kempin@sap.com>
2014-05-09 16:20:51 +02:00
Matthias Sohn
61bc05e461 Fix documentation and add license header for reposize.sh
Change-Id: I474f9a800443fcaa76c764132c25b6aab7342999
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2014-04-29 13:26:43 +02:00
Matthias Sohn
2d1c219aa3 Add script to find the largest objects in the pack files of a repo
This script is useful if an existing history should be pushed into a
Gerrit project but the push fails because the server has a max object
size limit configured and the existing history contains objects that
are too large. The script helps to identify the large objects so that
they can be removed from the history by using the 'git filter-branch'
command, or so that the limit can be increased.

Change-Id: I99d21d76ac204bf9b53fd589c0ffcbeee2e02422
2014-04-25 07:14:40 +02:00