7176 Commits

Author SHA1 Message Date
David Pursehouse
45286f196a Cache downloaded JAR files in ~/.gerritcodereview/buck-cache
Instead of caching downloaded files in `./buck-cache` in the
working folder, cache them in `.gerritcodereview/buck-cache` in
the user's home folder.

This offers two advantages:

- Cached files are not lost if the working folder is removed, or
  untracked files are removed with `git clean`.

- The same cached files can be shared between multiple working
  folders, i.e. if the developer has separate workspaces to work
  on different target branches.

Change-Id: I3e132df85c43431c2454421b1de0d9e901679540
2013-05-17 13:52:19 +09:00
Shawn Pearce
fec1537a56 Fix metaVar printing in REST API help usage
The metaVar used in @Option annotations was not being respected.
Use this value before asking the handler for its default value.

Change-Id: If0193983b9ebbb646ac325f28fefcb667b4f5bec
2013-05-16 12:59:29 -07:00
Edwin Kempin
5c0d6b33ff Support branch creation via REST
A new branch can be created by PUT on
'/projects/<project-name>/branches/<ref>.

The WebUI was adapted to use this new REST endpoint to create branches.
The old RPC for creating a branch in ProjectAdminService was deleted.

Change-Id: Id94bc4737eedde383507c7c567b3b6b102b105c5
2013-05-16 09:08:17 -07:00
David Pursehouse
94a928b9a9 Use rstrip/lstrip to remove trailing/leading slashes
Change-Id: I572fbaaae5ab23909f4daa54f0ea7d56d5b78263
2013-05-16 09:01:21 -07:00
David Pursehouse
14f9aa65f9 Handle CalledProcessError when removing files from downloaded zip file
Instead of exiting with a python stack trace, catch the error and
print a formatted error message, then exit with error code.

Change-Id: I5935ed46e71cdba4e28c06291a9f009e83f20536
2013-05-16 15:59:55 +00:00
David Pursehouse
9d9d68f2bb Separate error handling for curl error and mkdirs error
If creating the cache directory fails, it is reported as a failure
to run curl.

Separate the error handling and print an appropriate error message.

At the same time, remove redundant calls to `str()` when printing
error messages.

Change-Id: Id6f2c76b16b3101f800cc194a5cb0c2875c4414a
2013-05-16 15:59:13 +00:00
David Pursehouse
6fb2c4d8e0 Allow local.properties to be placed in ~/.gerritcodereview
The local.properties file must currently be placed in the root of the
gerrit project.  If the project is removed or untracked files are
removed, the settings are lost.

Add support for keeping the file in the `.gerritcodereview` folder in
the user's home folder.

If the file exists in both the gerrit root and `~/.gerritcodereview`,
the one in the root takes precedence.

Change-Id: I815637cf47e84d29c33afa8aafa562d6915f5326
2013-05-16 08:58:16 -07:00
David Pursehouse
a043d5181a Merge "Do not check preconditions on REST parent resources" 2013-05-16 07:16:55 +00:00
Edwin Kempin
c7ebcf12e5 Trim input for branch and revision when creating a new branch
Change-Id: I96d0efe87184abf3efa6bf7e65ac7e65a4e72d82
Signed-off-by: Edwin Kempin <edwin.kempin@sap.com>
2013-05-16 10:34:58 +09:00
Shawn Pearce
bd5629718f Update buck build for strict dependencies
java_library() targets must now list every dependency they need for
an import. This permits buck to run more targets in parallel as it
has a better view of the dependency graph, and opens the door for
buck to make even more optimizations in the future.

Change-Id: I132bf47a725e44ba5950ba6ca76bfa72c3876906
2013-05-16 01:14:27 +00:00
Edwin Kempin
ecbba0d5f5 Do not check preconditions on REST parent resources
If 'If-None-Match: *' is specified this should only fail if the
specified REST resource already exists and not if the parent resource
exists.

