Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Implement 'Pull' operation for issue #37 - will update working dir

Not hooked up to anything yet...

#37
  • Loading branch information...
commit 6fdffd3af7f5856994c3e074c81d76514775521b 1 parent 1857c7a
@rtyley authored
Showing with 492 additions and 641 deletions.
  1. +0 −2  agit-integration-tests/src/main/java/com/madgag/agit/AboutActivityStoryTest.java
  2. +4 −5 agit-integration-tests/src/main/java/com/madgag/agit/AgitTestApplication.java
  3. +42 −0 agit-integration-tests/src/main/java/com/madgag/agit/AndroidTestEnvironment.java
  4. +3 −6 agit-integration-tests/src/main/java/com/madgag/agit/CloneLauncherActivityStoryTest.java
  5. +0 −2  agit-integration-tests/src/main/java/com/madgag/agit/DashboardActivityTest.java
  6. +41 −22 agit-integration-tests/src/main/java/com/madgag/agit/GitAsyncTaskTest.java
  7. +16 −37 agit-integration-tests/src/main/java/com/madgag/agit/RDTypeListActivityStoryTest.java
  8. +8 −8 agit-integration-tests/src/main/java/com/madgag/agit/RepoNotificationsTest.java
  9. +2 −4 agit-integration-tests/src/main/java/com/madgag/agit/YesToEveryPromptService.java
  10. +0 −20 agit-integration-tests/src/main/java/com/madgag/agit/sync/PeriodicSyncTest.java
  11. +3 −5 agit-integration-tests/src/main/java/roboguice/test/RoboServiceTestCase.java
  12. +5 −29 agit-test-utils/src/main/java/com/madgag/agit/GitTestUtils.java
  13. +10 −0 agit-test-utils/src/main/java/com/madgag/agit/TestEnvironment.java
  14. +47 −0 agit-test-utils/src/main/java/com/madgag/agit/matchers/GitTestHelper.java
  15. +1 −4 agit-test-utils/src/main/java/com/madgag/agit/matchers/VisibilityMatcher.java
  16. +1 −1  agit/res/values/strings.xml
  17. +1 −1  agit/src/main/java/com/commonsware/cwac/sacklist/SackOfViewsAdapter.java
  18. +0 −1  agit/src/main/java/com/madgag/ZeroByteInflationCheck.java
  19. +0 −2  agit/src/main/java/com/madgag/agit/AboutUsingSshActivity.java
  20. +5 −7 agit/src/main/java/com/madgag/agit/AgitApplication.java
  21. +28 −34 agit/src/main/java/com/madgag/agit/AgitModule.java
  22. +0 −2  agit/src/main/java/com/madgag/agit/AgitProductionModule.java
  23. +0 −4 agit/src/main/java/com/madgag/agit/CloneLauncherActivity.java
  24. +9 −10 agit/src/main/java/com/madgag/agit/CommitNavigationView.java
  25. +17 −22 agit/src/main/java/com/madgag/agit/CommitView.java
  26. +1 −3 agit/src/main/java/com/madgag/agit/CommitViewHolder.java
  27. +22 −24 agit/src/main/java/com/madgag/agit/CommitViewerActivity.java
  28. +0 −1  agit/src/main/java/com/madgag/agit/DashboardActivity.java
  29. +3 −5 agit/src/main/java/com/madgag/agit/GitFetchService.java
  30. +1 −5 agit/src/main/java/com/madgag/agit/GitInfoProvider.java
  31. +2 −3 agit/src/main/java/com/madgag/agit/GitIntentBuilder.java
  32. +5 −6 agit/src/main/java/com/madgag/agit/GitIntents.java
  33. +1 −1  agit/src/main/java/com/madgag/agit/GitOperationsService.java
  34. +0 −2  agit/src/main/java/com/madgag/agit/MarkdownActivityBase.java
  35. +6 −8 agit/src/main/java/com/madgag/agit/RDTypeListActivity.java
  36. +4 −5 agit/src/main/java/com/madgag/agit/RemoteViewer.java
  37. +1 −3 agit/src/main/java/com/madgag/agit/RepoScopedActivityBase.java
  38. +4 −7 agit/src/main/java/com/madgag/agit/RepositoryContext.java
  39. +4 −5 agit/src/main/java/com/madgag/agit/RepositoryProvider.java
  40. +5 −4 agit/src/main/java/com/madgag/agit/RepositoryViewerActivity.java
  41. +8 −16 agit/src/main/java/com/madgag/agit/RevCommitListView.java
  42. +2 −2 agit/src/main/java/com/madgag/agit/TagViewer.java
  43. +0 −2  agit/src/main/java/com/madgag/agit/ViewHoldingIterableAdapter.java
  44. +0 −3  agit/src/main/java/com/madgag/agit/diff/CommitDiffer.java
  45. +3 −2 agit/src/main/java/com/madgag/agit/diff/DeltaSpan.java
  46. +7 −7 agit/src/main/java/com/madgag/agit/diff/DiffText.java
  47. +3 −4 agit/src/main/java/com/madgag/agit/diff/FileDiff.java
  48. +0 −1  agit/src/main/java/com/madgag/agit/diff/FileHeaderViewHolder.java
  49. +4 −5 agit/src/main/java/com/madgag/agit/diff/FilePathDiffer.java
  50. +13 −22 agit/src/main/java/com/madgag/agit/diff/LineContextDiffer.java
  51. +1 −5 agit/src/main/java/com/madgag/agit/git/GitObjectFunction.java
  52. +2 −9 agit/src/main/java/com/madgag/agit/git/GitObjects.java
  53. +11 −12 agit/src/main/java/com/madgag/agit/git/Repos.java
  54. +4 −6 agit/src/main/java/com/madgag/agit/git/TransportFactory.java
  55. +0 −1  agit/src/main/java/com/madgag/agit/git/TransportProtocols.java
  56. +4 −4 agit/src/main/java/com/madgag/agit/git/model/RDTRemote.java
  57. +1 −1  agit/src/main/java/com/madgag/agit/git/model/RDTTag.java
  58. +4 −4 agit/src/main/java/com/madgag/agit/git/model/Relation.java
  59. +4 −13 agit/src/main/java/com/madgag/agit/git/model/RepoDomainType.java
  60. +0 −1  agit/src/main/java/com/madgag/agit/guice/OperationScope.java
  61. +7 −9 agit/src/main/java/com/madgag/agit/guice/RepositoryScope.java
  62. +4 −4 agit/src/main/java/com/madgag/agit/guice/RepositoryScoped.java
  63. +0 −2  agit/src/main/java/com/madgag/agit/guice/ScopeBase.java
  64. +1 −1  agit/src/main/java/com/madgag/agit/operation/lifecycle/CasualShortTermLifetime.java
  65. +3 −3 agit/src/main/java/com/madgag/agit/operation/lifecycle/LongRunningServiceLifetime.java
  66. +1 −1  agit/src/main/java/com/madgag/agit/operation/lifecycle/OperationLifecycleSupport.java
  67. +6 −7 agit/src/main/java/com/madgag/agit/operation/lifecycle/RepoNotifications.java
  68. +1 −1  agit/src/main/java/com/madgag/agit/operation/lifecycle/StatusBarProgressView.java
  69. +4 −5 agit/src/main/java/com/madgag/agit/operations/Clone.java
  70. +7 −9 agit/src/main/java/com/madgag/agit/operations/Fetch.java
  71. +10 −11 agit/src/main/java/com/madgag/agit/operations/GitAsyncTask.java
  72. +0 −2  agit/src/main/java/com/madgag/agit/operations/GitAsyncTaskFactory.java
  73. +3 −5 agit/src/main/java/com/madgag/agit/operations/GitOperation.java
  74. +1 −2  agit/src/main/java/com/madgag/agit/operations/MessagingProgressMonitor.java
  75. +5 −11 agit/src/main/java/com/madgag/agit/operations/Pull.java
  76. +0 −3  agit/src/main/java/com/madgag/agit/operations/RepoDeleter.java
  77. +0 −2  agit/src/main/java/com/madgag/agit/operations/RepoOpRegistry.java
  78. +7 −9 agit/src/main/java/com/madgag/agit/ssh/AndroidAuthAgentProvider.java
  79. +0 −2  agit/src/main/java/com/madgag/agit/ssh/AndroidSshSessionFactory.java
  80. +5 −10 agit/src/main/java/com/madgag/agit/ssh/jsch/GUIUserInfo.java
  81. +0 −2  agit/src/main/java/com/madgag/agit/sync/AccountAuthenticatorService.java
  82. +0 −11 agit/src/main/java/com/madgag/agit/sync/SyncCampaign.java
  83. +0 −2  agit/src/main/java/com/madgag/agit/util/Time.java
  84. +1 −1  agit/src/main/java/com/madgag/agit/views/BranchesSummaryView.java
  85. +2 −5 agit/src/main/java/com/madgag/agit/views/LatestCommitView.java
  86. +1 −4 agit/src/main/java/com/madgag/agit/views/ObjectIdView.java
  87. +1 −1  agit/src/main/java/com/madgag/agit/views/ObjectSummaryView.java
  88. +1 −1  agit/src/main/java/com/madgag/agit/views/PrettyCommitSummaryView.java
  89. +1 −4 agit/src/main/java/com/madgag/agit/views/TagSummaryView.java
  90. +0 −9 agit/src/main/java/com/madgag/agit/views/ViewUtil.java
  91. +0 −2  agit/src/main/java/com/madgag/agit/weblaunchers/GitHubWebLaunchActivity.java
  92. +0 −2  agit/src/main/java/com/madgag/agit/weblaunchers/GitoriousWebLaunchActivity.java
  93. +0 −2  agit/src/main/java/com/madgag/agit/weblaunchers/WebLaunchActivity.java
  94. +0 −4 agit/src/main/java/com/madgag/android/ClickableText.java
  95. +0 −1  agit/src/main/java/com/madgag/ssh/authagent/client/jsch/SSHAgentIdentity.java
  96. +3 −10 agit/src/main/java/com/markupartist/android/widget/ActionBar.java
  97. +4 −10 agit/src/main/java/com/markupartist/android/widget/PullToRefreshListView.java
  98. +0 −2  agit/src/test/java/com/madgag/agit/ClickableTextTest.java
  99. +2 −1  agit/src/test/java/com/madgag/agit/CloneLauncherActivityRobolectricTest.java
  100. +2 −8 agit/src/test/java/com/madgag/agit/CommitViewerRobolectricTest.java
  101. +0 −6 agit/src/test/java/com/madgag/agit/DashboardActivityRobolectricTest.java
  102. +4 −5 agit/src/test/java/com/madgag/agit/GuiceTest.java
  103. +22 −0 agit/src/test/java/com/madgag/agit/OracleJVMTestEnvironment.java
  104. +6 −6 agit/src/test/java/com/madgag/agit/RDTTagTest.java
  105. +2 −11 agit/src/test/java/com/madgag/agit/TagViewerRobolectricTest.java
  106. +2 −2 agit/src/test/java/com/madgag/agit/views/TreeSummaryViewTest.java
