Commit Graph

1988 Commits

Author SHA1 Message Date
Robin Stocker 69d7d1b0b6 Add RevWalkUtils with count(start, end) method
It returns the number of commits that are in start and not in end.
Useful for calculating how much a branch is ahead of another one.

Change-Id: I09f7d9b049beea417da7ff32c9f8bf0d4ed46a7f
Signed-off-by: Robin Stocker <robin@nibor.org>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2012-01-16 22:05:20 +01:00
Christian Halstrick a9892fba46 Merge "Support more of AutoCRLF" 2012-01-16 10:53:13 -05:00
Robin Rosenberg 03b5416a35 Fix resolution of tree when path is empty
Revision strings that end with a ':' with no trailing path
should return the tree associated with the current ref parsed

Bug: 368370
Change-Id: I7c7617a77bd418bad4e570be2d1e9002ad280762
Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
2012-01-15 23:56:37 +01:00
Robin Rosenberg e875c905d3 Make sure all bytes are written to files on close, or get an error.
Java's BufferedOutputStream swallows any errors that occur when flushing
the buffer in close().

This class overrides close to make sure an error during the final
flush is reported back to the caller.

Change-Id: I74a82b31505fadf8378069c5f6554f1033c28f9b
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2012-01-15 11:22:52 +01:00
Robin Rosenberg 02729810f9 Merge "Resolve ~ with no trailing number as the first parent commit" 2012-01-14 20:28:52 -05:00
Matthias Sohn b8830d7bbb Throw API exception when LsRemoteCommand fails with TransportException
In many cases applications want to handle TransportException hence
expose it as an API exception.

Change-Id: I64b885ecfb1a35bd93c89026c6298d1820ba69d0
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2012-01-15 01:38:25 +01:00
Kevin Sawicki c963e7aacf Resolve ~ with no trailing number as the first parent commit
This would previously throw a RevisionSyntaxException

Change-Id: I42b4988c7f6c6454e2ebda13914260e25ac1a889
2012-01-14 15:34:18 -08:00
Robin Rosenberg d5c890e0fd Cannot commit -o file with only file permission change
Bug 345076
Change-Id: Ie64039793ab6ba4748731320399f03301b6282ec
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2012-01-13 11:24:31 +01:00
Robin Rosenberg 76dd9d1d46 Support more of AutoCRLF
This patch introduces CRLF handling to the DirCacheCheckout and
WorkingTreeIterator supporting the AutoCRLF for add, checkout
reset and status and hopefully some other places that depende
on the underlying logic of the affected API's.

The patch includes test cases for the Status command provided by
Tomasz Zarna for bug 353867.

The core.eol and core.safecrlf options are not yet supported.

Bug: 301775
Bug: 353867
Change-Id: I2280a2dc0698829475de6a662a6c6e80b1df7663
2012-01-10 23:15:52 +01:00
Matthias Sohn 6a582970bf Merge "Provide helper for unlocking a file" 2012-01-10 12:24:49 -05:00
Kevin Sawicki aebfc70cc8 Provide helper for unlocking a file
This will allow recovery from a LockFailedException where
the file associated with an exception is passed to FileUtils.unlock
to attempt an unlock on the file so the operation can be retried

Change-Id: I580166d386126bfb54a318a65253070a6e325936
2012-01-09 08:46:13 -08:00
Tomasz Zarna f78e52b645 Add setter for ProgressMonitor to DiffCommand
Change-Id: I34f8b77a461e165d7d624dbd9a6944feadc57b8e
2012-01-09 15:48:16 +01:00
Stefan Lay 8f742cdd10 Merge "Add options for setting context lines and prefixes to DiffCommand" 2012-01-09 07:06:59 -05:00
Tomasz Zarna 69a5683b82 Add options for setting context lines and prefixes to DiffCommand
Change-Id: I539f3531e94c11c0f0a3e7096c0eb1b1c309898a
2012-01-09 12:13:30 +01:00
Christian Halstrick 885a389832 Merge "Add helper for determining if status is clean" 2012-01-09 06:13:12 -05:00
Matthias Sohn 0f15d656f2 Narrow exceptions declared by LsRemoteCommand
API commands either throw GitAPIException or JGitInternalException.

Also add missing javadoc and reduce nesting of catch blocks.