Change-Id: I299ff4cdcd4d932401507eaca4f5807718be6dcd
Signed-off-by: Edwin Kempin <edwin.kempin@sap.com>
2013-05-15 14:29:50 +00:00
Shawn Pearce
be0e5c698f Merge "Add links to buck documentation from dev-readme page" 2013-05-15 01:49:23 +00:00
Shawn Pearce
43eb7aadf2 Merge "Prevent multiple slashes after hostname in commitmsg hook hint" 2013-05-15 01:47:08 +00:00
Shawn Pearce
c67fbf4228 Merge branch 'stable-2.7'
* stable-2.7:
  Release notes for 2.5.3
2013-05-14 18:35:20 -07:00
Shawn Pearce
62b82de590 Merge branch 'stable-2.6' into stable-2.7
* stable-2.6:
  Release notes for 2.5.3
2013-05-14 18:34:55 -07:00
Shawn Pearce
8ea0c8b12b Merge branch 'stable-2.5' into stable-2.6
* stable-2.5:
  Release notes for 2.5.3
2013-05-14 18:34:34 -07:00
Shawn Pearce
5534ada343 Release notes for 2.5.3
Change-Id: I419c39f4b5593bdc800a0db71731b2032eb161cc
2013-05-14 18:33:35 -07:00
David Pursehouse
5861a9a5be Add links to buck documentation from dev-readme page
Add links to the buck documentation for Eclipse integration and
running the acceptance tests.

Also make the section titles and IDs consistent between the Maven
and Buck pages.

Change-Id: I5ea5f145081b075111e09a2bd15538dfbb41aae3
2013-05-15 10:26:49 +09:00
David Pursehouse
44046f1783 Prevent multiple slashes after hostname in commitmsg hook hint
Make sure all trailing slashes are removed from the canonical
web URL, so that when the message is built it does not end up
with double slashes in the middle.

Change-Id: Ibcd1caf21727e0672f9d840b0371c413f01c083d
2013-05-15 10:07:59 +09:00
Shawn Pearce
7f3c1e69e0 Merge branch 'stable-2.7'
* stable-2.7:
  Bump openid4java dependency to 0.9.8
  Provide direct link to REST API documentation
  init: Gracefully handle missing browser
  Improve explanation of path conflicts in project config doc
  init: Don't set username on upgrade if database.type is JDBC

Change-Id: Ia48eb8428588b598cb10a9ed1d4079a6abf42580
2013-05-14 16:52:31 -07:00
Shawn Pearce
f0cb7cb93c Merge branch 'stable-2.6' into stable-2.7
* stable-2.6:
  Bump openid4java dependency to 0.9.8
  Provide direct link to REST API documentation
  init: Gracefully handle missing browser
  Improve explanation of path conflicts in project config doc
  init: Don't set username on upgrade if database.type is JDBC
v2.7-rc1
2013-05-14 15:33:06 -07:00
Gustaf Lundh
dc4914a44e CherryPick now uses PatchSetInserter.
Enabling support for cherry picking a change as a
new patchset onto an existing change if the changeid
would already exist on the destination branch. This will
more closely match the expected behaviour compared to
carrying out the same actions from the command line
and pushing to Gerrit.

Change-Id: I7d73386fc449cf5c41d2817642c346de52ab17fd
2013-05-14 15:00:29 -07:00
Gustaf Lundh
b3cb325a07 Allow PatchSetInserter to also handle ChangeMessage
Some features (e.g. cherry-pick) may want to insert a ChangeMessage
into another Change than the destination Change.

By allowing us to pass a ChangeMessage to insertPatchSet(), we
can setup the destination before injecting the message into the
DB.

Change-Id: I28332c92fee4f95c44e18d400afe70aab022cbbc
2013-05-14 15:00:29 -07:00
Dave Borowitz
5387aec596 Merge "Merge branch 'stable-2.7'" 2013-05-14 22:00:17 +00:00
Dave Borowitz
33807494bd Merge branch 'stable-2.7'
* stable-2.7:
  Fix clearing themes

Change-Id: I3a21d199ad1942f26302292ab9ffe1e832dea02e
2013-05-14 14:57:31 -07:00
Shawn Pearce
be320a9de5 Merge branch 'stable-2.5' into stable-2.6
* stable-2.5:
  Bump openid4java dependency to 0.9.8

