Commit Graph

307 Commits

Author SHA1 Message Date
Jonathan Nieder 79583aeba7 Remove unused import in Archive
Change-Id: I0bc82e74f4acedb059322c29e13352151165ef7f
2013-05-29 12:35:13 -07:00
Jonathan Nieder 679382fb20 Move FormatActivator.start()/stop() to a separate class
This makes the functionality of registering all formats from the
org.eclipse.jgit.archive package available in contexts where
FormatActivator cannot be built because the OSGi core framework is not
readily available to build against.

Change-Id: If8e3487e933783a7e12f8e1838cbfe0b5862ce80
2013-05-29 12:34:04 -07:00
Jonathan Nieder 68d92182e6 Maintain list of archive formats in one place
Add a static start() method to FormatActivator to allow outside
classes such as the Archive subcommand of the jgit program to use it
without a BundleContext.  This way, the list of formats only has to be
maintained in one place.

While at it, build a list of registered formats at start() time, so
stop() doesn't have to repeat the same list of formats.

Suggested-by: Shawn Pearce <spearce@spearce.org>
Change-Id: I55cb3095043568740880cc9e4f7cde05f49c363c
2013-05-28 16:51:32 -07:00
Jonathan Nieder f99fa9d23e Release ArchiveCommand's ObjectReader in call()
Make call() release all private resources so instead of using a
pattern like

	ArchiveCommand cmd = git.archive();
	try {
		cmd.setTree(tree)
			. ...
			.call();
	} finally {
		cmd.release();
	}

callers can just use git.archive().setTree(tree)....call() directly.

This involves pushing more work out of parameter setters and into
call() so the ObjectReader is not allocated and potentially leaked
before then.

Change-Id: I699f703c6302696e1cc276d7ab8ee597d82f2c5d
2013-05-24 18:28:37 -07:00
Jonathan Nieder 56276d053f Move ArchiveCommand into standard porcelain API
Allow use of ArchiveCommand without depending on the jgit command-line
tools.

To avoid complicating the process of installing and upgrading JGit,
this does not add a dependency by the org.eclipse.jgit bundle on
commons-compress.  Instead, the caller is responsible for registering
any formats they want to use by calling ArchiveCommand.registerFormat.

This patch puts functionality that requires an archiver into a
separate org.eclipse.jgit.archive bundle for people who want it.  One
can use it by calling ArchiveCommand.registerFormat directly to
register its formats or by relying on OSGi class loading to load
org.eclipse.jgit.archive.FormatActivator, which takes care of
registration automatically.

Once the appropriate formats are registered, you can make a tar or zip
from a git tree object as follows:

	ArchiveCommand cmd = git.archive();
	try {
		cmd.setTree(tree).setFormat(fmt).setOutputStream(out).call();
	} finally {
		cmd.release();
	}

Change-Id: I418e7e7d76422dc6f010d0b3b624d7bec3b20c6e
2013-05-24 17:30:18 -07:00
Jonathan Nieder a544ff72db Remove dependency by ArchiveCommand on archive formats
Provide static registerFormat and unregisterFormat methods to allow
formats to register themselves without the ArchiveCommand code being
aware of them.

Register the basic "zip" and "tar" support at bundle activation time
(and deregister them when unloading the bundle).  For anyone using
this code as an OSGi plugin it should continue to just work.

The jgit program does not load org.eclipse.jgit.pgm as an OSGi bundle,
so let the Archive command register the formats it uses explicitly
with registerFormat.

Change-Id: Id39c03ea6923d0aed8316ed7b6bd04d5ced570a7
2013-05-24 16:57:10 -07:00
Jonathan Nieder cfc15dd9dc Drop dependency by ArchiveCommand.Format interface on commons-compress
Otherwise, anyone trying to implement a new format would have to
depend on commons-compress, even if using a different underlying
library to write the archive.

Change-Id: I301a1997e3b48aa7e32d693fd8f4b2d436c9b3a7
2013-05-23 18:09:13 -07:00
Jonathan Nieder d8177d6e19 ArchiveCommand.Format: pass output stream as first argument to putEntry
This is more consistent with other APIs where the output side is the
first parameter to be analagous to the left-hand side of an
assignment.

