Commit Graph

1293 Commits

Author SHA1 Message Date
Mathias Kinzler 920ac08777 Allow to set a CredentialsProvider on relevant API commands
This is needed for commands that use Transport internally.

Change-Id: I9417c85255b160723968c647063b9c7e05995ea4
Signed-off-by: Mathias Kinzler <mathias.kinzler@sap.com>
Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
2011-01-25 16:36:10 -06:00
Sasa Zivkov 832d3b8384 Exposed the constructor of Note class
Additionally, defined the NoteMap.getNote method which returns a Note
instance.  These changes were necessary to enable implementation of
the NoteMerger interface (the merge method needs to instantiate a
Note) and to enable direct use of NoteMerger which expects instances
of Note class as its paramters.  Implementing creation of code review
summary notes in Gerrit [1] will make use of both of these features.

[1] https://review.source.android.com/#change,20045

Change-Id: I627aefcedcd3434deecd63fa1d3e90e303b385ac
Signed-off-by: Sasa Zivkov <sasa.zivkov@sap.com>
Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
2011-01-25 16:33:29 -06:00
Chris Aniszczyk f214952552 Merge "Build http.server source JAR" 2011-01-21 10:32:22 -05:00
Christian Halstrick c62882191f Introduce metaData compare between working tree and index entries
Instead of offering only a high-level isModified() method a new
method compareMetadata() is introduced which compares a working tree entry
and a index entry by looking at metadata only. Some use-cases
(e.g. computing the content-id in idBuffer()) may use this new method
instead of isModified().

Change-Id: I4de7501d159889fbac5ae6951f4fef8340461b47
Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
2011-01-21 09:23:06 -06:00
Robin Rosenberg 5e2e3819a6 Add progress reporting to IndexDiff
Change-Id: I4f05bdb0c58b039bd379341a6093f06a2cdfec6e
Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2011-01-21 01:28:54 +01:00
Shawn O. Pearce ef08017ecc Build http.server source JAR
Change-Id: I459de081fd518abfa50dd812c68eed4d1c7f8a0b
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2011-01-20 14:46:27 -08:00
Robin Rosenberg e43887b69e Fix misc spelling errors in comments and method names
Change-Id: I24552443710075856540696717ac4068dfe6a7f2
Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
2011-01-17 22:04:14 +01:00
Matthias Sohn de1d057d72 Merge "File utility for creating a new empty file" 2011-01-16 12:22:46 -05:00
Matthias Sohn c45f2aec56 File utility for creating a new empty file
The java.io.File.createNewFile() method for creating new empty files
reports failure by returning false. To ease proper checking of return
values provide a utility method wrapping createNewFile() throwing
IOException on failure.

Change-Id: I42a3dc9d8ff70af62e84de396e6a740050afa896
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2011-01-14 17:28:14 +01:00
Shawn Pearce 67e176e529 Merge "ConfigConstants: expose some constants for user name and email." 2011-01-12 10:47:55 -05:00
Shawn Pearce 600f624a35 Merge "CheckoutCommand: fix reflog message" 2011-01-12 10:46:23 -05:00
Shawn Pearce 11f2b849a3 Merge "Locate $HOME like C Git does on Windows" 2011-01-12 10:44:57 -05:00
Roberto Tyley 944fcdae66 Fix API ListBranchCommand for listmode 'all'
If remote branches are present they can not be added
to the RefMap from the local branches - the two RefMaps
have a different value of 'prefix' and consequently an
IllegalArgumentException is thrown.
2011-01-12 14:34:10 +00:00
Robin Rosenberg 0fd9676771 Locate $HOME like C Git does on Windows
Java's user.home is not the same as $HOME so EGit did see the
same global configuration as C Git does.

Bug: 333269
Change-Id: Id54fc5292bf8c5a67177f9097ee692717a7df336
Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
2011-01-12 14:58:55 +01:00
Mathias Kinzler 7047d2fa8d CheckoutCommand: fix reflog message
There is a space missing between <from> and "to" in the reflog
message produced by the CheckoutCommand, which is of the form

moving from <from> to <to>

Change-Id: I3dc57ab0a6589292db77a17d9029ee9499dfc725
Signed-off-by: Mathias Kinzler <mathias.kinzler@sap.com>
2011-01-12 13:19:32 +01:00
Mathias Kinzler 5ebfdc8091 ConfigConstants: expose some constants for user name and email.
This is needed by a EGit change

