Commit Graph

156 Commits

Author SHA1 Message Date
Matthias Sohn f3d323e9fe List all supported formats in archive command's help
Change-Id: I4bd271cb348914642069239853488f4960444746
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2013-10-10 23:36:07 +02:00
Kaloyan Raev 2c969ea00b Add support for --version in JGit CLI
Bug: 419000
Change-Id: I43f5267182ea69d1f9abbff33136e0491c629071
Signed-off-by: Kaloyan Raev <kaloyan.r@zend.com>
2013-10-09 20:37:03 +03:00
Matthias Sohn 01e793a3ff Add missing usage texts for JGit commandline commands
Also update help text for the merge command now supporting recursive
strategy as the default merge strategy.

Change-Id: I07886fe875c407e2244f562c003bb9d04f398026
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2013-09-09 22:54:52 +02:00
Colby Ranger ef7512b596 Add --quiet flag to pgm fetch.
Change-Id: If141fdc5c181b3a618b7e286ad3c6957211d0afc
2013-08-05 15:12:57 -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 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
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
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
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
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 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 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
Jonathan Nieder 78009782cd archive: Add tar support
Unlike ZIP files, tar files do not treat symlinks as ordinary files
with a different mode, so tar support involves a little more code than
would be ideal.

Change-Id: Ica2568f4a0e443bf4b955ef0c029bc8eec62d369
2012-12-04 15:37:42 -08:00
Jonathan Nieder 345ab401ce archive: Add --format option that switches between formats
Prepare for .tar support.

Change-Id: Ieb07702da1a54b41ae764fbb425f70826907b593
Improved-by: Shawn O. Pearce <spearce@spearce.org>
2012-12-04 15:36:32 -08:00
Jonathan Nieder 6a94f027b6 Add "jgit archive" tool that writes a tree as a ZIP file
C Git's "git archive" command represents a tree object using a
standard archival format like tar, zip, or tgz, ready for consumption
by other, git-unaware users or tools.

Add a bare-bones analagous "jgit archive" command to show what is
possible, supporting only ZIP format for now.  It uses java.util.zip
which is not aware of the InfoZIP extensions for representing symlinks
and file permissions, so symlinks, executable files, and submodule
entries are represented as plain text files.

Making this functionality available from the library, improving
handling of special entries, and support for other output formats are
left for later patches.  Ultimately the intent is to offer a
TreeArchiveStream class for use by web frontends like Gitiles to offer
"download as zip/tgz/txz" links and use by, for example, code search
tools to get easy access to the content of git tree objects.

Test with "jgit archive my-favorite-tree >out.zip".

Change-Id: Ib590f173ceff3df4b58493cecccd6b9a1b355e3d
2012-11-16 16:21:25 -08:00
Tomasz Zarna fb33e80218 Add reflog command to JGit CLI
Bug: 394497
Change-Id: Ib8bc1d9fd789d22fe5f10e03068a11cfdd3e46eb
Signed-off-by: Chris Aniszczyk <zx@twitter.com>
2012-11-16 12:02:28 -08:00
Tomasz Zarna 318f3d4643 Add support for --no-ff while merging
Bug: 394432
Change-Id: I373128c0ba949f9b24248874f77f3d68b50ccfd1
Signed-off-by: Chris Aniszczyk <zx@twitter.com>
2012-11-16 11:04:13 +01:00
Tomasz Zarna cb0f0ad4cf Add a test for org.eclipse.jgit.pgm.Tag
The test checks if an error is thrown when trying to create the same tag
for the second time.

Change-Id: I4ed2f6c997587f0ea23bd26a32fb64a2d48a980e
Signed-off-by: Chris Aniszczyk <zx@twitter.com>
2012-11-15 16:28:02 -08:00
Tomasz Zarna 074f9194dc Prefix an abnormal CLI command termination with 'fatal:'
Change-Id: I3d257666c6fbed7b238c575808f73ec518e811b9
Signed-off-by: Chris Aniszczyk <zx@twitter.com>
2012-11-15 15:45:35 -08:00
Tomasz Zarna e8c25a1738 Add --squash option to org.eclipse.jgit.pgm.Merge
Change-Id: Ifd20b6f4731cfa71319145cac7b464aa53db18b8
2012-10-07 23:38:34 +02:00
Tomasz Zarna f7b644df66 Add tests for output result of merging -- org.eclipse.jgit.pgm.Merge
Change-Id: I888c7e80503b869d65a9617e6a07e01d1ff5f197
2012-09-17 07:07:00 -07:00
Robin Rosenberg caa362f20d Check for write errors in standard out and exit with error
The underlying problem is that System.out is a PrintWriter and
as such it does not throw exceptions on error, but rather just
sets a flag and continues.

This changes replaces the use of System.out with a PrintWriter-like
writer that does not catch error, but instead throw them to the
caller.

