mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
commit
c3625163bf
8 changed files with 68 additions and 33 deletions
|
@ -26,7 +26,7 @@
|
|||
</profile>
|
||||
</annotationProcessing>
|
||||
<bytecodeTargetLevel>
|
||||
<module name="writelatex-git-bridge" target="1.7" />
|
||||
<module name="writelatex-git-bridge" target="1.8" />
|
||||
</bytecodeTargetLevel>
|
||||
</component>
|
||||
</project>
|
|
@ -2,5 +2,6 @@
|
|||
<project version="4">
|
||||
<component name="Encoding">
|
||||
<file url="file://$PROJECT_DIR$" charset="UTF-8" />
|
||||
<file url="PROJECT" charset="UTF-8" />
|
||||
</component>
|
||||
</project>
|
|
@ -10,5 +10,33 @@
|
|||
</list>
|
||||
</option>
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="false" assert-keyword="true" jdk-15="true" project-jdk-name="1.8" project-jdk-type="JavaSDK" />
|
||||
<component name="ProjectLevelVcsManager" settingsEditedManually="false">
|
||||
<OptionsSetting value="true" id="Add" />
|
||||
<OptionsSetting value="true" id="Remove" />
|
||||
<OptionsSetting value="true" id="Checkout" />
|
||||
<OptionsSetting value="true" id="Update" />
|
||||
<OptionsSetting value="true" id="Status" />
|
||||
<OptionsSetting value="true" id="Edit" />
|
||||
<ConfirmationsSetting value="0" id="Add" />
|
||||
<ConfirmationsSetting value="0" id="Remove" />
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" assert-keyword="true" jdk-15="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/out" />
|
||||
</component>
|
||||
<component name="masterDetails">
|
||||
<states>
|
||||
<state key="ProjectJDKs.UI">
|
||||
<settings>
|
||||
<last-edited>1.8</last-edited>
|
||||
<splitter-proportions>
|
||||
<option name="proportions">
|
||||
<list>
|
||||
<option value="0.2" />
|
||||
</list>
|
||||
</option>
|
||||
</splitter-proportions>
|
||||
</settings>
|
||||
</state>
|
||||
</states>
|
||||
</component>
|
||||
</project>
|
|
@ -16,8 +16,8 @@
|
|||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.2</version>
|
||||
<configuration>
|
||||
<source>1.7</source>
|
||||
<target>1.7</target>
|
||||
<source>1.8</source>
|
||||
<target>1.8</target>
|
||||
<compilerArgument></compilerArgument>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
@ -81,12 +81,12 @@
|
|||
<dependency>
|
||||
<groupId>org.eclipse.jgit</groupId>
|
||||
<artifactId>org.eclipse.jgit</artifactId>
|
||||
<version>3.6.0.201412230720-r</version>
|
||||
<version>4.4.1.201607150455-r</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.eclipse.jgit</groupId>
|
||||
<artifactId>org.eclipse.jgit.http.server</artifactId>
|
||||
<version>3.6.0.201412230720-r</version>
|
||||
<version>4.4.1.201607150455-r</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.xerial</groupId>
|
||||
|
|
|
@ -48,7 +48,7 @@ public class WLBridgedProject {
|
|||
} catch (InvalidProjectException e) {
|
||||
throw new RepositoryNotFoundException(name);
|
||||
} catch (SnapshotPostException e) {
|
||||
throw new RepositoryNotFoundException(name);
|
||||
throw new ServiceMayNotContinueException(e.getDescriptionLines().get(0), e);
|
||||
} catch (GitAPIException e) {
|
||||
throw new ServiceMayNotContinueException(e);
|
||||
} catch (IOException e) {
|
||||
|
|
|
@ -19,6 +19,7 @@ import uk.ac.ic.wlgitbridge.util.Log;
|
|||
|
||||
import java.io.IOException;
|
||||
import java.util.Collection;
|
||||
import java.util.Iterator;
|
||||
|
||||
/**
|
||||
* Created by Winston on 03/11/14.
|
||||
|
@ -57,9 +58,17 @@ public class WriteLatexPutHook implements PreReceiveHook {
|
|||
private void handleSnapshotPostException(ReceivePack receivePack, ReceiveCommand receiveCommand, SnapshotPostException e) {
|
||||
String message = e.getMessage();
|
||||
receivePack.sendError(message);
|
||||
for (String line : e.getDescriptionLines()) {
|
||||
receivePack.sendMessage("hint: " + line);
|
||||
StringBuilder msg = new StringBuilder();
|
||||
for (Iterator<String> it = e.getDescriptionLines().iterator(); it.hasNext();) {
|
||||
String line = it.next();
|
||||
msg.append("hint: ");
|
||||
msg.append(line);
|
||||
if (it.hasNext()) {
|
||||
msg.append('\n');
|
||||
}
|
||||
}
|
||||
receivePack.sendMessage("");
|
||||
receivePack.sendMessage(msg.toString());
|
||||
receiveCommand.setResult(Result.REJECTED_OTHER_REASON, message);
|
||||
}
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@ package uk.ac.ic.wlgitbridge;
|
|||
|
||||
import com.ning.http.client.AsyncHttpClient;
|
||||
import com.ning.http.client.Response;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.eclipse.jgit.api.errors.GitAPIException;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
|
@ -22,8 +23,7 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
* Created by Winston on 11/01/15.
|
||||
|
@ -336,8 +336,6 @@ public class WLGitBridgeIntegrationTest {
|
|||
}
|
||||
|
||||
private static final String EXPECTED_OUT_PUSH_OUT_OF_DATE_FIRST =
|
||||
"To http://127.0.0.1:33867/testproj.git\n" +
|
||||
" ! [rejected] master -> master (non-fast-forward)\n" +
|
||||
"error: failed to push some refs to 'http://127.0.0.1:33867/testproj.git'\n" +
|
||||
"hint: Updates were rejected because the tip of your current branch is behind\n" +
|
||||
"hint: its remote counterpart. Integrate the remote changes (e.g.\n" +
|
||||
|
@ -367,8 +365,6 @@ public class WLGitBridgeIntegrationTest {
|
|||
}
|
||||
|
||||
private static final String EXPECTED_OUT_PUSH_OUT_OF_DATE_SECOND =
|
||||
"To http://127.0.0.1:33868/testproj.git\n" +
|
||||
" ! [rejected] master -> master (non-fast-forward)\n" +
|
||||
"error: failed to push some refs to 'http://127.0.0.1:33868/testproj.git'\n" +
|
||||
"hint: Updates were rejected because the tip of your current branch is behind\n" +
|
||||
"hint: its remote counterpart. Integrate the remote changes (e.g.\n" +
|
||||
|
@ -398,7 +394,6 @@ public class WLGitBridgeIntegrationTest {
|
|||
}
|
||||
|
||||
private static final List<String> EXPECTED_OUT_PUSH_INVALID_FILES = Arrays.asList(
|
||||
"remote: error: invalid files",
|
||||
"remote: hint: You have 4 invalid files in your Overleaf project:",
|
||||
"remote: hint: file1.invalid (error)",
|
||||
"remote: hint: file2.exe (invalid file extension)",
|
||||
|
@ -433,7 +428,6 @@ public class WLGitBridgeIntegrationTest {
|
|||
}
|
||||
|
||||
private static final List<String> EXPECTED_OUT_PUSH_INVALID_PROJECT = Arrays.asList(
|
||||
"remote: error: invalid project",
|
||||
"remote: hint: project: no main file",
|
||||
"remote: hint: The project would have no (editable) main .tex file.",
|
||||
"To http://127.0.0.1:33870/testproj.git",
|
||||
|
@ -465,7 +459,6 @@ public class WLGitBridgeIntegrationTest {
|
|||
}
|
||||
|
||||
private static final List<String> EXPECTED_OUT_PUSH_UNEXPECTED_ERROR = Arrays.asList(
|
||||
"remote: error: Overleaf error",
|
||||
"remote: hint: There was an internal error with the Overleaf server.",
|
||||
"remote: hint: Please contact Overleaf.",
|
||||
"To http://127.0.0.1:33871/testproj.git",
|
||||
|
@ -499,6 +492,7 @@ public class WLGitBridgeIntegrationTest {
|
|||
|
||||
private static final List<String> EXPECTED_OUT_PUSH_INVALID_EXE_FILE = Arrays.asList(
|
||||
"remote: error: invalid files",
|
||||
"remote:",
|
||||
"remote: hint: You have 1 invalid files in your Overleaf project:",
|
||||
"remote: hint: file1.exe (invalid file extension)",
|
||||
"To http://127.0.0.1:33872/testproj.git",
|
||||
|
@ -595,8 +589,14 @@ public class WLGitBridgeIntegrationTest {
|
|||
|
||||
private File cloneRepository(String repositoryName, int port, File dir) throws IOException, InterruptedException {
|
||||
String repo = "git clone http://127.0.0.1:" + port + "/" + repositoryName + ".git";
|
||||
assertEquals(0, runtime.exec(repo, null, dir).waitFor());
|
||||
|
||||
Process gitProcess = runtime.exec(repo, null, dir);
|
||||
int exitCode = gitProcess.waitFor();
|
||||
if (exitCode != 0) {
|
||||
System.err.println("git clone failed. Dumping stderr and stdout.");
|
||||
System.err.println(IOUtils.toString(gitProcess.getErrorStream()));
|
||||
System.err.println(IOUtils.toString(gitProcess.getInputStream()));
|
||||
fail("git clone failed");
|
||||
}
|
||||
File repositoryDir = new File(dir, repositoryName);
|
||||
|
||||
assertEquals(0, runtime.exec("git config user.name TEST", null, repositoryDir).waitFor());
|
||||
|
|
|
@ -1,20 +1,17 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
|
||||
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_7" inherit-compiler-output="false">
|
||||
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8" inherit-compiler-output="false">
|
||||
<output url="file://$MODULE_DIR$/target/classes" />
|
||||
<output-test url="file://$MODULE_DIR$/target/test-classes" />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/test/resources" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/target" />
|
||||
</content>
|
||||
<orderEntry type="jdk" jdkName="1.8" jdkType="JavaSDK" />
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.7.12" level="project" />
|
||||
<orderEntry type="library" name="Maven: ch.qos.logback:logback-classic:1.1.7" level="project" />
|
||||
<orderEntry type="library" name="Maven: ch.qos.logback:logback-core:1.1.7" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: junit:junit:4.12" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: org.hamcrest:hamcrest-core:1.3" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: org.jmock:jmock-junit4:2.8.2" level="project" />
|
||||
|
@ -37,14 +34,14 @@
|
|||
<orderEntry type="library" name="Maven: com.ning:async-http-client:1.9.38" level="project" />
|
||||
<orderEntry type="library" name="Maven: io.netty:netty:3.10.5.Final" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.7.12" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.eclipse.jgit:org.eclipse.jgit:3.6.0.201412230720-r" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.jcraft:jsch:0.1.50" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.eclipse.jgit:org.eclipse.jgit:4.4.1.201607150455-r" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.jcraft:jsch:0.1.53" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.googlecode.javaewah:JavaEWAH:0.7.9" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.httpcomponents:httpclient:4.1.3" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.httpcomponents:httpcore:4.1.4" level="project" />
|
||||
<orderEntry type="library" name="Maven: commons-logging:commons-logging:1.1.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: commons-codec:commons-codec:1.4" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.eclipse.jgit:org.eclipse.jgit.http.server:3.6.0.201412230720-r" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.httpcomponents:httpclient:4.3.6" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.httpcomponents:httpcore:4.3.3" level="project" />
|
||||
<orderEntry type="library" name="Maven: commons-logging:commons-logging:1.1.3" level="project" />
|
||||
<orderEntry type="library" name="Maven: commons-codec:commons-codec:1.6" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.eclipse.jgit:org.eclipse.jgit.http.server:4.4.1.201607150455-r" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.xerial:sqlite-jdbc:3.8.11.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: joda-time:joda-time:2.9.4" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.google.oauth-client:google-oauth-client:1.22.0" level="project" />
|
||||
|
|
Loading…
Reference in a new issue