http://egit.eclipse.org/r/#change,2232

Change-Id: I3d62f904b769fc2f1b7b8f0f24f7dd757fc9c379
Signed-off-by: Mathias Kinzler <mathias.kinzler@sap.com>
2011-01-12 08:50:12 +01:00
Shawn Pearce be38185a03 Merge "Using java.util.concurrent in NLSTest instead of handling threads directly." 2011-01-10 10:05:28 -05:00
Matthias Sohn 838fdb342b Merge "Do not cherry-pick or revert commit more than once" 2011-01-10 09:00:30 -05:00
Sasa Zivkov d7ca892042 Using java.util.concurrent in NLSTest instead of handling threads directly.
A test in NLSTest was mixing the "old" and the "new" way of handling
concurrency. This change makes use of the java.util.concurrent facilities to
control concurrency and removes the code that was directly dealing with Thread
objects.

Change-Id: Ie7267776e988a48a5443f0f3fe4eb43e79eee4b1
Signed-off-by: Sasa Zivkov <sasa.zivkov@sap.com>
2011-01-10 09:15:26 +01:00
Robin Rosenberg 2058f9272b Do not cherry-pick or revert commit more than once
Instead just return success. In the case that no commit has been
cherry-picked or reverted, just return the old HEAD.
    
Bug: 333814
Change-Id: I67db2b77b52c43932436d22a8daa5a6556423484
Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
2011-01-10 08:47:14 +01:00
Shawn O. Pearce 05ca0c49f9 Merge "Use heap based stack for PackFile deltas" 2011-01-09 19:20:13 -05:00
Shawn O. Pearce 680869d779 Merge "Config: Preserve existing case of names in sections" 2011-01-09 19:19:08 -05:00
Sasa Zivkov 1993cf8a27 Merging Git notes
Merging Git notes branches has several differences from merging "normal"
branches. Although Git notes are initially stored as one flat tree the
tree may fanout when the number of notes becomes too large for efficient
access. In this case the first two hex digits of the note name will be
used as a subdirectory name and the rest 38 hex digits as the file name
under that directory. Similarly, when number of notes decreases a fanout
tree may collapse back into a flat tree. The Git notes merge algorithm
must take into account possibly different tree structures in different
note branches and must properly match them against each other.

Any conflict on a Git note is, by default, resolved by concatenating
the two conflicting versions of the note. A delete-edit conflict is, by
default, resolved by keeping the edit version.

The note merge logic is pluggable and the caller may provide custom
note merger that will perform different merging strategy.

Additionally, it is possible to have non-note entries inside a notes
tree. The merge algorithm must also take this fact into account and
will try to merge such non-note entries. However, in case of any merge
conflicts the merge operation will fail. Git notes merge algorithm is
currently not trying to do content merge of non-note entries.

Thanks to Shawn Pearce for patiently answering my questions related to
this topic, giving hints and providing code snippets.

Change-Id: I3b2335c76c766fd7ea25752e54087f9b19d69c88
Signed-off-by: Sasa Zivkov <sasa.zivkov@sap.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2011-01-09 00:27:56 +01:00
Marc Strapetz c87ae94c70 Fix IgnoreRule for directory-only patterns
Patterns containing only a trailing slash have to be treated
as "global" patterns. For example: "classes/" matches "classes"
as well as "dir/classes" directory.
2011-01-07 12:53:14 +01:00
Shawn O. Pearce b2d528887c Config: Preserve existing case of names in sections
When an application asks for the names in a section, it may want to
see the existing case that was stored by the user.  For example,
Gerrit Code Review wants to store a configuration block like:

  [access "refs/heads/master"]
    label-Code-Review = group Developers

and although the name label-Code-Review is case-insensitive, it wants
to display the case as it appeared in the configuration file.

When enumerating section names or variable names (both of which are
case-insensitive), Config now keeps track of the string that first
appeared, and presents them in file order, permitting applications to
use this information.  To maintain case-insensitive behavior, the
contains() method of the returned Set<String> still performs a
case-insensitive compare.

This is a behavior change if the caller enumerates the returned
Set<String> and copies it to his own Set<String>, and then performs
contains() tests against that, as the strings are now the original
case from the configuration block.  But I don't think anyone actually
does this, as the returned sets are immutable and are cached.