Change-Id: Iec46bd50bc973a38b77d8367296adf5474ba515f
2013-05-23 18:09:04 -07:00
Jonathan Nieder d4932620e0 ArchiveCommand: make archive formats non-inner classes
First step toward making ArchiveCommand itself format-agnostic.

Change-Id: I3cff5fce28fa7a19e34f8291cfb5b62f16429713
2013-05-23 18:08:35 -07:00
Matthias Sohn d7cc6eb002 Move org.eclipse.jgit.pgm's resource bundle to internal package
Translatable texts aren't API and shouldn't require maintenance of
@since tags to prevent API warnings.

Change-Id: I228ff37f17c0e792a6bc188c463a0d19138e88ac
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2013-05-06 23:48:19 +02:00
Shawn Pearce a626f9fd66 Merge "Require a DiffConfig when creating a FollowFilter" 2013-05-05 11:47:53 -04:00
Dave Borowitz 0bdf030b26 Require a DiffConfig when creating a FollowFilter
The various rename detection options are an inherent part of the
filter, similar to the path being followed.

This fixes a potential NPE when a RevWalk with a FollowFilter is
created without a Repository, since the old code path tried to get
the DiffConfig from the RevWalk's possibly-missing repository.

Change-Id: Idb273d5a92849b42935ac14eed73b796b80aad50
2013-05-05 08:41:09 -07:00
Robin Rosenberg dd3181603e Extend the FS class for Java7
The most important difference is that in Java7 we have symbolic links
and for most operations in the work tree we want to operate on the link
itself rather than the link target, which the old File methods generally
do.

We also add support for the hidden attribute, which only makes sense
on Windows and exists, just since there are claims that Files.exists
is faster the File.exists.

A new bundle is only activated when run with a Java7 execution
environment. It is implemented as a fragment.

Tycho currently has no way to conditionally include optional features
based on the java version used to run the build, this means with this
change the jgit packaging build always needs to be run using java 7.

Change-Id: I3d6580d6fa7b22f60d7e54ab236898ed44954ffd
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2013-05-04 02:01:56 +02:00
Matthias Sohn f2d0b50e0a Fix line endings
Change-Id: I61c9c173237a535da8576a9299bfd4bb29e8f56b
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2013-05-03 16:19:07 +02:00
Jonathan Nieder 7be5cfa4d6 ArchiveCommand: Add missing @since tag
Change-Id: I9e48a1f82b747492bebb3ca65fd16f599e425e8b
2013-04-30 15:03:08 -07:00
Robin Rosenberg 46a3863f21 Merge "Cleanup imports and javadocs in ArchiveCommand" 2013-04-27 16:38:16 -04:00
Robin Rosenberg d0727fc527 Cleanup imports and javadocs in ArchiveCommand
Change-Id: Icb1cd177e791cc646636a88c67fd9399dfc7030c
2013-04-27 15:09:32 +02:00
Jonathan Nieder e3cce3e4db Delete CLIText strings previously used in iplog generator
The only callers using these strings were removed in commit
850e5bc24e (Delete the iplog generator, 2013-01-09).

Change-Id: Ia4f81b29b8d00782ee559d69de3befc0a6c4d403
2013-04-27 09:01:57 -04:00
Robin Rosenberg 687b887c68 Merge "Make the Reflog a public API again" 2013-04-27 08:56:37 -04:00
Jonathan Nieder be047307fc ArchiveCommand: Do not warn for unsupported file mode
When ArchiveCommand is invoked directly on the command line, these
warnings to stderr

	warning: mode of path/to/some/submodule ignored

are a useful hint, but in the more usual case where an archive is
being served by a server, the intended audience for that message
cannot see stderr.

Later it might be useful to accept a callback to return these warnings
out of band.

Change-Id: I22e79be69859176d85594031d67c6cb3371c4bd2
2013-04-26 14:12:42 -07:00
Jonathan Nieder b525e696d5 Add internal porcelain-style API for ArchiveCommand
One step closer to exposing archive creation functionality in a
org.eclipse.jgit.archive bundle.

Change-Id: If0ebb2417a941d9d3fc0d3f444316d0d1c494ff3
2013-04-26 14:12:42 -07:00
Shawn Pearce 543b8560ac Merge "archive: Release resources before returning" 2013-04-26 16:06:25 -04:00
Jonathan Nieder 70e494f649 archive: Release resources before returning
The only caller exits immediately after calling execute() so this
shouldn't make a difference, but it's good practice and should make it
easier to expose the functionality in a public API later.