Change-Id: Ia946c4a5a81106d6158016ac336ba7c9b7247911
v2.6-rc3
2013-05-14 14:25:51 -07:00
Shawn Pearce
4157619d76 Merge "Document REST endpoint to list files of a revision" 2013-05-14 20:42:21 +00:00
Edwin Kempin
682ac71941 Document REST endpoint to list files of a revision
Change-Id: I841d4f02748f74aaefd32b9266f41f0b7729c28e
Signed-off-by: Edwin Kempin <edwin.kempin@sap.com>
2013-05-14 13:42:01 -07:00
Shawn Pearce
b4095b2459 Merge "Suppress alert windows if UiCommand returns empty message" 2013-05-14 20:36:21 +00:00
David Ostrovsky
19738cc624 Suppress alert windows if UiCommand returns empty message
Change-Id: I007def156135741d1380660e74f3b838120beb44
2013-05-14 23:01:37 +02:00
Jonathan Nieder
af5d1dc36e Bump openid4java dependency to 0.9.8
Authentication is security-sensitive, so best to make use of the
latest available stable version.

Change-Id: I70904821a61408b84fcaef5e818ff07fd1f9aecb
v2.5.3
2013-05-14 12:22:03 -07:00
Edwin Kempin
196e173aac Support to retrieve a branch via REST
GET on /projects/<project-name>/branches/<branch-id> retrieves a
branch.

Change-Id: I1c2c81dcc5292d644d8048436c142039a4274e32
Signed-off-by: Edwin Kempin <edwin.kempin@sap.com>
2013-05-14 20:37:28 +02:00
Shawn Pearce
a15ce5d9f7 Merge "init: Gracefully handle missing browser" into stable-2.6 2013-05-14 18:21:11 +00:00
Shawn Pearce
4076287120 Merge "buck build: Embed LICENSES.txt into release WAR" 2013-05-14 16:22:57 +00:00
Chad Horohoe
fcfa425097 Provide direct link to REST API documentation
The REST API is a first-class feature that we want to
encourage people to use. Providing a high-level link
helps increase visibility.

Change-Id: I5af19d7d9fee1ae2ba67352f2c06cedfb4f8a9f6
2013-05-14 12:10:35 -04:00
Shawn Pearce
03b18a6eb1 Merge "Rename patch-id to file-id in the REST API documentation" 2013-05-14 15:26:45 +00:00
Shawn Pearce
60bdd68aa5 Merge "Fix download target to only download binary JARs" 2013-05-14 15:25:43 +00:00
Edwin Kempin
a686de97e7 Support listing of branches via REST
GET on /projects/<project-name>/branches returns a list with the
branches of the project.

Change-Id: Ic30e4fc563799e9a4352c4ed01c4db5316abb835
Signed-off-by: Edwin Kempin <edwin.kempin@sap.com>
2013-05-14 08:13:00 -07:00
Shawn Pearce
74ec3037a5 init: Gracefully handle missing browser
Gerrit might be installed on a headless server that does not have a
browser installed, or has a browser binary but no X11 server is
configured in the environment.  Handle these installations by telling
the user the browser could not be opened and request opening the URL.

Bug: issue 1898
Change-Id: I17c47ac8eb390a5d89db52ad023612b8738dde7d
2013-05-14 07:56:34 -07:00
Shawn Pearce
7b55326512 Fix download target to only download binary JARs
Previously it also setup the prebuilt_jar() which isn't actually
necessary to execute the download. This reduces the size of the
command line passed into the child buck process.

Before this change not all libraries were downloaded during the
download target. Targets in the root of //lib were skipped due to
an incorrect regex passed to egrep. This has been fixed with the
new regex inside of download_all.py.

The initial binary download now requires ~59s on my home cable modem,
and pulls 84M.

Source JARs are now only downloaded when the user builds the
download_sources target.  This saves ~30s of setup time on a
the same connection and reduces the initial download by 16M.

Change-Id: Ie3bc97c9101c94f8bc4b89664bbd218323ad7230
2013-05-14 14:51:17 +00:00
Martin Fick
a7f04b4f1b Merge "Improve explanation of path conflicts in project config doc" into stable-2.6 2013-05-14 13:15:22 +00:00
Edwin Kempin
bea55a5747 Rename patch-id to file-id in the REST API documentation
ef38c071627cfa9872c214cb07973ab53bb03f3c renamed Patches to Files. This
rename should be also reflected in the documentation.