Change-Id: Ie4e060ef7772958b2062679e462c34c506371740
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2011-01-06 11:13:45 -08:00
Shawn O. Pearce 165358bc99 Use heap based stack for PackFile deltas
Instead of using the current thread's stack to recurse through the
delta chain, use a linked list that is stored in the heap.  This
permits the any thread to load a deep delta chain without running out
of thread stack space.

Despite needing to allocate a stack entry object for each delta
visited along the chain being loaded, the object allocation count is
kept the same as in the prior version by removing the transient
ObjectLoaders from the intermediate objects accessed in the chain.
Instead the byte[] for the raw data is passed, and null is used as a
magic value to signal isLarge() and enter the large object code path.

Like the old version, this implementation minimizes the amount of
memory that must be live at once.  The current delta instruction
sequence, the base it applies onto, and the result are the only live
data arrays.  As each level is processed, the prior base is discarded
and replaced with the new result.

Each Delta frame on the stack is slightly larger than the standard
ObjectLoader.SmallObject type that was used before, however the Delta
instances should be smaller than the old method stack frames, so total
memory usage should actually be lower with this new implementation.

Change-Id: I6faca2a440020309658ca23fbec4c95aa637051c
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2011-01-06 09:48:43 -08:00
Sasa Zivkov 7cd812940d NoteMap implements Iterable<Note>
We will need to iterate over all notes of a NoteMap, at least this will be
needed for testing purposes. This change also implied making the Note class
public.

Change-Id: I9b0639f9843f457ee9de43504b2499a673cd0e77
Signed-off-by: Sasa Zivkov <sasa.zivkov@sap.com>
2011-01-05 08:24:13 +01:00
Shawn O. Pearce b7f887f120 Cleanup configuration of Maven JUnit runner
Set the plugin version in the top-level pom, not the unit test pom.
This ensures the same plugin is used for all JUnit tests within the
overall project.