Change-Id: Ia6cd2ce8382f1a62e576409107fc5c9a6b321fb6
2013-04-26 12:58:34 -07:00
Robin Rosenberg 9dcd8c2c90 Make the Reflog a public API again
Change-Id: I8ced7098da5b345fd9af2fdfafd1ef6a44ccee0d
2013-04-26 00:57:17 +02:00
Robin Stocker a50ed5666f status: Print conflict description for unmerged paths
Prefix unmerged paths with conflict description (e.g. "both modified:"),
the same way C Git does.

Change-Id: I083cd191ae2ad3e2460aa4052774aed6e36c2699
2013-04-19 19:55:24 +02:00
Robin Rosenberg 526b6266a5 Remove some unnecessary dependencies on FileRepostory
Change-Id: Ib6ee3a2874a7e2240aa68f4ac32d00c4d1fab5ae
Signed-off-by: Chris Aniszczyk <zx@twitter.com>
2013-04-18 15:33:50 -05:00
Matthias Sohn aa7be667bc Make recursive merge strategy the default merge strategy
Use recursive merge as the default strategy since it can successfully
merge more cases than the resolve strategy can. This is also the default
in native Git.

Change-Id: I38fd522edb2791f15d83e99038185edb09fed8e1
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2013-04-15 21:46:12 +02:00
Christian Halstrick 266ec24d49 Merge "clean up merge squash and no-commit messages in pgm" 2013-04-09 03:09:33 -04:00
Matthias Sohn 0182e8152e Merge changes I8445070d,I38f10d62,I2af0bf68
* changes:
  Fix plugin provider names to conform with release train requirement
  Add missing @since tags for new API methods
  DfsReaderOptions are options for a DFS stored repository
2013-04-08 17:25:01 -04:00
Matthias Sohn 011f7fd27d Fix plugin provider names to conform with release train requirement
According to release train requirements [1] the provider name for all
artifacts of Eclipse projects is "Eclipse <project name>".

[1] http://wiki.eclipse.org/Development_Resources/HOWTO/Release_Reviews#Checklist

Change-Id: I8445070d1d96896d378bfc49ed062a5e7e0f201f
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2013-04-08 23:05:36 +02:00
Tomasz Zarna b42b50fdf5 clean up merge squash and no-commit messages in pgm
Change-Id: Iffa6e8752fbd94f3ef69f49df772be82e3da5d05
2013-04-08 09:51:00 -04:00
Robin Rosenberg 59baf9148e Detect and handle a checkout conflict during merge nicely
Report the conflicting files nicely and inform the user.

Change-Id: I75d464d4156d10c6cc6c7ce5a321e2c9fb0df375
2013-04-08 05:48:09 -04:00
Tomasz Zarna 5453585773 Add the no-commit option to MergeCommand
Added also tests and the associated option for the command line Merge
command.

Bug: 335091
Change-Id: Ie321c572284a6f64765a81674089fc408a10d059
Signed-off-by: Christian Halstrick <christian.halstrick@sap.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2013-04-04 15:11:49 +02:00
Robin Rosenberg 65027d8bb4 Indicate initial commit on a branch in the reflog
Bug: 393463
Change-Id: I4733d6f719bc0dc694e7a6a6ad2092de6364898c
2013-04-02 21:57:17 +02:00
Tomasz Zarna 48f30b8614 Fix @since tags in JGit, version 2.4 never existed
Change-Id: Iaca88ec28b412e6b58e7b39a0762ba54b25f9471
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2013-03-21 18:03:20 -04:00
Shawn Pearce f32b861243 JGit 3.0: move internal classes into an internal subpackage
This breaks all existing callers once. Applications are not supposed
to build against the internal storage API unless they can accept API
churn and make necessary updates as versions change.

Change-Id: I2ab1327c202ef2003565e1b0770a583970e432e9
2013-03-18 09:30:43 -07:00
Colby Ranger be7a135e94 Break the dependency on RevObject when creating a newObjectToPack().
Update the ObjectReuseAsIs API to support creating new
ObjectToPack with only the AnyObjectId and Git object type. This is
needed to support the future pack index bitmaps, which only contain
this information and do not want the overhead of creating a temporary
object for every ObjectId.