Change-Id: I9a3b302e1b3f373ee11a977a0e3d6213bfbd3cdf
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Signed-off-by: Kevin Sawicki <kevin@github.com>
2012-01-08 17:15:05 -08:00
Robin Rosenberg 0806c803a9 Merge "Retain executable mode of existing files on Windows" 2012-01-08 16:34:28 -05:00
Matthias Sohn f9726423ab Merge "Use constants from ConfigConstants in CoreConfig" 2012-01-05 10:15:55 -05:00
Kevin Sawicki 3d15298011 Add helper for determining if status is clean
This checks if all collections that Status exposes are
empty or not

Change-Id: I0c342ab70dc36c1fd70acb4f8a924bb207d62f47
2012-01-03 16:48:01 -08:00
Kevin Sawicki 69451b8302 Provide file mode of paths in index from IndexDiff
Change-Id: I1d543e2f721987114cc1e1cb0848c234470df794
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2012-01-04 00:27:56 +01:00
Kevin Sawicki 6c959f7702 Use constants from ConfigConstants in CoreConfig
Change-Id: Ic1253498ecdd7545c6b1f114f4c83a3b77273874
2012-01-03 15:24:55 -08:00
Kevin Sawicki c15c46e41e Retain executable mode of existing files on Windows
Currently files in a repository marked as executable will have
that mode unset when modified and committed on systems that
do not support detection of this mode since the working tree
iterator will never report this mode for any entries.

This change updates WorkingTreeIterator to be able
to determine the target file mode to be used for the index
through consideration of the configured WorkingTreeOptions.

Bug: 364956
Change-Id: Iae496baa011b8a59d9329ec73615482b03d34a5a
2012-01-03 15:07:02 -08:00
Kevin Sawicki d57c00e036 Add support for cloning submodules to CloneCommand
Change-Id: Ib1f82206fa14be75e2080f95db9f2d178e876453
2012-01-02 17:32:41 -08:00
Kevin Sawicki dea4511572 Extend TransportCommand in submodule add/update commands
This allows all the settings of a TransportCommand to be
configured on the clone commands that are run by submodule
add/update

Change-Id: I93bfe5a91d430200de8c7f1e32a60cb990aa58ea
2012-01-02 09:40:53 -08:00
Kevin Sawicki 287d17f601 Add submodule command helpers to Git class
Change-Id: I649d96617072db68ab15aa2569836fa783577424
2012-01-02 09:34:25 -08:00
Tomasz Zarna 1a2ca5b811 Skip a number commits before starting to show the commit output
Change-Id: Id2666d897d29b6371f7a6cf241cfda02964b4971
Signed-off-by: Kevin Sawicki <kevin@github.com>
2012-01-02 08:40:02 -08:00
Tomasz Zarna 5d95cd9418 Add constant for default name for the Git repo configuration
Change-Id: I5a6ef686c444fb1e46c9f784bad01165471ef372
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2012-01-02 13:24:36 +01:00
Tomasz Zarna 617c5d91da Sort translation bundle keys in alphabetical order.
Change-Id: I83e26531ea924178ba43fa82b3c1fe02afd23eca
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2012-01-02 12:59:05 +01:00
Matthias Sohn 174536fa16 Update base version for clirr API check to latest release
Change-Id: Icb56610241c80d6ca8a980f6d419f4934579d441
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2011-12-30 02:09:17 +01:00
Kevin Sawicki 92c6f2f97b Add comand support for git-submodule
Adds the following commands:
    - Add
    - Init
    - Status
    - Sync
    - Update

This also updates AddCommand so that file patterns added that
are submodules can be staged in the index.

Change-Id: Ie5112aa26430e5a2a3acd65a7b0e1d76067dc545
Signed-off-by: Kevin Sawicki <kevin@github.com>
Signed-off-by: Chris Aniszczyk <zx@twitter.com>
2011-12-28 10:33:14 -06:00
Kevin Sawicki 3c7dceec1a Add commit id and parent count to exception message
Bug: 357312
Change-Id: I2f85cf88650594eca7df6aa0e26bea329674f08e
2011-12-27 13:37:42 -08:00
Shawn Pearce 80c5210409 Merge "Only print stack trace to Sytem.err when debug flag is set" 2011-12-27 16:24:36 -05:00
Tomasz Zarna 8f8e43b741 Fix typo in RebaseResult#mySatus
Change-Id: I88d34eec8307231f89343ead06858d1df4ac0886
2011-12-27 21:47:44 +01:00
Kevin Sawicki 2de1d9fb64 Only print stack trace to Sytem.err when debug flag is set
Bug: 362100
Change-Id: Id18de9660f0dc2fb6c30db9770f31f26c874022d
2011-12-27 09:20:03 -08:00
Matthias Sohn 067ccbfda7 Merge branch 'stable-1.2'
* stable-1.2:
  JGit v1.2.0.201112221803-r
  Expose unmerged paths when revert fails
  Enforce the use of Java5 API:s only (with a few exceptions)