Drop the include **/*Test.java definition, as its no longer necessary
with the JUnit 4 based test suite.  All of the test classes now end
with "Test" and include @Test annotations on the test methods.

Change-Id: Ib2c180bf531e1a97e31979fcc281fa0fc5a1abb3
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2011-01-02 14:35:04 -08:00
Shawn O. Pearce e026cfab38 Fix NLSTest and RootLocalTest for JUnit 4
These test classes needed new @Test annotations to be found by the
JUnit 4 test runner.

Change-Id: I61b6a8ebd468fa2d13fad5bf9cbd8f81a6f67e41
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2011-01-02 14:32:02 -08:00
Shawn Pearce 117d081f44 Merge "Implement a revert command" 2011-01-02 17:21:58 -05:00
Robin Rosenberg b3e59bd9d6 Implement a revert command
This is almost reverted cherry-pick, and the implementation is
almost identical. It orders the input to merge differently to get
the effect and produces a different commit message with the
default author, rather than the original author.

Change-Id: I39970091d9f7406ae7168b8efaab23a5e2c16bad
Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
2011-01-02 22:15:07 +01:00
Robin Rosenberg ff7149fb95 Require the hamcrest packaging that comes with Eclipse
The other one gets installed with SWTBot, but you do not
need it if you do not hack EGit. Using import-package
instead of require-bundle fixes the dependency. Actually
we do not need hamcrest at this time, but JUnit wants it.

Change-Id: I59873618f86d02e8439d40c1f322ea8e5c4fe3fc
Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
2011-01-01 19:05:00 +01:00
Shawn Pearce 9a3ce780fc Merge "[findbugs] Make CheckoutResult constants final" 2010-12-31 17:08:23 -05:00
Robin Rosenberg 2465e3a653 Drop unneccessary @SuppressWarnings
Change-Id: I3a5b877efd3a58ad463c47bb663d073baea81dda
Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
2010-12-31 14:05:42 -08:00
Robin Rosenberg 952a86b3ad Fix TestTranslationBundle
The test was never run from maven, because its name did not end
in a way that was recognized by the pom. After rename it failed
because it did not find its resources.

Rename test class and move resources to the resources folder

Change-Id: I74a7ef1373cd902e1d05ff6ea38f8648b5fc5700
Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
2010-12-31 14:01:34 -08:00
Robin Rosenberg d9e07a574a Convert all JGit unit tests to JUnit 4
Eclipse has some problem re-running single JUnit tests if
the tests are in Junit 3 format, but the JUnit 4 launcher
is used. This was quite unnecessary and the move was not
completed. We still have no JUnit4 test.

This completes the extermination of JUnit3. Most of the
work was global searce/replace using regular expression,
followed by numerous invocarions of quick-fix and organize
imports and verification that we had the same number of
tests before and after.

- Annotations were introduced.
- All references to JUnit3 classes removed
- Half-good replacement for getting the test name. This was
  needed to make the TestRngs work. The initialization of
  TestRngs was also made lazily since we can not longer find
  out the test name in runtime in the @Before methods.
- Renamed test classes to end with Test, with the exception
  of TestTranslateBundle, which fails from Maven
- Moved JGitTestUtil to the junit support bundle

Change-Id: Iddcd3da6ca927a7be773a9c63ebf8bb2147e2d13
Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2010-12-31 14:00:05 -08:00
Shawn Pearce 7cf8b8812f Merge "Add support for getting the system wide configuration" 2010-12-31 16:13:33 -05:00
Robin Rosenberg 797ebba307 Add support for getting the system wide configuration
These settings are stored in <prefix>/etc/gitconfig. The C Git
binary is installed in <prefix>/bin, so we look for the C Git
executable to find this location, first by looking at the PATH
environment variable and then by attemting to launch bash as
a login shell to find out.

Bug: 333216
Change-Id: I1bbee9fb123a81714a34a9cc242b92beacfbb4a8
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
2010-12-31 11:48:34 +01:00
Shawn Pearce 4da775eaff Merge "IndexPack: Use stack-based recursion for delta resolution" 2010-12-30 19:52:47 -05:00
roberto b5f0a7d7ff IndexPack: Use stack-based recursion for delta resolution
Replace 'method' with 'heap'-based recursion for resolving deltas.

Git packfile delta-chain depth can exceed 50 levels in certain files
(the packfile of the JGit project itself has >800 objects with
chain-length >50). Using method-based recursion on such packfiles will
quickly throw a StackOverflowError on VMs with constrained stack.

Benefits:

* packfile delta-resolution no longer limited by the maximum number
  of stack frames permitted on the current thread.

* slight performance improvement
  (3% speed increase on the packfile of the JGit project)

Change-Id: I1d9b3a8ba3c6d874d83cb93ebf171c6ab193e6cc
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2010-12-30 16:49:24 -08:00
Matthias Sohn 65ccadeced [findbugs] Make CheckoutResult constants final
Change-Id: I9117f212e2ad7051fdc6e7417ebc7c2d15b357a8
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2010-12-30 23:04:43 +01:00
Robin Rosenberg 240769e023 Refactor exec of a command and reading one line into utility
Change-Id: Ia9e5afe7f29c3e5e74b8d226441ed429fb229c82
Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
2010-12-30 12:41:22 -08:00
Robin Rosenberg 14b358a6fb Refactor search for a file within a PATH
Change-Id: I785ab6bf1823d174394b1d2b25c5bb202535e943
2010-12-30 12:38:18 -08:00
Shawn Pearce 558879d820 Merge "Add launchers for the JGit HTTP package test" 2010-12-30 15:32:33 -05:00
Shawn Pearce a3ac82977b Merge "Enable JUnit4 in the jgit.http package too" 2010-12-30 15:31:40 -05:00
Shawn Pearce 7a1bd7adb1 Merge "Fix FileSnapShot" 2010-12-30 15:31:06 -05:00
Shawn Pearce 488307ada7 Merge "Enable use of JUnit 4 with maven" 2010-12-30 15:27:26 -05:00
Robin Rosenberg 02ae788fa6 Add launchers for the JGit HTTP package test
Change-Id: I8bb5cb5342ab86fbc586d879dc56f70f4c0e6ace
Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
2010-12-30 01:37:04 +01:00
Robin Rosenberg bf4ee4e6d4 Enable JUnit4 in the jgit.http package too
There are currently no JUnit4 tests here, but since we made JUnit4
the default for maven, it should be for Eclipse builds too.

Change-Id: Ic910df1705fa8d6ac26e97a41947cb8e5526d334
Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
2010-12-30 01:25:18 +01:00
Robin Rosenberg c3f52c62a8 Fix FileSnapShot
We cannot use SystemReader to get the time, unless we do that consistently,
which is harder to do and be sure we are really testing what we want.

Then we need to update our lastRead variable whenever we conclude that
our file is not racily clean according to lastRead. It may well be clean,
but we do not know that until we check the system clock again.

Finally add a test for this class.

Change-Id: I1894b032b9bd359d1b5325e5472d48e372599e4c
Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
2010-12-30 01:15:59 +01:00