Bug: 366243
Change-Id: I44405edc4416e943b87f09a0f6ed041c6c51b046
2012-09-16 11:12:47 -07:00
Robin Rosenberg 5f094154dd Added new Status CLI command 'jgit status'
This is a first basic implementation that displays current branch and
list of files of various status, but isn't as refined as its native
counterpart (e.g. does not say if we're ahead or behind the remote).
It's been helpful in the diagnostic of bug #347885.

Bug: 348318
CQ: 6769
Change-Id: Ifc35da608fbba652524c1b5b522e3c0d5369ad5e
Signed-off-by: François Rey <eclipse.org@francois.rey.name>
Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
2012-09-09 21:10:59 +02:00
Tomasz Zarna e44c3e7139 Output result of switching branch -- o.e.jgit.pgm.Checkout
Change-Id: I9829950b686ce3b8c70b8f7a1774d5e2b55cd00a
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2012-09-05 07:59:37 +02:00
Shawn O. Pearce 189a01b617 show: Implement command line show for any object
Change-Id: I4dea84428d48b3de0e187c510b766f965323b21b
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
2012-07-18 00:31:47 +02:00
Tomasz Zarna 75b60afe41 Typo in CLIText#unknownMergeStratey, should be #unknownMergeStrategy
Change-Id: I4d4aa59723d6422ff755165e45f368da76d309ab
Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
2012-07-14 15:15:31 +02:00
Tomasz Zarna 23e0a3e734 Add config --list command to pgm
Currently, only --list option is supported with --global, --system,
--local and --file switches.

Change-Id: I9b179b162996520e95c4e001dccd65c566a4bd27
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2012-05-23 16:35:08 +02:00
Tomasz Zarna 94285e691a Add --all switch to org.eclipse.jgit.pgm.Commit
Change-Id: Iab52f995676daf60e0dfa043cc9e022f6e32a758
Signed-off-by: Chris Aniszczyk <zx@twitter.com>
2012-05-10 18:31:33 -07:00
Tomasz Zarna e5633ba2d3 Fix two typos in CLIText.properties
Change-Id: Id1429d52c88a9e2b888e6c6906cf8148945bd2ca
2012-05-02 11:35:13 +02:00
Tomasz Zarna 8c60468ff4 Allow to amend commits with JGit CLI
Change-Id: I0e8d365b56e079ac4ccece7fcf80ea140c319c78
2011-12-18 16:28:44 +01:00
Robin Rosenberg 6baf0cb956 Make use of the many date formatting options in the log command
Change-Id: I30f1049fce086f2cf7e39ba3ad8b335df3a7b827
2011-10-26 23:15:24 +02:00
Shawn O. Pearce a5f5b20dff blame: Implement blame on the command line
Command line options match the C implementation of `git blame` as
closely as possible, making for a pretty complete tool.

Change-Id: Ie1bd172ad9de586c3b60f0ee4a77a8f047364882
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2011-08-13 14:12:03 -07:00
Christian Halstrick 153283f05a Added Merge command to the CLI
This merge command accepts the merge strategy as option and uses the
resolve strategy as default. It expects exactly one other
revision which is merged with current head.

Change-Id: Ia8c188b93ade4afabe6a9ccf267faf045f359a3a
Signed-off-by: Christian Halstrick <christian.halstrick@sap.com>
Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
2011-03-29 12:27:45 -05:00
Philipp Thun a490afedba Add -o option to commit command
This change adds the --only/ -o option to the commit command.

Change-Id: I44352d56877f8204d985cb7a35a2e0faffb7d341
Signed-off-by: Philipp Thun <philipp.thun@sap.com>
2011-03-11 14:25:46 +01:00
Sasa Zivkov 3e1a5081d6 Show notes in Log CLI command - Part 2
This change fixes issues identified in the commit
5f3d577e5a.

Change-Id: Idbd935f5f60ad043faa0d4982b3e101ef7c07d60
Signed-off-by: Sasa Zivkov <sasa.zivkov@sap.com>
2011-03-01 09:29:35 +01:00
Sasa Zivkov 5f3d577e5a Show notes in Log CLI command
Support for --no-standard-notes and --show-notes=REF options is added
to the Log command. The --show-notes option can be specified more than
once if more than one notes branch should be used for showing notes.

The notes are displayed from note branches in the order how the note
branches are specified in the command line. However, the standard note,
from the refs/notes/commits, is always displayed as first unless
the --no-standard-notes options is given.

Change-Id: I4e7940804ed9d388b625b8e8a8e25bfcf5ee15a6
Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
2011-02-23 09:32:23 -06:00
Chris Aniszczyk bd8944d671 Add Reset to the JGit CLI
Change-Id: I85368c849c0964b9a539fa1991920adb2ace94df
Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
2011-02-17 14:06:28 -06:00
Chris Aniszczyk c441380f9c Add the Checkout command to the Git CLI
The implementation delegates to the CheckoutCommand and
therefore only supports some of the options supported by
the CheckoutCommand.

Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
2010-11-23 13:07:46 -06:00
Christian Halstrick a28f33fa8c Fixed help of Diff and ShowCommands commands
jgit.sh <command> --help was not working for the commands Diff
and ShowCommands because of missing metaVar information. Missing
information is added here.

Change-Id: I0ab7e35006b6aa7d4326a634309dddfcdb78f2a6
Signed-off-by: Christian Halstrick <christian.halstrick@sap.com>
2010-11-08 13:56:07 -08:00
Sasa Zivkov 1a7c918b66 Implemented the git add commandline command.
Implementation delegates all work to the AddCommand class and,
therefore, supports only those options currently supported by the
AddCommand which means: --update and the filepattern... arguments.

Change-Id: I4827d37e08b4c988c2458d9ba60a61b6ad414d10
Signed-off-by: Sasa Zivkov <sasa.zivkov@sap.com>
2010-11-07 21:30:56 +01:00
Christian Halstrick e10808e658 Add option to select diff algorithm for diff command
The diff command in the pgm package was enhanced to allow
choosing the diff algorithm (currently myers or histogram)

Change-Id: I72083e78fb5c92868eb5d8ec512277d212a39349
Signed-off-by: Christian Halstrick <christian.halstrick@sap.com>
2010-10-26 18:07:49 +02:00
Shawn O. Pearce fed508d55b diff: Default arguments to HEAD, working directory
Similar to C Git, default our difference when no trees are given
to us to something that makes a tiny bit of sense to the human.

We also now support the --cached flag, and have its meaning work the
same way as C Git.

Change-Id: I2f19dad4e018404e280ea3e95ebd448a4b667f59
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2010-09-02 11:38:39 -07:00
Shawn O. Pearce 244b1580b5 log, diff: Add --src-prefix, --dst-prefix, --no-prefix
Change-Id: I0c7154a51143d56362f12ee4fa93133778d3a9eb
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2010-09-02 11:38:39 -07:00
Shawn O. Pearce ec2fdbf2ba Move rename detection, path following into DiffFormatter
Applications just want a quick way to configure our diff
implementation, and then just want to use it without a lot of fuss.

Move all of the rename detection logic and path following logic
out of our pgm package and into DiffFormatter itself, making it
much easier for a GUI to take advantage of the features without
duplicating a lot of code.

Change-Id: I4b54e987bb6dc804fb270cbc495fe4cae26c7b0e
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2010-09-02 11:38:39 -07:00
Shawn O. Pearce 707912b35d Make Tag class only for writing
The Tag class now only supports the creation of an annotated tag
object.  To read an annotated tag, applictions should use RevTag.
This permits us to have exactly one implementation, and RevTag's
is faster and more bug-free.

Change-Id: Ib573f7e15f36855112815269385c21dea532e2cf
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2010-08-20 17:38:53 -07:00
Shawn O. Pearce 9fbce904e6 Pass PackConfig down to PackWriter when packing
When we are creating a pack the higher level application should be able
to override the PackConfig used, allowing it to control the number of
threads used or how much memory is allocated per writer.

Change-Id: I47795987bb0d161d3642082acc2f617d7cb28d8c
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2010-07-28 12:13:48 -07:00
Shawn O. Pearce 8a0c58394d log: Add whitespace ignore options
Similar to what we did with diff, implement whitespace ignore options
for log too.  This requires us to define some means of creating any
RawText object type at will inside of DiffFormatter, so we define a
new factory interface to construct RawText instances on demand.

Unfortunately we have to copy the entire block of common options.
args4j only processes the options/arguments on the one command class
and Java doesn't support multiple inheritance.

Change-Id: Ia16cd3a11b850fffae9fbe7b721d7e43f1d0e8a5
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2010-07-03 17:32:47 -07:00
Shawn O. Pearce 04a9d23b9a log, diff: Add rename detection support
Implement rename detection in the command line diff and log commands.
Also support --name-status, -p and -U flags, as these can be quite
useful to view more detail.

All of the Git patch file formatting code is now moved over to the
DiffFormatter class.  This permits us to reuse it in any context,
including inside of IDEs.

Change-Id: I687ccba34e18105a07e0a439d2181c323209d96c
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2010-07-03 16:32:03 -07:00
Shawn O. Pearce 072ad087ff Externalize strings in Commit command
Change-Id: I08b2cdd147ad6f3c67795f2e75a5b5d2ce2fb20f
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2010-05-28 09:50:07 -07:00
Sasa Zivkov f3d8a8ecad Externalize strings from JGit
The strings are externalized into the root resource bundles.
The resource bundles are stored under the new "resources" source
folder to get proper maven build.

Strings from tests are, in general, not externalized. Only in
cases where it was necessary to make the test pass the strings
were externalized. This was typically necessary in cases where
e.getMessage() was used in assert and the exception message was
slightly changed due to reuse of the externalized strings.

Change-Id: Ic0f29c80b9a54fcec8320d8539a3e112852a1f7b
Signed-off-by: Sasa Zivkov <sasa.zivkov@sap.com>
2010-05-19 14:37:16 -07:00