Change-Id: I8a6254f72fd3d77297e578243b1bf43871170f95
Signed-off-by: Edwin Kempin <edwin.kempin@sap.com>
2013-05-14 13:55:57 +02:00
David Pursehouse
17c051d9cd Improve explanation of path conflicts in project config doc
Change-Id: I56b063790eb48e649b8380a008ff02902bffcf5e
2013-05-14 17:45:32 +09:00
Shawn Pearce
6d9ad02f9b Merge "Support downloading from other Maven repositories" 2013-05-14 07:00:32 +00:00
Shawn Pearce
a6f11f1da9 Merge "Download H2 sources" 2013-05-14 06:58:05 +00:00
David Pursehouse
72a1701927 Add missing import of symlink in download_jar.py
Missing import of `symlink` from the `os` module causes an error:

  Traceback (most recent call last):
    File "/work/gerrit/tools/download_jar.py", line 108, in <module>
      symlink(cache_ent, args.o)
  NameError: name 'symlink' is not defined

Change-Id: Ie0d6b6dbdd211f830a4443c98bd5ea3b3ab56e3e
2013-05-14 15:47:16 +09:00
Shawn Pearce
1b89f85874 Support downloading from other Maven repositories
Developers may now request buck to use a local mirror by setting
the URL into local.properties, a file already ignored under the
current buck build process, e.g.:

  download.GERRIT = http://nexus.my-company.com/
  download.MAVEN_CENTRAL = http://nexus.my-company.com/

To support this usage buck now passes to download_jar.py only the name
of the repository in the URL.  download_jar parses local.properties
(if present) and replaces the "MAVEN_CENTRAL:" prefix with the URL
supplied by the user.

Because the URL can vary cache entries in buck-cache are now using the
SHA-1 we expect/verify against, instead of the SHA-1 of the URL.  This
makes it easier to find a specific JAR in the cache.  The artifact,
version and SHA-1 as named in the maven_jar() rule are the strings
used in the file name in buck-cache.

If no SHA-1 verification happens (e.g.  source attachment JARs that
are not included into the build) then sha1(canonical_url) is used.
Here the canonical URL uses the repository id prefix string, e.g.:

  MAVEN_CENTRAL:org/apache/mina/mina-core/2.0.5/mina-core-2.0.5-sources.jar

Change-Id: I5a469ab15fd36b81bf76f6b51e1110dfdcf04c86
2013-05-13 23:45:13 -07:00
David Pursehouse
76f69f6860 Fix broken section IDs in generated license documentation in buck build
When running `buck build release`, the following warnings are emitted:

  asciidoc: WARNING: licenses.txt: line 51: missing section: [[Apache1.1]]
  asciidoc: WARNING: licenses.txt: line 111: missing section: [[Apache2.0]]
  asciidoc: WARNING: licenses.txt: line 365: missing section: [[MPL1.1]]

There are two causes of these warnings.

Firstly, the ID for the Apache 2.0 section in the page is actually
named "apache2" but the generated html is referring to "Apache2.0".

Secondly, asciidoc does not properly generate the HTML if the ID name
contains dots.

Change the name of the Apache 2.0 section ID to "Apache2_0" and modify
the license generation script to replace dots with underscores in the
section names.

Change-Id: I8ad87d3f8cbd6af5512c0f25079154e5c7982565
2013-05-14 14:53:33 +09:00
Shawn Pearce
784dce39c9 Download H2 sources
Having sources can help with debugging sections of code like launching
a browser during init, or the local cache support that is heavily
based on H2.

Change-Id: Ic06e97066f0daa2fae53374a7dcb755169a88acf
2013-05-13 22:47:35 -07:00
Shawn Pearce
d0e7b198ab init: Don't set username on upgrade if database.type is JDBC
The username may already appear in the url and be working correctly
from a prior installation.  Setting database.username will confuse
Gerrit when it tries to connect without a matching database.password.

Bug: issue 1870
Change-Id: Ib25b48bd8587562e56613815f497efab850a80e8
2013-05-13 22:37:44 -07:00