Change-Id: I906360b471412688bf429ecef74fd988f47875dc
2013-03-04 14:43:22 -08:00
Robin Rosenberg 6cadceee16 Must use double single quotes around parameters
Change-Id: I34da782e6b9a492e3e291b36ef82f06ce8347660
2013-02-16 10:54:52 -05:00
Robin Rosenberg 29546877b1 Add the --branch flag to the jgit clone command
--branch or -b allows the user to specify which branch to checkout after
clone.

Change-Id: Ie27533e5ecb43097862a8337a27a742b501e17a5
2013-02-16 10:38:54 -05:00
Matthias Sohn ba6ae0c7ec Prepare 2.4.0-SNAPSHOT builds
Change-Id: I4ab2baeb5d598d40d5dadfccdfe75152a1b9b7bf
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2013-02-14 00:59:25 +01:00
Matthias Sohn da59df358b Remove unused imports
These imports are unused since commit
cb349da017

Change-Id: I74ea2a17bf4976d9c74255500e5deeff18208e87
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2013-02-14 00:08:46 +01:00
Jonathan Nieder cb349da017 Remove unused availableRefs local from Clone.guessHEAD
This variable has been populated and never used ever since it was
introduced in v0.4.9~336 (Add "jgit clone", 2008-12-23).  Remove it
to make the function easier to understand.

Change-Id: Idb7eb80bc236a20f7385ad2d6141b4d1c5c3f1cc
2013-02-12 16:29:24 -08:00
Matthias Sohn 850e5bc24e Delete the iplog generator
It stopped working when we moved to the Eclipse foundation's Gerrit
server since it doesn't use the Gerrit internal user store but LDAP.
Instead, since 2.0, we use the Eclipse foundation's automatic IP log
generator [1] to generate IP logs for releasing jgit and egit.

[1] http://www.eclipse.org/projects/ip_log_selector.php

Change-Id: I98dc65efb62909bc0258e6c680df0c93a57e9677
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2013-01-09 14:21:40 +01:00
Robin Rosenberg 9e36b173a5 pgm: Attempt to detect a broken pipe and exit silently
When piping output to another program, the other pipe may exit
before we are done. An example is "jgit log|head". The result is
that errno get set to EPIPE. Unfortunately Java does not have
specific exception for this so we have to look at the exception
message and hope that the number of variants are small.

The detection here seem to work on Windows, Linux and OS X and it
seems the message is usually not localized.

Change-Id: Id6968ea7a53ae27ba5496303f1a479e41e41fdcc
2013-01-07 01:05:10 +01:00
Robin Rosenberg a57dd1c164 Declare essentially static methods as static
Change-Id: I83ca25fb569c0dbc36eb374d5437fcf2b65a6f68
2012-12-27 12:08:06 -05:00
Robin Rosenberg c310fa0c80 Mark non-externalizable strings as such
A few classes such as Constanrs are marked with @SuppressWarnings, as are
toString() methods with many liternal, but otherwise $NLS-n$ is used for
string containing text that should not be translated. A few literals may
fall into the gray zone, but mostly I've tried to only tag the obvious
ones.

Change-Id: I22e50a77e2bf9e0b842a66bdf674e8fa1692f590
2012-12-27 16:57:38 +01:00
Tomasz Zarna 03d50dc50b Add org.eclipse.jgit.pgm.Reset to commands catalog
Change-Id: I7acfd051a07be889b27cfcfc1f396d86a9f86ab2
Signed-off-by: Tomasz Zarna <tzarna@gmail.com>
2012-12-22 13:01:22 +01:00
Matthias Sohn 706f8eb9fc Prepare 2.3.0 builds
Change-Id: I0ca539e8cfe444f96c64dc56d1f0ef33b66e0cff
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2012-12-21 00:48:45 +01:00
Matthias Sohn 2d78a8da97 Prepare post 2.2.0.201212191850-r builds
Change-Id: I1a0fe51c71551fcfc98f5dd435eb283fd661b77a
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2012-12-21 00:31:26 +01:00
Matthias Sohn aa357c2a9f JGit v2.2.0.201212191850-r
Change-Id: Idc49f17d03886b6a1e61a94ff81e32625c8675d9
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2012-12-20 00:59:41 +01:00