View
2  agit-integration-tests/src/main/java/com/madgag/agit/AboutActivityStoryTest.java
@@ -21,8 +21,6 @@
import com.github.calculon.CalculonStoryTest;
-import java.io.File;
-
public class AboutActivityStoryTest extends CalculonStoryTest<AboutActivity> {
public AboutActivityStoryTest() {
View
9 agit-integration-tests/src/main/java/com/madgag/agit/AgitTestApplication.java
@@ -19,16 +19,15 @@
package com.madgag.agit;
-import static java.util.Arrays.asList;
-
-import java.util.List;
-
import android.app.Instrumentation;
import android.content.Context;
import android.util.Log;
-
import com.google.inject.Module;
+import java.util.List;
+
+import static java.util.Arrays.asList;
+
public class AgitTestApplication extends AgitApplication {
private static final String TAG = "AgitTestApplication";
View
42 agit-integration-tests/src/main/java/com/madgag/agit/AndroidTestEnvironment.java
@@ -0,0 +1,42 @@
+package com.madgag.agit;
+
+
+import android.app.Instrumentation;
+import android.content.Context;
+import android.os.Environment;
+import android.util.Log;
+import com.madgag.agit.matchers.GitTestHelper;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Arrays;
+
+import static java.util.Arrays.asList;
+
+public class AndroidTestEnvironment implements TestEnvironment {
+
+ private final Instrumentation instrumentation;
+
+ public AndroidTestEnvironment(Instrumentation instrumentation) {
+ this.instrumentation = instrumentation;
+ }
+
+ public InputStream streamFor(String fileName) {
+ try {
+ Context context = instrumentation.getContext();
+ Log.i("ATE", asList(context.getAssets().list("")).toString());
+ return context.getAssets().open(fileName);
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ public File tempFolder() {
+ return new File(Environment.getExternalStorageDirectory(), "agit-integration-tests-tmp");
+ }
+
+ public static GitTestHelper helper(Instrumentation instrumentation) {
+ return new GitTestHelper(new AndroidTestEnvironment(instrumentation));
+ }
+}
View
9 agit-integration-tests/src/main/java/com/madgag/agit/CloneLauncherActivityStoryTest.java
@@ -18,14 +18,11 @@
*/
package com.madgag.agit;
-import static com.madgag.agit.GitTestUtils.*;
-import java.io.File;
-import java.io.IOException;
-
-import android.os.Environment;
import com.github.calculon.CalculonStoryTest;
+import java.io.File;
+
public class CloneLauncherActivityStoryTest extends CalculonStoryTest<CloneLauncherActivity> {
private String existingFolder = File.listRoots()[0].getAbsolutePath();
@@ -52,7 +49,7 @@ public void testDoesNotCrashDueToStackOverflow() {
// public void testCheckoutToCustomLocationWorks() {
-// File customLocation = newFolder();
+// File customLocation = tempFolder();
// setUp(R.id.CloneUrlEditText).setText("git://github.com/agittest/small-project.git").now();
// setUp(R.id.UseDefaultGitDirLocation).setChecked(false).now();
// setUp(R.id.GitDirEditText).setText(customLocation.getAbsolutePath()).now();
View
2  agit-integration-tests/src/main/java/com/madgag/agit/DashboardActivityTest.java
@@ -23,8 +23,6 @@
import java.io.File;
-import static com.madgag.agit.GitTestUtils.newFolder;
-
public class DashboardActivityTest extends CalculonStoryTest<DashboardActivity> {
private String existingFolder = File.listRoots()[0].getAbsolutePath();
View
63 agit-integration-tests/src/main/java/com/madgag/agit/GitAsyncTaskTest.java
@@ -21,12 +21,14 @@
import android.test.suitebuilder.annotation.MediumTest;
import android.util.Log;
-import com.madgag.agit.git.Repos;
+import com.madgag.agit.matchers.GitTestHelper;
import com.madgag.agit.operation.lifecycle.OperationLifecycleSupport;
import com.madgag.agit.operations.*;
import org.eclipse.jgit.api.Git;
import org.eclipse.jgit.lib.Repository;
+import org.eclipse.jgit.lib.StoredConfig;
import org.eclipse.jgit.storage.file.FileRepository;
+import org.eclipse.jgit.transport.RefSpec;
import org.eclipse.jgit.transport.RemoteConfig;
import org.eclipse.jgit.transport.URIish;
import roboguice.test.RoboUnitTestCase;
@@ -37,7 +39,6 @@
import java.util.concurrent.CountDownLatch;
import static com.madgag.agit.GitTestUtils.*;
-import static com.madgag.agit.git.Repos.addRemoteTo;
import static com.madgag.agit.git.Repos.remoteConfigFor;
import static com.madgag.agit.matchers.HasGitObjectMatcher.hasGitObject;
import static com.madgag.hamcrest.FileExistenceMatcher.exists;
@@ -46,16 +47,23 @@
import static java.lang.Thread.currentThread;
import static java.util.concurrent.TimeUnit.SECONDS;
import static org.eclipse.jgit.lib.Constants.DEFAULT_REMOTE_NAME;
+import static org.eclipse.jgit.lib.Constants.R_HEADS;
+import static org.eclipse.jgit.lib.Constants.R_REMOTES;
import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.Matchers.*;
+import static org.hamcrest.Matchers.is;
+import static org.hamcrest.Matchers.not;
public class GitAsyncTaskTest extends RoboUnitTestCase<AgitTestApplication> {
private static final String TAG = "GitAsyncTaskTest";
+ private GitTestHelper helper() {
+ return AndroidTestEnvironment.helper(getInstrumentation());
+ }
+
@MediumTest
public void testCloneRepoWithEmptyBlobInPack() throws Exception {
- Clone cloneOp = new Clone(true, integrationGitServerURIFor("tiny-repo.with-empty-file.git"), newFolder());
+ Clone cloneOp = new Clone(true, integrationGitServerURIFor("tiny-repo.with-empty-file.git"), helper().newFolder());
Repository repo = executeAndWaitFor(cloneOp);
assertThat(repo, hasGitObject("e69de29bb2d1d6434b8b29ae775ad8c2e48c5391")); // empty blob
@@ -64,7 +72,7 @@ public void testCloneRepoWithEmptyBlobInPack() throws Exception {
@MediumTest
public void testCloneNonBareRepoFromLocalTestServer() throws Exception {
- Clone cloneOp = new Clone(false, integrationGitServerURIFor("small-repo.early.git"), newFolder());
+ Clone cloneOp = new Clone(false, integrationGitServerURIFor("small-repo.early.git"), helper().newFolder());
Repository repo = executeAndWaitFor(cloneOp);
@@ -77,42 +85,51 @@ public void testCloneNonBareRepoFromLocalTestServer() throws Exception {
@MediumTest
public void testPullUpdatesFromLocalTestServer() throws Exception {
- URIish oldUri = integrationGitServerURIFor("small-repo.early.git");
- Git git=Git.cloneRepository().setDirectory(newFolder()).setURI(oldUri.toPrivateString()).call();
-
- Repository repository = git.getRepository();
+ Repository repository = helper().unpackRepo("small-test-repo.early.zip");
RemoteConfig remoteConfig = remoteConfigFor(repository, DEFAULT_REMOTE_NAME);
- remoteConfig.removeURI(oldUri);
- remoteConfig.addURI(integrationGitServerURIFor("small-repo.later.git"));
-
+ for (URIish urIish : remoteConfig.getURIs()) {
+ remoteConfig.removeURI(urIish);
+ }
+ remoteConfig.addURI(integrationGitServerURIFor("small-test-repo.later.git"));
+ remoteConfig.update(repository.getConfig());
+ repository.getConfig().save();
+ // Git.wrap(repository).branchCreate().setName("master").setStartPoint("origin/master");
+
+ assertThat(repository, hasGitObject("3974996807a9f596cf25ac3a714995c24bb97e2c"));
+ String commit1 = "ce1e0703402e989bedf03d5df535401340f54b42";
+ assertThat(repository, not(hasGitObject(commit1)));
+ assertFileLength(2, repository.getWorkTree(), "EXAMPLE");
Pull pullOp = new Pull(repository);
- Repository repo = executeAndWaitFor(pullOp);
+ executeAndWaitFor(pullOp);
+ assertThat(repository, hasGitObject(commit1));
- assertThat(repo, hasGitObject("ba1f63e4430bff267d112b1e8afc1d6294db0ccc"));
+ assertFileLength(4, repository.getWorkTree(), "EXAMPLE");
+ }
- File readmeFile= new File(repo.getWorkTree(), "README");
- assertThat(readmeFile, exists());
- assertThat(readmeFile, ofLength(12));
+ private void assertFileLength(int length, File workTree, String exampleFile) {
+ File readmeFile= new File(workTree, exampleFile);
+ assertThat(readmeFile, exists());
+ assertThat("len="+readmeFile.length(), readmeFile, ofLength(length));
}
@MediumTest
public void testCloneRepoUsingRSA() throws Exception {
- Clone cloneOp = new Clone(true, integrationGitServerURIFor("small-repo.early.git").setUser(RSA_USER), newFolder());
+ Clone cloneOp = new Clone(true, integrationGitServerURIFor("small-repo.early.git").setUser(RSA_USER), helper().newFolder());
assertThat(executeAndWaitFor(cloneOp), hasGitObject("ba1f63e4430bff267d112b1e8afc1d6294db0ccc"));
}
@MediumTest
public void testCloneRepoUsingDSA() throws Exception {
- Clone cloneOp = new Clone(true, integrationGitServerURIFor("small-repo.early.git").setUser(DSA_USER), newFolder());
+ Clone cloneOp = new Clone(true, integrationGitServerURIFor("small-repo.early.git").setUser(DSA_USER), helper().newFolder());
assertThat(executeAndWaitFor(cloneOp), hasGitObject("ba1f63e4430bff267d112b1e8afc1d6294db0ccc"));
}
@MediumTest
public void testSimpleReadOnlyCloneFromGitHub() throws Exception {
- Clone cloneOp = new Clone(false, new URIish("git://github.com/agittest/small-project.git"), newFolder());
+ Clone cloneOp = new Clone(false, new URIish("git://github.com/agittest/small-project.git"), helper().newFolder());
Repository repo = executeAndWaitFor(cloneOp);
assertThat(repo, hasGitObject("9e0b5e42b3e1c59bc83b55142a8c50dfae36b144"));
@@ -125,7 +142,7 @@ public void testSimpleReadOnlyCloneFromGitHub() throws Exception {
// @LargeTest
// public void testCanCloneAllSuggestedRepos() throws Exception {
// for (SuggestedRepo suggestedRepo : SUGGESTIONS) {
-// Repository repo = executeAndWaitFor(new Clone(true, new URIish(suggestedRepo.getURI()), newFolder()));
+// Repository repo = executeAndWaitFor(new Clone(true, new URIish(suggestedRepo.getURI()), tempFolder()));
// Map<String,Ref> allRefs = repo.getAllRefs();
// assertThat("Refs for " + suggestedRepo + " @ " + repo, allRefs.size(), greaterThan(0));
// }
@@ -143,7 +160,9 @@ public void startedWith(OpNotification ongoingNotification) {
Log.i(TAG,"Started "+operation+" with "+ongoingNotification);
}
public void publish(Progress progress) {}
- public void error(OpNotification completionNotification) {}
+ public void error(OpNotification notification) {
+ Log.i(TAG,"Errored "+operation+" with "+notification);
+ }
public void success(OpNotification completionNotification) {}
public void completed(OpNotification completionNotification) {
Log.i(TAG,"Completed "+operation+" with "+completionNotification);
View
53 agit-integration-tests/src/main/java/com/madgag/agit/RDTypeListActivityStoryTest.java
@@ -19,33 +19,25 @@
package com.madgag.agit;
-import static com.madgag.agit.GitTestUtils.*;
-import static com.madgag.agit.RDTypeListActivity.listIntent;
-import static com.madgag.agit.matchers.CharSequenceMatcher.charSequence;
-import static com.madgag.compress.CompressUtil.unzip;
-import static org.hamcrest.CoreMatchers.is;
-import static org.hamcrest.CoreMatchers.startsWith;
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.Matchers.containsString;
-
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.List;
-
-import com.madgag.agit.git.model.RDTTag;
-import org.apache.commons.compress.archivers.ArchiveException;
-import org.eclipse.jgit.lib.Repository;
-import org.eclipse.jgit.storage.file.FileRepository;
-
-import android.content.res.AssetManager;
import android.test.ActivityInstrumentationTestCase2;
import android.util.Log;
import android.view.View;
import android.widget.ListView;
import android.widget.TextView;
-
+import com.madgag.agit.git.model.RDTTag;
import com.madgag.agit.git.model.RDTTag.TagSummary;
+import com.madgag.agit.matchers.GitTestHelper;
+import org.eclipse.jgit.lib.Repository;
+
+import java.util.List;
+
+import static com.madgag.agit.AndroidTestEnvironment.helper;
+import static com.madgag.agit.RDTypeListActivity.listIntent;
+import static com.madgag.agit.matchers.CharSequenceMatcher.charSequence;
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.CoreMatchers.startsWith;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.containsString;
public class RDTypeListActivityStoryTest extends ActivityInstrumentationTestCase2<RDTypeListActivity> {
@@ -56,7 +48,9 @@ public RDTypeListActivityStoryTest() {
}
public void testShouldShowAllTags() throws Exception {
- Repository repoWithTags = unpackRepo("small-repo.with-tags.zip");
+
+ GitTestHelper helper = AndroidTestEnvironment.helper(getInstrumentation());
+ Repository repoWithTags = helper.unpackRepo("small-repo.with-tags.zip");
setActivityIntent(listIntent(repoWithTags, "tag"));
@@ -103,20 +97,5 @@ public void run() {
getInstrumentation().waitForIdleSync();
return listView.getSelectedView();
}
-
- private Repository unpackRepo(String fileName) throws IOException, ArchiveException {
- AssetManager am = getInstrumentation().getContext().getAssets();
- File repoParentFolder = newFolder();
- InputStream rawZipFileInputStream = am.open(fileName);
- return unzipRepoFromStreamToFolder(rawZipFileInputStream, repoParentFolder);
- }
-
- private Repository unzipRepoFromStreamToFolder(
- InputStream rawZipFileInputStream, File destinationFolder)
- throws IOException, ArchiveException {
- unzip(rawZipFileInputStream, destinationFolder);
- rawZipFileInputStream.close();
- return new FileRepository(new File(destinationFolder,".git"));
- }
}
View
16 agit-integration-tests/src/main/java/com/madgag/agit/RepoNotificationsTest.java
@@ -19,24 +19,24 @@
package com.madgag.agit;
-import static com.madgag.agit.GitTestUtils.newFolder;
-import static org.eclipse.jgit.lib.Constants.DOT_GIT;
-
-import java.io.File;
-
import android.content.Context;
-import roboguice.test.RoboUnitTestCase;
import android.test.suitebuilder.annotation.SmallTest;
-
+import com.madgag.agit.matchers.GitTestHelper;
import com.madgag.agit.operation.lifecycle.RepoNotifications;
+import roboguice.test.RoboUnitTestCase;
+
+import java.io.File;
+
+import static org.eclipse.jgit.lib.Constants.DOT_GIT;
public class RepoNotificationsTest extends RoboUnitTestCase<AgitTestApplication> {
private static final String TAG="RNT";
+ private final GitTestHelper helper = AndroidTestEnvironment.helper(getInstrumentation());
@SmallTest
public void testShouldHaveDifferentOngoingNotificationIds() throws Exception {
- File gitdir1=new File(newFolder(), DOT_GIT),gitdir2=new File(newFolder(), DOT_GIT);
+ File gitdir1=new File(helper.newFolder(), DOT_GIT),gitdir2=new File(helper.newFolder(), DOT_GIT);
Context c = getInstrumentation().getContext();
RepoNotifications roc1a = new RepoNotifications(c, gitdir1, null);
View
6 agit-integration-tests/src/main/java/com/madgag/agit/YesToEveryPromptService.java
@@ -19,13 +19,11 @@
package com.madgag.agit;
+import android.util.Log;
+import com.google.inject.Module;
import com.madgag.agit.operations.OpPrompt;
import com.madgag.android.blockingprompt.BlockingPromptService;
import roboguice.config.AbstractAndroidModule;
-import android.util.Log;
-
-import com.google.inject.Module;
-import com.jcraft.jsch.UserInfo;
import static java.lang.Boolean.TRUE;
View
20 agit-integration-tests/src/main/java/com/madgag/agit/sync/PeriodicSyncTest.java
@@ -20,37 +20,17 @@
package com.madgag.agit.sync;
import android.os.Build;
-import android.test.suitebuilder.annotation.MediumTest;
import android.test.suitebuilder.annotation.SmallTest;
import android.util.Log;
import com.madgag.agit.AgitTestApplication;
-import com.madgag.agit.operation.lifecycle.OperationLifecycleSupport;
-import com.madgag.agit.operations.*;
-import com.madgag.agit.sync.AccountAuthenticatorService;
-import org.eclipse.jgit.lib.Repository;
-import org.eclipse.jgit.storage.file.FileRepository;
-import org.eclipse.jgit.transport.URIish;
import roboguice.test.RoboUnitTestCase;
-import roboguice.util.RoboLooperThread;
-import java.io.File;
-import java.io.IOException;
import java.lang.reflect.Method;
-import java.util.concurrent.CountDownLatch;
import static android.os.Build.VERSION_CODES.FROYO;
-import static com.madgag.agit.GitTestUtils.*;
-import static com.madgag.agit.matchers.CharSequenceMatcher.charSequence;
-import static com.madgag.agit.matchers.HasGitObjectMatcher.hasGitObject;
-import static com.madgag.hamcrest.FileExistenceMatcher.exists;
-import static com.madgag.hamcrest.FileLengthMatcher.ofLength;
-import static java.lang.Thread.currentThread;
-import static java.util.concurrent.TimeUnit.SECONDS;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.notNullValue;
-import static org.hamcrest.CoreMatchers.startsWith;
import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.Matchers.not;
import static org.hamcrest.Matchers.nullValue;
public class PeriodicSyncTest extends RoboUnitTestCase<AgitTestApplication> {
View
8 agit-integration-tests/src/main/java/roboguice/test/RoboServiceTestCase.java
@@ -1,13 +1,11 @@
package roboguice.test;
-import roboguice.application.RoboApplication;
-import roboguice.service.RoboService;
-import roboguice.inject.ContextScope;
-
import android.content.Context;
import android.test.ServiceTestCase;
-
import com.google.inject.Injector;
+import roboguice.application.RoboApplication;
+import roboguice.inject.ContextScope;
+import roboguice.service.RoboService;
import java.lang.reflect.Constructor;
import java.lang.reflect.ParameterizedType;
View
34 agit-test-utils/src/main/java/com/madgag/agit/GitTestUtils.java
@@ -20,23 +20,21 @@
package com.madgag.agit;
import android.os.Environment;
-import org.apache.commons.compress.archivers.ArchiveException;
-import org.apache.commons.io.FileUtils;
import org.eclipse.jgit.lib.Repository;
import org.eclipse.jgit.lib.RepositoryCache;
import org.eclipse.jgit.storage.file.FileRepository;
import org.eclipse.jgit.transport.URIish;
import org.eclipse.jgit.util.FS;
-import org.hamcrest.CoreMatchers;
-import java.io.*;
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileReader;
+import java.io.IOException;
import java.net.InetAddress;
import java.net.URISyntaxException;
import java.net.UnknownHostException;
import java.util.Properties;
-import static com.madgag.compress.CompressUtil.unzip;
-import static java.lang.System.currentTimeMillis;
import static org.hamcrest.CoreMatchers.notNullValue;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.core.Is.is;
@@ -60,14 +58,6 @@ public static String gitServerHostAddress() throws IOException,
return hostAddress;
}
- private static long unique_number = currentTimeMillis();
-
- public static File newFolder() {
- File path = new File(Environment.getExternalStorageDirectory(),
- "agit-test-repos");
- return new File(path, "" + (unique_number++));
- }
-
public static URIish integrationGitServerURIFor(String repoPath)
throws URISyntaxException, IOException, FileNotFoundException,
UnknownHostException {
@@ -79,21 +69,7 @@ public static URIish integrationGitServerURIFor(String repoPath)
.setPath(repoPath);
}
-
- public static Repository unpackRepo(String fileName) throws IOException, ArchiveException {
- return repoFor(unpackRepoAndGetGitDir(fileName));
- }
-
- public static File unpackRepoAndGetGitDir(String fileName) throws IOException, ArchiveException {
- File repoParentFolder = new File(FileUtils.getTempDirectory(),"unpacked-"+fileName+"-"+currentTimeMillis());
- InputStream rawZipFileInputStream = GitTestUtils.class.getResourceAsStream("/" + fileName);
- assertThat(rawZipFileInputStream, notNullValue());
- unzip(rawZipFileInputStream, repoParentFolder);
- rawZipFileInputStream.close();
- return repoParentFolder;
- }
-
- private static Repository repoFor(File folder) throws IOException {
+ public static Repository repoFor(File folder) throws IOException {
File resolvedGitDir = resolveGitDirFor(folder);
assertThat("gitdir "+resolvedGitDir+" exists",resolvedGitDir, notNullValue());
return new FileRepository(resolvedGitDir);
View
10 agit-test-utils/src/main/java/com/madgag/agit/TestEnvironment.java
@@ -0,0 +1,10 @@
+package com.madgag.agit;
+
+import java.io.File;
+import java.io.InputStream;
+
+public interface TestEnvironment {
+ InputStream streamFor(String s);
+
+ File tempFolder();
+}
View
47 agit-test-utils/src/main/java/com/madgag/agit/matchers/GitTestHelper.java
@@ -0,0 +1,47 @@
+package com.madgag.agit.matchers;
+
+
+import com.madgag.agit.TestEnvironment;
+import org.apache.commons.compress.archivers.ArchiveException;
+import org.eclipse.jgit.lib.Repository;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+
+import static com.madgag.agit.GitTestUtils.repoFor;
+import static com.madgag.compress.CompressUtil.unzip;
+import static java.lang.System.currentTimeMillis;
+import static org.hamcrest.CoreMatchers.notNullValue;
+import static org.hamcrest.MatcherAssert.assertThat;
+
+public class GitTestHelper {
+ private final TestEnvironment environment;
+ private static long uniqueIndex = currentTimeMillis();
+
+ public GitTestHelper(TestEnvironment environment) {
+ this.environment = environment;
+ }
+
+ public Repository unpackRepo(String fileName) throws IOException, ArchiveException {
+ return repoFor(unpackRepoAndGetGitDir(fileName));
+ }
+
+ public File unpackRepoAndGetGitDir(String fileName) throws IOException, ArchiveException {
+ InputStream rawZipFileInputStream = environment.streamFor(fileName);
+ assertThat(rawZipFileInputStream, notNullValue());
+
+ File repoParentFolder = newFolder("unpacked-"+fileName);
+ unzip(rawZipFileInputStream, repoParentFolder);
+ rawZipFileInputStream.close();
+ return repoParentFolder;
+ }
+
+ public File newFolder() {
+ return newFolder("tmp");
+ }
+
+ public File newFolder(String prefix) {
+ return new File(environment.tempFolder(),prefix+"-"+(++uniqueIndex));
+ }
+}
View
5 agit-test-utils/src/main/java/com/madgag/agit/matchers/VisibilityMatcher.java
@@ -1,14 +1,11 @@
package com.madgag.agit.matchers;
import android.view.View;
-import android.widget.Checkable;
import org.hamcrest.Description;
import org.hamcrest.Matcher;
import org.hamcrest.TypeSafeMatcher;
-import static android.view.View.GONE;
-import static android.view.View.INVISIBLE;
-import static android.view.View.VISIBLE;
+import static android.view.View.*;
public class VisibilityMatcher extends TypeSafeMatcher<View> {
View
2  agit/res/values/strings.xml
@@ -47,7 +47,7 @@
<string name="pull_cancelled">"Pull cancelled"</string>
<string name="ref_not_resolved">"Ref {0} can not be resolved"</string>
- <string name="missing_configuration_for_key">"No value for key %1$s found in configuration"</string>
+ <string name="missing_configuration_for_key">"No value for section '%1$s', subsection '%2$s', name '%3$s' found in configuration"</string>
<string name="can_not_pull_on_a_repo_with_state">"Cannot pull into a repository with state: %1$s"</string>
<string name="can_not_pull_on_a_repo_with_detached_head">"Cannot pull into a repository with a detached HEAD - first checkout a branch"</string>
</resources>
View
2  agit/src/main/java/com/commonsware/cwac/sacklist/SackOfViewsAdapter.java
@@ -18,7 +18,7 @@
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
-import android.widget.ListAdapter;
+
import java.util.ArrayList;
import java.util.List;
View
1  agit/src/main/java/com/madgag/ZeroByteInflationCheck.java
@@ -2,7 +2,6 @@
import java.io.ByteArrayOutputStream;
import java.io.IOException;
-import java.util.zip.DataFormatException;
import java.util.zip.DeflaterOutputStream;
import java.util.zip.Inflater;
View
2  agit/src/main/java/com/madgag/agit/AboutUsingSshActivity.java
@@ -21,8 +21,6 @@
import com.markupartist.android.widget.ActionBar;
-import static com.madgag.agit.R.string.about_activity_title;
-
public class AboutUsingSshActivity extends MarkdownActivityBase {
@Override
View
12 agit/src/main/java/com/madgag/agit/AgitApplication.java
@@ -19,17 +19,15 @@
package com.madgag.agit;
-import static java.util.Arrays.asList;
-
-import java.util.List;
-
-import roboguice.application.RoboApplication;
import android.app.Instrumentation;
import android.content.Context;
import android.util.Log;
-
import com.google.inject.Module;
-import com.madgag.agit.ssh.jsch.GUIUserInfo;
+import roboguice.application.RoboApplication;
+
+import java.util.List;
+
+import static java.util.Arrays.asList;
public class AgitApplication extends RoboApplication {
View
62 agit/src/main/java/com/madgag/agit/AgitModule.java
@@ -19,64 +19,58 @@
package com.madgag.agit;
-import static android.os.Looper.getMainLooper;
-import static com.google.inject.assistedinject.FactoryProvider.newFactory;
-import static com.google.inject.name.Names.named;
-import static com.madgag.agit.RepositoryViewerActivity.manageRepoPendingIntent;
-import static java.lang.Thread.currentThread;
-
-import java.io.File;
-import java.io.IOException;
-
import android.app.PendingIntent;
import android.content.Context;
+import android.content.res.Resources;
+import android.graphics.Bitmap;
+import android.os.Environment;
import android.os.Handler;
import android.os.Looper;
+import android.util.Log;
+import com.google.inject.Inject;
+import com.google.inject.Provider;
import com.google.inject.Provides;
import com.google.inject.Singleton;
+import com.google.inject.name.Named;
import com.jcraft.jsch.HostKeyRepository;
import com.jcraft.jsch.UserInfo;
+import com.madgag.agit.git.TransportFactory;
import com.madgag.agit.git.model.RDTBranch;
import com.madgag.agit.git.model.RDTRemote;
import com.madgag.agit.git.model.RDTTag;
import com.madgag.agit.git.model.RepoDomainType;
-import com.madgag.agit.prompts.StatusBarPromptUI;
-import com.madgag.agit.ssh.jsch.GUIUserInfo;
-import com.madgag.agit.sync.SyncCampaign;
-import com.madgag.agit.sync.SyncCampaignFactory;
-import com.madgag.android.blockingprompt.*;
-import com.madgag.agit.git.TransportFactory;
import com.madgag.agit.guice.OperationScope;
import com.madgag.agit.guice.RepositoryScope;
import com.madgag.agit.guice.RepositoryScoped;
+import com.madgag.agit.operations.GitAsyncTask;
import com.madgag.agit.operations.GitAsyncTaskFactory;
+import com.madgag.agit.prompts.StatusBarPromptUI;
+import com.madgag.agit.ssh.AndroidAuthAgentProvider;
+import com.madgag.agit.ssh.AndroidSshSessionFactory;
import com.madgag.agit.ssh.CuriousHostKeyRepository;
+import com.madgag.agit.ssh.jsch.GUIUserInfo;
+import com.madgag.agit.sync.SyncCampaign;
+import com.madgag.agit.sync.SyncCampaignFactory;
+import com.madgag.android.blockingprompt.PromptUI;
+import com.madgag.android.blockingprompt.PromptUIRegistry;
+import com.madgag.android.lazydrawables.*;
+import com.madgag.android.lazydrawables.gravatar.GravatarBitmapDownloader;
+import com.madgag.ssh.android.authagent.AndroidAuthAgent;
import org.eclipse.jgit.lib.Ref;
import org.eclipse.jgit.lib.Repository;
import org.eclipse.jgit.transport.SshSessionFactory;
-
import roboguice.config.AbstractAndroidModule;
import roboguice.inject.ContextScoped;
import roboguice.inject.InjectExtra;
-import android.content.res.Resources;
-import android.graphics.Bitmap;
-import android.os.Environment;
-import android.util.Log;
-import com.google.inject.Inject;
-import com.google.inject.Provider;
-import com.google.inject.name.Named;
-import com.madgag.agit.operations.GitAsyncTask;
-import com.madgag.agit.ssh.AndroidAuthAgentProvider;
-import com.madgag.agit.ssh.AndroidSshSessionFactory;
-import com.madgag.android.lazydrawables.BitmapFileStore;
-import com.madgag.android.lazydrawables.ImageProcessor;
-import com.madgag.android.lazydrawables.ImageResourceDownloader;
-import com.madgag.android.lazydrawables.ImageResourceStore;
-import com.madgag.android.lazydrawables.ImageSession;
-import com.madgag.android.lazydrawables.ScaledBitmapDrawableGenerator;
-import com.madgag.android.lazydrawables.gravatar.GravatarBitmapDownloader;
-import com.madgag.ssh.android.authagent.AndroidAuthAgent;
+import java.io.File;
+import java.io.IOException;
+
+import static android.os.Looper.getMainLooper;
+import static com.google.inject.assistedinject.FactoryProvider.newFactory;
+import static com.google.inject.name.Names.named;
+import static com.madgag.agit.RepositoryViewerActivity.manageRepoPendingIntent;
+import static java.lang.Thread.currentThread;
public class AgitModule extends AbstractAndroidModule {
View
2  agit/src/main/java/com/madgag/agit/AgitProductionModule.java
@@ -22,9 +22,7 @@
import android.content.ComponentName;
import com.google.inject.Provides;
import com.google.inject.name.Named;
-import com.madgag.agit.guice.OperationScope;
import com.madgag.agit.guice.OperationScoped;
-import com.madgag.agit.ssh.jsch.GUIUserInfo;
import com.madgag.android.blockingprompt.BlockingPromptService;
import com.madgag.android.blockingprompt.PromptBroker;
import roboguice.config.AbstractAndroidModule;
View
4 agit/src/main/java/com/madgag/agit/CloneLauncherActivity.java
@@ -34,7 +34,6 @@
import com.madgag.android.ClickableText;
import com.markupartist.android.widget.ActionBar;
import org.eclipse.jgit.lib.RepositoryCache;
-import org.eclipse.jgit.transport.TransportProtocol;
import org.eclipse.jgit.transport.URIish;
import org.eclipse.jgit.util.FS;
import roboguice.activity.RoboActivity;
@@ -49,15 +48,12 @@
import static android.view.View.VISIBLE;
import static android.widget.Toast.LENGTH_LONG;
import static android.widget.Toast.LENGTH_SHORT;
-import static com.google.common.collect.Iterables.find;
-import static com.madgag.agit.GitIntents.EXTRA_SOURCE_URI;
import static com.madgag.agit.GitIntents.EXTRA_TARGET_DIR;
import static com.madgag.agit.GitIntents.sourceUriFrom;
import static com.madgag.agit.GitOperationsService.cloneOperationIntentFor;
import static com.madgag.agit.R.string.*;
import static com.madgag.agit.RepositoryViewerActivity.manageRepoIntent;
import static com.madgag.agit.git.TransportProtocols.niceProtocolNameFor;
-import static com.madgag.agit.git.TransportProtocols.protocolFor;
import static org.eclipse.jgit.lib.Constants.DOT_GIT_EXT;
public class CloneLauncherActivity extends RoboActivity {
View
19 agit/src/main/java/com/madgag/agit/CommitNavigationView.java
@@ -19,16 +19,6 @@
package com.madgag.agit;
-import static com.google.common.collect.Maps.newEnumMap;
-import static com.madgag.agit.git.model.Relation.CHILD;
-import static com.madgag.agit.git.model.Relation.PARENT;
-
-import java.util.Map;
-
-import com.madgag.agit.git.model.Relation;
-import org.eclipse.jgit.revplot.PlotCommit;
-import org.eclipse.jgit.revplot.PlotLane;
-
import android.content.Context;
import android.util.AttributeSet;
import android.view.LayoutInflater;
@@ -36,6 +26,15 @@
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.LinearLayout;
+import com.madgag.agit.git.model.Relation;
+import org.eclipse.jgit.revplot.PlotCommit;
+import org.eclipse.jgit.revplot.PlotLane;
+
+import java.util.Map;
+
+import static com.google.common.collect.Maps.newEnumMap;
+import static com.madgag.agit.git.model.Relation.CHILD;
+import static com.madgag.agit.git.model.Relation.PARENT;
public class CommitNavigationView extends LinearLayout {
View
39 agit/src/main/java/com/madgag/agit/CommitView.java
@@ -19,21 +19,25 @@
package com.madgag.agit;
-import static android.view.ViewGroup.LayoutParams.MATCH_PARENT;
-import static android.view.ViewGroup.LayoutParams.WRAP_CONTENT;
-import static com.google.common.collect.Maps.newHashMapWithExpectedSize;
-import static android.text.Spanned.SPAN_EXCLUSIVE_EXCLUSIVE;
-import java.io.IOException;
-import java.util.Map;
-
import android.app.Activity;
+import android.content.Context;
import android.text.SpannableStringBuilder;
import android.text.style.CharacterStyle;
import android.text.style.TypefaceSpan;
+import android.util.AttributeSet;
+import android.util.Log;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.*;
+import android.widget.TabHost.TabContentFactory;
+import android.widget.TabHost.TabSpec;
+import com.madgag.agit.CommitNavigationView.CommitSelectedListener;
import com.madgag.agit.diff.CommitChangeListAdapter;
import com.madgag.agit.diff.DiffSliderView;
import com.madgag.agit.views.ObjectIdView;
import com.madgag.agit.views.PersonIdentView;
+import com.markupartist.android.widget.ActionBar;
import org.eclipse.jgit.errors.IncorrectObjectTypeException;
import org.eclipse.jgit.errors.MissingObjectException;
import org.eclipse.jgit.lib.PersonIdent;
@@ -43,22 +47,13 @@
import org.eclipse.jgit.revplot.PlotWalk;
import org.eclipse.jgit.revwalk.RevCommit;
-import android.content.Context;
-import android.util.AttributeSet;
-import android.util.Log;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.ViewGroup;
-import android.widget.ExpandableListView;
-import android.widget.LinearLayout;
-import android.widget.TabHost;
-import android.widget.TabHost.TabContentFactory;
-import android.widget.TabHost.TabSpec;
-import android.widget.TabWidget;
-import android.widget.TextView;
+import java.io.IOException;
+import java.util.Map;
-import com.madgag.agit.CommitNavigationView.CommitSelectedListener;
-import com.markupartist.android.widget.ActionBar;
+import static android.text.Spanned.SPAN_EXCLUSIVE_EXCLUSIVE;
+import static android.view.ViewGroup.LayoutParams.MATCH_PARENT;
+import static android.view.ViewGroup.LayoutParams.WRAP_CONTENT;
+import static com.google.common.collect.Maps.newHashMapWithExpectedSize;
public class CommitView extends LinearLayout {
View
4 agit/src/main/java/com/madgag/agit/CommitViewHolder.java
@@ -11,9 +11,7 @@
import com.madgag.android.listviews.ViewHolder;
import org.eclipse.jgit.revwalk.RevCommit;
-import static com.madgag.agit.R.id.iv_commit_list_item_gravatar;
-import static com.madgag.agit.R.id.tv_commit_list_item_commit_date;
-import static com.madgag.agit.R.id.tv_commit_list_item_shortdesc;
+import static com.madgag.agit.R.id.*;
import static com.madgag.agit.views.TextUtil.ITALIC_CLIPPING_BUFFER;
import static com.madgag.android.lazydrawables.gravatar.Gravatars.gravatarIdFor;
View
46 agit/src/main/java/com/madgag/agit/CommitViewerActivity.java
@@ -19,29 +19,6 @@
package com.madgag.agit;
-import static android.view.View.GONE;
-import static android.view.View.VISIBLE;
-import static android.view.animation.AnimationUtils.loadAnimation;
-import static com.google.common.collect.Maps.newEnumMap;
-import static com.madgag.agit.R.anim.*;
-import static com.madgag.agit.git.model.Relation.CHILD;
-import static com.madgag.agit.git.model.Relation.PARENT;
-import static java.lang.System.currentTimeMillis;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.Map;
-
-import com.madgag.agit.git.model.Relation;
-import org.eclipse.jgit.api.Git;
-import org.eclipse.jgit.lib.ObjectId;
-import org.eclipse.jgit.lib.Ref;
-import org.eclipse.jgit.revplot.PlotCommit;
-import org.eclipse.jgit.revplot.PlotCommitList;
-import org.eclipse.jgit.revplot.PlotLane;
-import org.eclipse.jgit.revplot.PlotWalk;
-import org.eclipse.jgit.revwalk.RevCommit;
-
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.DialogInterface;
@@ -54,10 +31,31 @@
import android.view.View;
import android.view.animation.Animation;
import android.widget.TextView;
-
import com.google.common.base.Function;
import com.google.inject.Inject;
import com.madgag.agit.CommitNavigationView.CommitSelectedListener;
+import com.madgag.agit.git.model.Relation;
+import org.eclipse.jgit.api.Git;
+import org.eclipse.jgit.lib.ObjectId;
+import org.eclipse.jgit.lib.Ref;
+import org.eclipse.jgit.revplot.PlotCommit;
+import org.eclipse.jgit.revplot.PlotCommitList;
+import org.eclipse.jgit.revplot.PlotLane;
+import org.eclipse.jgit.revplot.PlotWalk;
+import org.eclipse.jgit.revwalk.RevCommit;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.Map;
+
+import static android.view.View.GONE;
+import static android.view.View.VISIBLE;
+import static android.view.animation.AnimationUtils.loadAnimation;
+import static com.google.common.collect.Maps.newEnumMap;
+import static com.madgag.agit.R.anim.*;
+import static com.madgag.agit.git.model.Relation.CHILD;
+import static com.madgag.agit.git.model.Relation.PARENT;
+import static java.lang.System.currentTimeMillis;
public class CommitViewerActivity extends RepoScopedActivityBase {
private static final String TAG = "CVA";
View
1  agit/src/main/java/com/madgag/agit/DashboardActivity.java
@@ -14,7 +14,6 @@
import android.widget.AdapterView;
import android.widget.ListView;
import android.widget.TextView;
-import com.madgag.ZeroByteInflationCheck;
import com.madgag.android.listviews.ViewHolder;
import com.madgag.android.listviews.ViewHolderFactory;
import com.madgag.android.listviews.ViewHoldingListAdapter;
View
8 agit/src/main/java/com/madgag/agit/GitFetchService.java
@@ -19,6 +19,9 @@
package com.madgag.agit;
+import android.util.Log;
+import com.google.inject.Inject;
+import com.jcraft.jsch.JSchException;
import com.madgag.agit.git.TransportFactory;
import com.madgag.agit.guice.OperationScoped;
import com.madgag.agit.operations.*;
@@ -26,11 +29,6 @@
import org.eclipse.jgit.errors.TransportException;
import org.eclipse.jgit.transport.*;
-import android.util.Log;
-
-import com.google.inject.Inject;
-import com.jcraft.jsch.JSchException;
-
import java.util.Collection;
@OperationScoped
View
6 agit/src/main/java/com/madgag/agit/GitInfoProvider.java
@@ -19,10 +19,6 @@
package com.madgag.agit;
-import java.io.File;
-
-import org.eclipse.jgit.lib.Constants;
-
import android.content.ContentProvider;
import android.content.ContentValues;
import android.database.Cursor;
@@ -33,7 +29,7 @@
import org.eclipse.jgit.lib.RepositoryCache;
import org.eclipse.jgit.util.FS;
-import static org.eclipse.jgit.lib.RepositoryCache.FileKey.isGitRepository;
+import java.io.File;
public class GitInfoProvider extends ContentProvider {
public static final Uri CONTENT_URI = Uri.parse("content://com.madgag.agit.gitinfoprovider/repos");
View
5 agit/src/main/java/com/madgag/agit/GitIntentBuilder.java
@@ -19,14 +19,13 @@
package com.madgag.agit;
-import java.io.File;
-
+import android.content.Intent;
import org.eclipse.jgit.lib.Ref;
import org.eclipse.jgit.lib.Repository;
import org.eclipse.jgit.revwalk.RevCommit;
import org.eclipse.jgit.transport.RemoteConfig;
-import android.content.Intent;
+import java.io.File;
import static com.madgag.agit.GitIntents.*;
View
11 agit/src/main/java/com/madgag/agit/GitIntents.java
@@ -19,15 +19,14 @@
package com.madgag.agit;
-import static com.madgag.agit.git.Repos.openRepoFor;
-
-import java.io.File;
-
+import android.content.Intent;
+import android.util.Log;
import org.eclipse.jgit.lib.ObjectId;
import org.eclipse.jgit.lib.Repository;
-import android.content.Intent;
-import android.util.Log;
+import java.io.File;
+
+import static com.madgag.agit.git.Repos.openRepoFor;
public class GitIntents {
View
2  agit/src/main/java/com/madgag/agit/GitOperationsService.java
@@ -37,9 +37,9 @@
import static android.widget.Toast.LENGTH_LONG;
import static com.madgag.agit.GitIntents.*;
+import static com.madgag.agit.RepositoryViewerActivity.manageRepoPendingIntent;
import static com.madgag.agit.git.Repos.openRepoFor;
import static com.madgag.agit.git.Repos.remoteConfigFor;
-import static com.madgag.agit.RepositoryViewerActivity.manageRepoPendingIntent;
import static org.eclipse.jgit.lib.Constants.DEFAULT_REMOTE_NAME;
public class GitOperationsService extends RoboService {
View
2  agit/src/main/java/com/madgag/agit/MarkdownActivityBase.java
@@ -2,7 +2,6 @@
import android.os.Bundle;
import android.util.Log;
-import android.webkit.WebSettings;
import android.webkit.WebView;
import com.markupartist.android.widget.ActionBar;
import com.petebevin.markdown.MarkdownProcessor;
@@ -11,7 +10,6 @@
import roboguice.inject.InjectView;
import static com.madgag.agit.R.layout.about_activity;
-import static com.madgag.agit.R.string.about_activity_title;
public abstract class MarkdownActivityBase extends RoboActivity {
View
14 agit/src/main/java/com/madgag/agit/RDTypeListActivity.java
@@ -19,22 +19,20 @@
package com.madgag.agit;
+import android.content.Intent;
+import android.os.Bundle;
+import android.view.View;
+import android.widget.ListView;
import com.google.inject.Inject;
import com.google.inject.Key;
import com.madgag.agit.git.model.RepoDomainType;
import com.madgag.agit.guice.RepositoryScope;
import com.madgag.android.listviews.ViewFactory;
-import com.madgag.android.listviews.ViewHoldingListAdapter;
import com.madgag.android.listviews.ViewHolder;
import com.madgag.android.listviews.ViewHolderFactory;
-import org.eclipse.jgit.lib.Repository;
-
-import android.content.Intent;
-import android.os.Bundle;
-import android.view.View;
-import android.widget.ListView;
-
+import com.madgag.android.listviews.ViewHoldingListAdapter;
import com.markupartist.android.widget.ActionBar;
+import org.eclipse.jgit.lib.Repository;
import roboguice.activity.RoboListActivity;
import static android.R.layout.simple_list_item_2;
View
9 agit/src/main/java/com/madgag/agit/RemoteViewer.java
@@ -19,13 +19,12 @@
package com.madgag.agit;
-import java.io.File;
-import java.net.URISyntaxException;
-
-import org.eclipse.jgit.transport.RemoteConfig;
-
import android.content.Intent;
import android.os.Bundle;
+import org.eclipse.jgit.transport.RemoteConfig;
+
+import java.io.File;
+import java.net.URISyntaxException;
public class RemoteViewer extends RepoScopedActivityBase {
View
4 agit/src/main/java/com/madgag/agit/RepoScopedActivityBase.java
@@ -20,15 +20,13 @@
package com.madgag.agit;
import android.app.Dialog;
-import android.app.ProgressDialog;
import android.content.Intent;
+import android.os.Bundle;
import com.google.inject.Inject;
-
import com.google.inject.name.Named;
import com.madgag.agit.guice.RepositoryScope;
import org.eclipse.jgit.lib.Repository;
import roboguice.activity.RoboActivity;
-import android.os.Bundle;
import roboguice.inject.InjectorProvider;
import java.io.File;
View
11 agit/src/main/java/com/madgag/agit/RepositoryContext.java
@@ -19,19 +19,16 @@
package com.madgag.agit;
-import static com.google.common.collect.Lists.newArrayList;
-
-import java.io.File;
-
+import android.app.Activity;
import android.app.Dialog;
+import android.util.Log;
import com.google.inject.Inject;
import com.google.inject.name.Named;
-
-import android.app.Activity;
-import android.util.Log;
import com.madgag.agit.guice.RepositoryScope;
import com.madgag.agit.prompts.DialogPromptUIBehaviour;
+import java.io.File;
+
public class RepositoryContext
// implements IndexChangedListener, RefsChangedListener
{
View
9 agit/src/main/java/com/madgag/agit/RepositoryProvider.java
@@ -1,13 +1,12 @@
package com.madgag.agit;
-import java.io.File;
-
-import com.madgag.agit.git.Repos;
-import org.eclipse.jgit.lib.Repository;
-
import com.google.inject.Inject;
import com.google.inject.Provider;
import com.google.inject.name.Named;
+import com.madgag.agit.git.Repos;
+import org.eclipse.jgit.lib.Repository;
+
+import java.io.File;
public class RepositoryProvider implements Provider<Repository> {
@Inject @Named("gitdir") File gitdir;
View
9 agit/src/main/java/com/madgag/agit/RepositoryViewerActivity.java
@@ -22,7 +22,10 @@
import android.app.Dialog;
import android.app.PendingIntent;
import android.app.ProgressDialog;
-import android.content.*;
+import android.content.BroadcastReceiver;
+import android.content.Context;
+import android.content.Intent;
+import android.content.IntentFilter;
import android.os.Bundle;
import android.util.Log;
import android.view.Menu;
@@ -42,9 +45,7 @@
import static android.R.drawable.ic_menu_delete;
import static android.content.Intent.FLAG_ACTIVITY_NEW_TASK;
-import static com.madgag.agit.GitIntents.REPO_STATE_CHANGED_BROADCAST;
-import static com.madgag.agit.GitIntents.actionWithSuffix;
-import static com.madgag.agit.GitIntents.gitDirFrom;
+import static com.madgag.agit.GitIntents.*;
import static com.madgag.agit.R.drawable.ic_title_fetch;
import static com.madgag.agit.git.Repos.niceNameFor;
View
24 agit/src/main/java/com/madgag/agit/RevCommitListView.java
@@ -19,30 +19,22 @@
package com.madgag.agit;
-import java.util.Collections;
-import java.util.List;
-
-import android.util.Log;
-import com.google.inject.Inject;
-import com.google.inject.Injector;
-import com.madgag.android.lazydrawables.ImageSession;
-import com.madgag.android.listviews.ViewHoldingListAdapter;
-import com.madgag.android.listviews.ViewHolder;
-import com.madgag.android.listviews.ViewHolderFactory;
-import com.markupartist.android.widget.PullToRefreshListView;
-import org.eclipse.jgit.revwalk.RevCommit;
-
import android.content.Context;
import android.content.Intent;
import android.util.AttributeSet;
+import android.util.Log;
import android.view.View;
import android.widget.AdapterView;
-
import com.google.common.base.Function;
+import com.google.inject.Inject;
+import com.madgag.android.listviews.ViewHoldingListAdapter;
+import com.markupartist.android.widget.PullToRefreshListView;
+import org.eclipse.jgit.revwalk.RevCommit;
import roboguice.inject.InjectorProvider;
-import static android.view.View.GONE;
-import static android.view.View.VISIBLE;
+import java.util.Collections;
+import java.util.List;
+
import static com.madgag.agit.R.layout.rev_commit_list_item;
import static com.madgag.android.listviews.ViewInflator.viewInflatorFor;
View
4 agit/src/main/java/com/madgag/agit/TagViewer.java
@@ -43,8 +43,8 @@
import java.io.File;
import java.io.IOException;
-import static com.madgag.agit.R.id.*;
-import static org.eclipse.jgit.lib.Repository.shortenRefName;
+import static com.madgag.agit.R.id.actionbar;
+import static com.madgag.agit.R.id.tv_tag_ref_object;
public class TagViewer extends RepoScopedActivityBase {
View
2  agit/src/main/java/com/madgag/agit/ViewHoldingIterableAdapter.java
@@ -26,8 +26,6 @@
import com.madgag.android.listviews.ViewFactory;
import com.madgag.android.listviews.ViewHolderFactory;
-import java.nio.channels.NonWritableChannelException;
-import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
View
3  agit/src/main/java/com/madgag/agit/diff/CommitDiffer.java
@@ -4,9 +4,6 @@
import com.google.common.base.Function;
import org.eclipse.jgit.diff.DiffEntry;
import org.eclipse.jgit.diff.RenameDetector;
-import org.eclipse.jgit.errors.CorruptObjectException;
-import org.eclipse.jgit.errors.IncorrectObjectTypeException;
-import org.eclipse.jgit.errors.MissingObjectException;
import org.eclipse.jgit.lib.Repository;
import org.eclipse.jgit.revwalk.RevCommit;
import org.eclipse.jgit.revwalk.RevWalk;
View
5 agit/src/main/java/com/madgag/agit/diff/DeltaSpan.java
@@ -19,11 +19,12 @@
package com.madgag.agit.diff;
-import static java.lang.Math.max;
-import static java.lang.Math.round;
import android.text.TextPaint;
import android.text.style.MetricAffectingSpan;
+import static java.lang.Math.max;
+import static java.lang.Math.round;
+
public class DeltaSpan extends MetricAffectingSpan {
private final static int insertColour = 0x00c2ffc2, deleteColour = 0x00FFE6E6;
View
14 agit/src/main/java/com/madgag/agit/diff/DiffText.java
@@ -19,17 +19,17 @@
package com.madgag.agit.diff;
-import static android.text.Spanned.SPAN_EXCLUSIVE_EXCLUSIVE;
-import static com.google.common.collect.Lists.newArrayList;
-import static name.fraser.neil.plaintext.diff_match_patch.Operation.INSERT;
+import android.text.Editable;
+import android.text.style.CharacterStyle;
+import name.fraser.neil.plaintext.diff_match_patch.Diff;
+import name.fraser.neil.plaintext.diff_match_patch.Operation;
import java.util.LinkedList;
import java.util.List;
-import name.fraser.neil.plaintext.diff_match_patch.Diff;
-import name.fraser.neil.plaintext.diff_match_patch.Operation;
-import android.text.Editable;
-import android.text.style.CharacterStyle;
+import static android.text.Spanned.SPAN_EXCLUSIVE_EXCLUSIVE;
+import static com.google.common.collect.Lists.newArrayList;
+import static name.fraser.neil.plaintext.diff_match_patch.Operation.INSERT;
public class DiffText {
View
7 agit/src/main/java/com/madgag/agit/diff/FileDiff.java
@@ -19,13 +19,12 @@
package com.madgag.agit.diff;
-import java.io.IOException;
-import java.lang.ref.SoftReference;
-import java.util.List;
-
import android.util.Log;
import org.eclipse.jgit.diff.DiffEntry;
+import java.io.IOException;
+import java.util.List;
+
public class FileDiff {
private static final String TAG = "FD";
View
1  agit/src/main/java/com/madgag/agit/diff/FileHeaderViewHolder.java
@@ -3,7 +3,6 @@
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
-import com.madgag.agit.R;
import com.madgag.android.listviews.ViewHolder;
import org.eclipse.jgit.diff.DiffEntry;
View
9 agit/src/main/java/com/madgag/agit/diff/FilePathDiffer.java
@@ -19,15 +19,14 @@
package com.madgag.agit.diff;
-import java.util.LinkedList;
-import java.util.List;
-
+import com.madgag.diff.Update;
+import com.madgag.diff.UpdatesFromDiffConverter;
import name.fraser.neil.plaintext.SemanticBreakScorer;
import name.fraser.neil.plaintext.diff_match_patch;
import name.fraser.neil.plaintext.diff_match_patch.Diff;
-import com.madgag.diff.Update;
-import com.madgag.diff.UpdatesFromDiffConverter;
+import java.util.LinkedList;
+import java.util.List;
public class FilePathDiffer {
View
35 agit/src/main/java/com/madgag/agit/diff/LineContextDiffer.java
@@ -19,6 +19,19 @@
package com.madgag.agit.diff;
+import org.eclipse.jgit.JGitText;
+import org.eclipse.jgit.diff.*;
+import org.eclipse.jgit.errors.AmbiguousObjectException;
+import org.eclipse.jgit.errors.MissingObjectException;
+import org.eclipse.jgit.lib.*;
+import org.eclipse.jgit.util.QuotedString;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.util.Collection;
+import java.util.List;
+
import static com.google.common.collect.Lists.newArrayList;
import static java.lang.Math.max;
import static java.lang.Math.min;
@@ -28,28 +41,6 @@
import static org.eclipse.jgit.lib.Constants.encodeASCII;
import static org.eclipse.jgit.lib.FileMode.GITLINK;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.OutputStream;
-import java.util.Collection;
-import java.util.List;
-
-import org.eclipse.jgit.JGitText;
-import org.eclipse.jgit.diff.DiffEntry;
-import org.eclipse.jgit.diff.Edit;
-import org.eclipse.jgit.diff.EditList;
-import org.eclipse.jgit.diff.MyersDiff;
-import org.eclipse.jgit.diff.RawText;
-import org.eclipse.jgit.errors.AmbiguousObjectException;
-import org.eclipse.jgit.errors.MissingObjectException;
-import org.eclipse.jgit.lib.AbbreviatedObjectId;
-import org.eclipse.jgit.lib.Constants;
-import org.eclipse.jgit.lib.FileMode;
-import org.eclipse.jgit.lib.ObjectId;
-import org.eclipse.jgit.lib.ObjectLoader;
-import org.eclipse.jgit.lib.ObjectReader;
-import org.eclipse.jgit.util.QuotedString;
-
/**
* Format an {@link EditList} as a Git style unified patch script.
*/
View
6 agit/src/main/java/com/madgag/agit/git/GitObjectFunction.java
@@ -19,11 +19,7 @@
package com.madgag.agit.git;
-import org.eclipse.jgit.revwalk.RevBlob;
-import org.eclipse.jgit.revwalk.RevCommit;
-import org.eclipse.jgit.revwalk.RevObject;
-import org.eclipse.jgit.revwalk.RevTag;
-import org.eclipse.jgit.revwalk.RevTree;
+import org.eclipse.jgit.revwalk.*;
public interface GitObjectFunction<T> {
View
11 agit/src/main/java/com/madgag/agit/git/GitObjects.java
@@ -19,16 +19,9 @@
package com.madgag.agit.git;
-import static org.eclipse.jgit.lib.Constants.OBJ_BLOB;
-import static org.eclipse.jgit.lib.Constants.OBJ_COMMIT;
-import static org.eclipse.jgit.lib.Constants.OBJ_TAG;
-import static org.eclipse.jgit.lib.Constants.OBJ_TREE;
+import org.eclipse.jgit.revwalk.*;
-import org.eclipse.jgit.revwalk.RevBlob;
-import org.eclipse.jgit.revwalk.RevCommit;
-import org.eclipse.jgit.revwalk.RevObject;
-import org.eclipse.jgit.revwalk.RevTag;
-import org.eclipse.jgit.revwalk.RevTree;
+import static org.eclipse.jgit.lib.Constants.*;
public class GitObjects {
public static <T> T evaluate(RevObject revObject, GitObjectFunction<T> f) {
View
23 agit/src/main/java/com/madgag/agit/git/Repos.java
@@ -19,17 +19,7 @@
package com.madgag.agit.git;
-import static android.os.Environment.getExternalStorageDirectory;
-import static com.google.common.collect.Lists.newArrayList;
-import static java.lang.System.identityHashCode;
-import static org.eclipse.jgit.lib.Constants.*;
-import static org.eclipse.jgit.storage.file.WindowCacheConfig.MB;
-
-import java.io.File;
-import java.io.IOException;
-import java.net.URISyntaxException;
-import java.util.List;
-
+import android.util.Log;
import com.google.common.base.Function;
import com.google.common.collect.Ordering;
import com.madgag.agit.git.model.HasLatestCommit;
@@ -45,7 +35,16 @@
import org.eclipse.jgit.transport.URIish;
import org.eclipse.jgit.util.FS;
-import android.util.Log;
+import java.io.File;
+import java.io.IOException;
+import java.net.URISyntaxException;
+import java.util.List;
+
+import static android.os.Environment.getExternalStorageDirectory;
+import static com.google.common.collect.Lists.newArrayList;
+import static java.lang.System.identityHashCode;
+import static org.eclipse.jgit.lib.Constants.*;
+import static org.eclipse.jgit.storage.file.WindowCacheConfig.MB;
public class Repos {
View
10 agit/src/main/java/com/madgag/agit/git/TransportFactory.java
@@ -19,8 +19,9 @@
package com.madgag.agit.git;
-import static java.lang.System.identityHashCode;
-
+import android.util.Log;
+import com.google.inject.Inject;
+import com.google.inject.Provider;
import com.madgag.agit.guice.RepositoryScoped;
import org.eclipse.jgit.lib.Repository;
import org.eclipse.jgit.transport.RemoteConfig;
@@ -28,10 +29,7 @@
import org.eclipse.jgit.transport.SshTransport;
import org.eclipse.jgit.transport.Transport;
-import android.util.Log;
-
-import com.google.inject.Inject;
-import com.google.inject.Provider;
+import static java.lang.System.identityHashCode;
@RepositoryScoped
public class TransportFactory {
View
1  agit/src/main/java/com/madgag/agit/git/TransportProtocols.java
@@ -1,6 +1,5 @@
package com.madgag.agit.git;
-import android.util.Log;
import org.eclipse.jgit.JGitText;
import org.eclipse.jgit.transport.TransportProtocol;
import org.eclipse.jgit.transport.URIish;
View
8 agit/src/main/java/com/madgag/agit/git/model/RDTRemote.java
@@ -19,14 +19,14 @@
package com.madgag.agit.git.model;
-import static org.eclipse.jgit.transport.RemoteConfig.getAllRemoteConfigs;
+import com.google.inject.Inject;
+import org.eclipse.jgit.lib.Repository;
+import org.eclipse.jgit.transport.RemoteConfig;
import java.net.URISyntaxException;
import java.util.List;
-import com.google.inject.Inject;
-import org.eclipse.jgit.lib.Repository;
-import org.eclipse.jgit.transport.RemoteConfig;
+import static org.eclipse.jgit.transport.RemoteConfig.getAllRemoteConfigs;
public class RDTRemote extends RepoDomainType<RemoteConfig> {
View
2  agit/src/main/java/com/madgag/agit/git/model/RDTTag.java
@@ -21,8 +21,8 @@
import com.google.common.base.Function;
import com.google.inject.Inject;
-import com.madgag.agit.git.model.RDTTag.TagSummary;
import com.madgag.agit.git.GitObjectFunction;
+import com.madgag.agit.git.model.RDTTag.TagSummary;
import org.eclipse.jgit.lib.PersonIdent;
import org.eclipse.jgit.lib.Ref;
import org.eclipse.jgit.lib.Repository;
View
8 agit/src/main/java/com/madgag/agit/git/model/Relation.java
@@ -19,13 +19,13 @@
package com.madgag.agit.git.model;
-import static com.google.common.collect.Lists.newArrayListWithExpectedSize;
-import static java.util.Arrays.asList;
+import org.eclipse.jgit.revplot.PlotCommit;
+import org.eclipse.jgit.revplot.PlotLane;
import java.util.List;
-import org.eclipse.jgit.revplot.PlotCommit;
-import org.eclipse.jgit.revplot.PlotLane;
+import static com.google.common.collect.Lists.newArrayListWithExpectedSize;
+import static java.util.Arrays.asList;
public enum Relation {
PARENT {
View
17 agit/src/main/java/com/madgag/agit/git/model/RepoDomainType.java
@@ -19,23 +19,14 @@
package com.madgag.agit.git.model;
-import static android.R.layout.simple_list_item_2;
-import static android.text.Html.fromHtml;
-import static com.madgag.android.listviews.ViewInflator.viewInflatorFor;
+import android.content.Intent;
+import com.madgag.agit.GitIntentBuilder;
+import org.eclipse.jgit.lib.Repository;
import java.util.Collection;
import java.util.List;
-import android.*;
-import android.content.Context;
-import android.view.View;
-import com.madgag.agit.GitIntentBuilder;
-import com.madgag.android.listviews.ViewFactory;
-import com.madgag.android.listviews.ViewHolder;
-import com.madgag.android.listviews.ViewHolderFactory;
-import org.eclipse.jgit.lib.Repository;
-
-import android.content.Intent;
+import static android.text.Html.fromHtml;
public abstract class RepoDomainType<E> {
View
1  agit/src/main/java/com/madgag/agit/guice/OperationScope.java
@@ -22,7 +22,6 @@
import com.google.common.collect.MapMaker;
import com.google.inject.*;
import com.madgag.agit.operations.*;
-import com.madgag.agit.operations.Progress;
import com.madgag.android.blockingprompt.BlockingPromptService;
import java.util.Map;
View
16 agit/src/main/java/com/madgag/agit/guice/RepositoryScope.java
@@ -1,22 +1,20 @@
package com.madgag.agit.guice;
-import static com.google.common.base.Preconditions.checkState;
-import static com.google.inject.name.Names.named;
-
-import java.io.File;
-import java.util.Map;
-import java.util.concurrent.ConcurrentMap;
-
import com.google.common.base.Function;
import com.google.common.collect.MapMaker;
import com.google.inject.AbstractModule;
import com.google.inject.Key;
import com.google.inject.Module;
import com.google.inject.OutOfScopeException;
-import com.google.inject.Provider;
-import com.google.inject.Scope;
import org.eclipse.jgit.lib.Repository;
+import java.io.File;
+import java.util.Map;
+import java.util.concurrent.ConcurrentMap;
+
+import static com.google.common.base.Preconditions.checkState;
+import static com.google.inject.name.Names.named;
+
public class RepositoryScope extends ScopeBase {
View
8 agit/src/main/java/com/madgag/agit/guice/RepositoryScoped.java
@@ -1,13 +1,13 @@
package com.madgag.agit.guice;
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.ElementType.TYPE;
-import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import com.google.inject.ScopeAnnotation;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;
-import com.google.inject.ScopeAnnotation;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
@Target({ TYPE, METHOD }) @Retention(RUNTIME) @ScopeAnnotation
public @interface RepositoryScoped {}
View
2  agit/src/main/java/com/madgag/agit/guice/ScopeBase.java
@@ -1,11 +1,9 @@
package com.madgag.agit.guice;
import com.google.inject.Key;
-import com.google.inject.OutOfScopeException;
import com.google.inject.Provider;
import com.google.inject.Scope;
-import java.io.File;
import java.util.Map;
public abstract class ScopeBase implements Scope {
View
2  agit/src/main/java/com/madgag/agit/operation/lifecycle/CasualShortTermLifetime.java
@@ -1,7 +1,7 @@
package com.madgag.agit.operation.lifecycle;
-import com.madgag.agit.operations.Progress;
import com.madgag.agit.operations.OpNotification;
+import com.madgag.agit.operations.Progress;
public class CasualShortTermLifetime implements OperationLifecycleSupport {
View
6 agit/src/main/java/com/madgag/agit/operation/lifecycle/LongRunningServiceLifetime.java
@@ -1,14 +1,14 @@
package com.madgag.agit.operation.lifecycle;
-import static android.app.Notification.FLAG_ONGOING_EVENT;
import android.app.Notification;
import android.app.Service;
import android.util.Log;
import android.widget.RemoteViews;
-
-import com.madgag.agit.operations.Progress;
import com.madgag.agit.R;
import com.madgag.agit.operations.OpNotification;
+import com.madgag.agit.operations.Progress;
+
+import static android.app.Notification.FLAG_ONGOING_EVENT;
// Stateful? Relates to a specific operation?
public class LongRunningServiceLifetime implements OperationLifecycleSupport {
View
2  agit/src/main/java/com/madgag/agit/operation/lifecycle/OperationLifecycleSupport.java
@@ -1,7 +1,7 @@
package com.madgag.agit.operation.lifecycle;
-import com.madgag.agit.operations.Progress;
import com.madgag.agit.operations.OpNotification;
+import com.madgag.agit.operations.Progress;
public interface OperationLifecycleSupport {
void startedWith(OpNotification ongoingNotification);
View
13 agit/src/main/java/com/madgag/agit/operation/lifecycle/RepoNotifications.java
@@ -1,22 +1,21 @@
package com.madgag.agit.operation.lifecycle;
-import static android.app.Notification.FLAG_AUTO_CANCEL;
-import static android.content.Context.NOTIFICATION_SERVICE;
-import static java.lang.System.currentTimeMillis;
-
-import java.io.File;
-
import android.app.Notification;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.Context;
import android.util.Log;
-
import com.google.inject.Inject;
import com.google.inject.name.Named;
import com.madgag.agit.guice.RepositoryScoped;
import com.madgag.agit.operations.OpNotification;
+import java.io.File;
+
+import static android.app.Notification.FLAG_AUTO_CANCEL;
+import static android.content.Context.NOTIFICATION_SERVICE;
+import static java.lang.System.currentTimeMillis;
+
@RepositoryScoped
public class RepoNotifications {
View
2  agit/src/main/java/com/madgag/agit/operation/lifecycle/StatusBarProgressView.java
@@ -1,9 +1,9 @@
package com.madgag.agit.operation.lifecycle;
import android.widget.RemoteViews;
+import com.madgag.agit.R;
import com.madgag.agit.operations.Progress;
import com.madgag.agit.operations.ProgressListener;
-import com.madgag.agit.R;
public class StatusBarProgressView implements ProgressListener<Progress> {