Change-Id: Ib18d41a65e68cc47fb63114fcce27a16820d0692
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2011-12-26 23:52:32 +01:00
Robin Rosenberg 64a3bf1dcb Merge "Limit the number of commits in LogCommand output" 2011-12-23 13:28:21 -05:00
Tomasz Zarna 248959146a Limit the number of commits in LogCommand output
Bug: 316680
Change-Id: I88cf7aac6b5763cc94421433dd4bbd42f81e0e69
2011-12-23 13:38:07 +01:00
Tomasz Zarna acd8aee98a DiffFormatter#format(List) fails unless #scan(ATI, ATI) is called first
Bug: 354919
Change-Id: I710394fe6675e0e5aa66d9118c5b10d433aa30ea
2011-12-23 13:05:31 +01:00
Robin Rosenberg 160ffc9df1 Merge "Support getting specific entry number in reflog" 2011-12-22 18:49:04 -05:00
Matthias Sohn a069e90fa9 JGit v1.2.0.201112221803-r
Change-Id: Icc0b09324f205d93929af8cf522a99ad00cf7591
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2011-12-23 00:19:02 +01:00
Christian Halstrick 200d3f5aaf Refactor ResolveMerger
The places where ResolveMerger was doing content merges have been
refactored. The goal was to have one single method where content merge
was done and to factor out other topics (updating the index, updating
the working tree) into own methods. This was done to allow adding
pluggable content mergers in change
I7817e2123d254f3eeb315b47a61d2c55bd202c12

Change-Id: I8529697b197372a284bcd5ab2c9ba1adb925a520
Signed-off-by: Christian Halstrick <christian.halstrick@sap.com>
2011-12-20 10:17:42 +01:00
Kevin Sawicki 52507ee2e7 Expose unmerged paths when revert fails
Change-Id: I02678aeb31a62668ae2b0342a6dae721e043dc5e
2011-12-19 22:46:20 +01:00
Kevin Sawicki 1dcb76739c Support getting specific entry number in reflog
The number specified is interpreted as relative to the
last entry in the reflog.

Change-Id: Ie4dd03370bb0d475a0e89d3015113ca98920100f
2011-12-19 09:14:47 -08:00
Kevin Sawicki 656461a991 Add exception class for when locking a file fails
This will allows calling classes to handle lock failures
without checking against the message and will also provide
access to the file that could not be locked.

Change-Id: I95bc59e1330a7af71ae3b0485c4516299193f504
2011-12-18 14:40:42 -08:00
Tomasz Zarna 8c60468ff4 Allow to amend commits with JGit CLI
Change-Id: I0e8d365b56e079ac4ccece7fcf80ea140c319c78
2011-12-18 16:28:44 +01:00
Kevin Sawicki dc4c06e7ac Support resolving integer-based reflog revisions
Revision strings such as 'master@{0}' can now be resolved
by Repository.resolve by reading the reflog for the ref and
returning the commit for the entry number specified.

This still throws an exception for cases not supported
such as 'master@{yesterday}'.

Change-Id: I6162777d6510e083565a77cac4545cda5a9aefb3
2011-12-16 17:05:47 -08:00
Robin Rosenberg 29fc8fffc1 Merge "Report diff entries for files that only change mode" 2011-12-16 10:30:24 -05:00
Matthias Sohn f1019b9738 Merge branch 'stable-1.2'
* stable-1.2:
  Add API checking using clirr
  Fix MergeCommandTest to pass if File.executable is not supported
  Fix ResolveMerger not to add paths with FileMode 0

Change-Id: I86e7194a40acd6dfa3d433f1d17c01bdf5bb0d9c
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2011-12-16 08:50:49 +01:00
Robin Rosenberg 0ca105a502 Enforce the use of Java5 API:s only (with a few exceptions)
This only works with Eclipse 3.6 and newer and requires installation
of new package. Documentation is not very good, but there is a blog
about it here:
http://eclipseandjazz.blogspot.com/2011/10/of-invalid-references-to-system.html

API checking is especially useful on OS X where Java5 is not readily
available.

Change-Id: I3c0ad460874a21c073f5ac047146cbf5d31992b4
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2011-12-16 01:01:36 +01:00
Matthias Sohn 78ebffd5f4 Merge "Fix MergeCommandTest to pass if File.executable is not supported" into stable-1.2 2011-12-15 18:58:48 -05:00