Skip to content

The Unified and Autonomous Development Platform

midwork

robin shine924fc36b2f21
diff --git a/commons.git/pom.xml b/commons.git/pom.xml
index f66e7fe8b0..837c245eea 100644
--- a/commons.git/pom.xml
+++ b/commons.git/pom.xml
@@ -1,94 +1,94 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <artifactId>commons.git</artifactId>
- <version>1.0.0</version>
- <parent>
- <groupId>com.pmease</groupId>
- <artifactId>parent.general</artifactId>
- <version>1.0.31</version>
- </parent>
- <build>
- <plugins>
- <plugin>
- <groupId>com.pmease</groupId>
- <artifactId>plugin.maven</artifactId>
- </plugin>
- <!-- Uncomment below if you'd like to publish an archetype based on your
- plugin -->
- <!--plugin> <artifactId>maven-archetype-plugin</artifactId> </plugin -->
- <plugin>
- <artifactId>maven-jar-plugin</artifactId>
- <executions>
- <execution>
- <goals>
- <goal>test-jar</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <artifactId>maven-source-plugin</artifactId>
- </plugin>
- <plugin>
- <artifactId>maven-javadoc-plugin</artifactId>
- </plugin>
- </plugins>
- </build>
- <dependencies>
- <dependency>
- <groupId>com.pmease</groupId>
- <artifactId>commons.loader</artifactId>
- <version>1.0.31</version>
- </dependency>
- <dependency>
- <groupId>org.eclipse.jgit</groupId>
- <artifactId>org.eclipse.jgit.http.server</artifactId>
- <version>4.0.1.201506240215-r</version>
- </dependency>
- <dependency>
- <groupId>com.pmease</groupId>
- <artifactId>commons.util</artifactId>
- <version>1.0.31</version>
- </dependency>
- <dependency>
- <groupId>com.pmease</groupId>
- <artifactId>commons.loader</artifactId>
- <version>1.0.31</version>
- <type>test-jar</type>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>com.pmease</groupId>
- <artifactId>commons.wicket</artifactId>
- <version>1.0.29</version>
- </dependency>
- <dependency>
- <groupId>com.pmease</groupId>
- <artifactId>commons.lang</artifactId>
- <version>1.0.0</version>
- </dependency>
- </dependencies>
- <repositories>
- <repository>
- <id>pmeaseRepo</id>
- <name>PMEase Repository</name>
- <releases>
- <enabled>true</enabled>
- <updatePolicy>never</updatePolicy>
- <checksumPolicy>fail</checksumPolicy>
- </releases>
- <snapshots>
- <enabled>true</enabled>
- <updatePolicy>always</updatePolicy>
- <checksumPolicy>fail</checksumPolicy>
- </snapshots>
- <url>http://artifact.pmease.com/</url>
- </repository>
- </repositories>
- <properties>
- <moduleClass>com.pmease.commons.git.GitModule</moduleClass>
- </properties>
-</project>
+<?xml version="1.0" encoding="UTF-8"?>
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>commons.git</artifactId>
+ <version>1.0.0</version>
+ <parent>
+ <groupId>com.pmease</groupId>
+ <artifactId>parent.general</artifactId>
+ <version>1.0.31</version>
+ </parent>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>com.pmease</groupId>
+ <artifactId>plugin.maven</artifactId>
+ </plugin>
+ <!-- Uncomment below if you'd like to publish an archetype based on your
+ plugin -->
+ <!--plugin> <artifactId>maven-archetype-plugin</artifactId> </plugin -->
+ <plugin>
+ <artifactId>maven-jar-plugin</artifactId>
+ <executions>
+ <execution>
+ <goals>
+ <goal>test-jar</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <artifactId>maven-source-plugin</artifactId>
+ </plugin>
+ <plugin>
+ <artifactId>maven-javadoc-plugin</artifactId>
+ </plugin>
+ </plugins>
+ </build>
+ <dependencies>
+ <dependency>
+ <groupId>com.pmease</groupId>
+ <artifactId>commons.loader</artifactId>
+ <version>1.0.31</version>
+ </dependency>
+ <dependency>
+ <groupId>org.eclipse.jgit</groupId>
+ <artifactId>org.eclipse.jgit.http.server</artifactId>
+ <version>4.1.1.201511131810-r</version>
+ </dependency>
+ <dependency>
+ <groupId>com.pmease</groupId>
+ <artifactId>commons.util</artifactId>
+ <version>1.0.31</version>
+ </dependency>
+ <dependency>
+ <groupId>com.pmease</groupId>
+ <artifactId>commons.loader</artifactId>
+ <version>1.0.31</version>
+ <type>test-jar</type>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>com.pmease</groupId>
+ <artifactId>commons.wicket</artifactId>
+ <version>1.0.29</version>
+ </dependency>
+ <dependency>
+ <groupId>com.pmease</groupId>
+ <artifactId>commons.lang</artifactId>
+ <version>1.0.0</version>
+ </dependency>
+ </dependencies>
+ <repositories>
+ <repository>
+ <id>pmeaseRepo</id>
+ <name>PMEase Repository</name>
+ <releases>
+ <enabled>true</enabled>
+ <updatePolicy>never</updatePolicy>
+ <checksumPolicy>fail</checksumPolicy>
+ </releases>
+ <snapshots>
+ <enabled>true</enabled>
+ <updatePolicy>always</updatePolicy>
+ <checksumPolicy>fail</checksumPolicy>
+ </snapshots>
+ <url>http://artifact.pmease.com/</url>
+ </repository>
+ </repositories>
+ <properties>
+ <moduleClass>com.pmease.commons.git.GitModule</moduleClass>
+ </properties>
+</project>
diff --git a/commons.git/src/main/java/org/eclipse/jgit/revwalk/RevWalk.java b/commons.git/src/main/java/org/eclipse/jgit/revwalk/RevWalk.java
index afb208ecf9..1176d958b0 100644
--- a/commons.git/src/main/java/org/eclipse/jgit/revwalk/RevWalk.java
+++ b/commons.git/src/main/java/org/eclipse/jgit/revwalk/RevWalk.java
@@ -1406,6 +1406,8 @@ public class RevWalk implements Iterable<RevCommit>, AutoCloseable {
/**
* Assume additional commits are shallow (have no parents).
+ * <p>
+ * This method is a No-op if the collection is empty.
*
* @param ids
* commits that should be treated as shallow commits, in addition
diff --git a/gitplex.core/src/main/java/com/pmease/gitplex/core/model/Repository.java b/gitplex.core/src/main/java/com/pmease/gitplex/core/model/Repository.java
index 88afedb3bb..a45844376c 100644
--- a/gitplex.core/src/main/java/com/pmease/gitplex/core/model/Repository.java
+++ b/gitplex.core/src/main/java/com/pmease/gitplex/core/model/Repository.java
@@ -427,9 +427,15 @@ public class Repository extends AbstractEntity implements UserBelonging {
ObjectId ancestorId = getObjectId(ancestor);
ObjectId descendantId = getObjectId(descendant);
revWalk.setRevFilter(RevFilter.MERGE_BASE);
- revWalk.markStart(revWalk.lookupCommit(ancestorId));
- revWalk.markStart(revWalk.lookupCommit(descendantId));
- return revWalk.next();
+ RevCommit ancestorCommit = getRevCommit(ancestorId);
+ RevCommit descendantCommit = getRevCommit(descendantId);
+
+ // we should look up commit again as markStart requires that the commit
+ // should be resolved in the same revWalk. Also we should not look up
+ // against ancestorId directly as it might be id of an annotated tag
+ revWalk.markStart(revWalk.lookupCommit(ancestorCommit.getId()));
+ revWalk.markStart(revWalk.lookupCommit(descendantCommit.getId()));
+ return Preconditions.checkNotNull(revWalk.next());
} catch (IOException e) {
throw new RuntimeException(e);
}
@@ -441,9 +447,15 @@ public class Repository extends AbstractEntity implements UserBelonging {
ObjectId ancestorId = getObjectId(ancestor);
ObjectId descendantId = getObjectId(descendant);
revWalk.setRevFilter(RevFilter.MERGE_BASE);
- revWalk.markStart(revWalk.lookupCommit(ancestorId));
- revWalk.markStart(revWalk.lookupCommit(descendantId));
- return revWalk.next().getId().equals(ancestorId);
+ RevCommit ancestorCommit = getRevCommit(ancestorId);
+ RevCommit descendantCommit = getRevCommit(descendantId);
+
+ // we should look up commit again as markStart requires that the commit
+ // should be resolved in the same revWalk. Also we should not look up
+ // against ancestorId directly as it might be id of an annotated tag
+ revWalk.markStart(revWalk.lookupCommit(ancestorCommit.getId()));
+ revWalk.markStart(revWalk.lookupCommit(descendantCommit.getId()));
+ return ancestorId.equals(Preconditions.checkNotNull(revWalk.next().getId()));
} catch (IOException e) {
throw new RuntimeException(e);
}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/component/commitlist/commit-list.css b/gitplex.web/src/main/java/com/pmease/gitplex/web/component/commitlist/commit-list.css
index d5f9b8002b..c62b910781 100644
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/component/commitlist/commit-list.css
+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/component/commitlist/commit-list.css
@@ -1,48 +1,48 @@
-.commit-list {
- border: 1px solid #CCC;
- border-radius: 4px;
-}
-.commit-list td {
- padding: 8px;
- color: #999;
- border-top: 1px solid #E8E8E8;
-}
-.commit-list tr:first-child td {
- border-top: none;
-}
-.commit-list td.avatar {
- width: 1px;
-}
-.commit-list td.info {
- text-align: right;
- white-space: nowrap;
-}
-.commit-list td.avatar img {
- width: 37px;
- height: 37px;
-}
-.commit-list a {
- color: #666;
-}
-.commit-list a.summary {
- font-weight: bold;
-}
-.commit-list td.detail {
- padding-left: 8px;
- padding-right: 8px;
-}
-.commit-list td.detail .name {
- color: #666;
-}
-.commit-list a.commit-hash {
- font-family: monospace;
-}
-.commit-list tr:hover td {
- background: #F7ECB9;
-}
-.commit-list .commit-message>.full {
- margin-bottom: 4px;
-}
-.commit-list .alert {
- margin-bottom: 16px;
+.commit-list {
+ border: 1px solid #CCC;
+ border-radius: 4px;
+}
+.commit-list td {
+ padding: 8px;
+ color: #999;
+ border-top: 1px solid #E8E8E8;
+}
+.commit-list tr:first-child td {
+ border-top: none;
+}
+.commit-list td.avatar {
+ width: 1px;
+}
+.commit-list td.info {
+ text-align: right;
+ white-space: nowrap;
+}
+.commit-list td.avatar img {
+ width: 37px;
+ height: 37px;
+}
+.commit-list a {
+ color: #666;
+}
+.commit-list a.summary {
+ font-weight: bold;
+}
+.commit-list td.detail {
+ padding-left: 8px;
+ padding-right: 8px;
+}
+.commit-list td.detail .name {
+ color: #666;
+}
+.commit-list a.commit-hash {
+ font-family: monospace;
+}
+.commit-list tr:hover td {
+ background: #F7ECB9;
+}
+.commit-list .commit-message>.full {
+ margin-bottom: 4px;
+}
+.commit-list .alert {
+ margin: 8px;
}
\ No newline at end of file
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/component/revisionpicker/AffinalRevisionPicker.html b/gitplex.web/src/main/java/com/pmease/gitplex/web/component/revisionpicker/AffinalRevisionPicker.html
index 9478efc909..0f50f14f07 100644
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/component/revisionpicker/AffinalRevisionPicker.html
+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/component/revisionpicker/AffinalRevisionPicker.html
@@ -1,16 +1,6 @@
<wicket:panel>
- <table class="repository-and-revision">
- <tr class="repository">
- <td class="name"><span>Repository</span></td>
- <td class="value">
- <a wicket:id="repositoryPicker"></a>
- </td>
- </tr>
- <tr class="revision">
- <td class="name"><span>Revision</span></td>
- <td class="value">
- <a wicket:id="revisionPicker"></a>
- </td>
- </tr>
- </table>
+ <span class="repository-and-revision">
+ <a wicket:id="repositoryPicker" class="repository"></a>
+ <a wicket:id="revisionPicker" class="revision"></a>
+ </span>
</wicket:panel>
\ No newline at end of file
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/component/revisionpicker/AffinalRevisionPicker.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/component/revisionpicker/AffinalRevisionPicker.java
index abaacc8868..e3efa0ec84 100644
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/component/revisionpicker/AffinalRevisionPicker.java
+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/component/revisionpicker/AffinalRevisionPicker.java
@@ -3,8 +3,11 @@ package com.pmease.gitplex.web.component.revisionpicker;
import javax.annotation.Nullable;
import org.apache.wicket.ajax.AjaxRequestTarget;
+import org.apache.wicket.markup.head.CssHeaderItem;
+import org.apache.wicket.markup.head.IHeaderResponse;
import org.apache.wicket.markup.html.panel.Panel;
import org.apache.wicket.model.LoadableDetachableModel;
+import org.apache.wicket.request.resource.CssResourceReference;
import com.pmease.commons.hibernate.dao.Dao;
import com.pmease.gitplex.core.GitPlex;
@@ -74,6 +77,13 @@ public abstract class AffinalRevisionPicker extends Panel {
setOutputMarkupId(true);
}
+ @Override
+ public void renderHead(IHeaderResponse response) {
+ super.renderHead(response);
+ response.render(CssHeaderItem.forReference(new CssResourceReference(
+ AffinalRevisionPicker.class, "revision-picker.css")));
+ }
+
protected abstract void onSelect(AjaxRequestTarget target, Repository repository, String revision);
}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/component/revisionpicker/revision-picker.css b/gitplex.web/src/main/java/com/pmease/gitplex/web/component/revisionpicker/revision-picker.css
new file mode 100644
index 0000000000..bc90728320
--- /dev/null
+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/component/revisionpicker/revision-picker.css
@@ -0,0 +1,11 @@
+.repository-and-revision {
+ white-space: nowrap;
+}
+.repository-and-revision>a {
+ color: #444;
+ text-decoration: none;
+ font-size: 16px;
+}
+.repository-and-revision>a.repository {
+ margin-right: 12px;
+}
\ No newline at end of file
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/compare/RevisionComparePage.html b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/compare/RevisionComparePage.html
index fe2aa4c2d4..c2f92e50bf 100644
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/compare/RevisionComparePage.html
+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/compare/RevisionComparePage.html
@@ -2,21 +2,19 @@
<div id="revision-compare">
<div class="head">Compare Revisions</div>
<div class="body">
- <table class="revisions">
- <tr>
- <td class="target">
- <div class="title">Base</div>
- <div wicket:id="target" class="revision"></div>
- </td>
- <td class="actions">
- <a wicket:id="swap" class="swap btn btn-sm btn-default"><i class="fa fa-arrows-h"></i> swap</a>
- </td>
- <td class="source">
- <div class="title">Compare</div>
- <div wicket:id="source" class="revision"></div>
- </td>
- </tr>
- </table>
+ <div class="revisions clearfix">
+ <div class="revision pull-left">
+ <label>Base</label>
+ <div wicket:id="target"></div>
+ </div>
+ <div class="action pull-left">
+ <a wicket:id="swap" class="swap btn btn-default"><i class="fa fa-arrows-h"></i> swap</a>
+ </div>
+ <div class="revision pull-left">
+ <label>Compare</label>
+ <div wicket:id="source"></div>
+ </div>
+ </div>
<div wicket:id="sameRevision" class="alert alert-warning status">
<div class="summary">
<span class="fa fa-lg fa-warning"></span>
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/compare/RevisionComparePage.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/compare/RevisionComparePage.java
index cc43155b05..b89159f41d 100644
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/compare/RevisionComparePage.java
+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/compare/RevisionComparePage.java
@@ -308,7 +308,15 @@ public class RevisionComparePage extends RepositoryPage {
}
private Component newCommitsPanel() {
- return new CommitListPanel(TAB_PANEL_ID, repoModel, commitsModel).setOutputMarkupId(true);
+ return new CommitListPanel(TAB_PANEL_ID, repoModel, commitsModel){
+
+ @Override
+ protected void onConfigure() {
+ super.onConfigure();
+ setVisible(!commitsModel.getObject().isEmpty());
+ }
+
+ }.setOutputMarkupId(true);
}
@Override
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/compare/revision-compare.css b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/compare/revision-compare.css
index 3b7dc58a30..402dfcadd1 100644
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/compare/revision-compare.css
+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/compare/revision-compare.css
@@ -11,19 +11,19 @@
#revision-compare>.body>.revisions {
margin-bottom: 20px;
}
-#revision-compare>.body>.revisions td>div.title {
- font-size: 18px;
- margin-bottom: 8px;
-}
-#revision-compare>.body>.revisions td>div.revision {
+#revision-compare>.body>.revisions>.revision {
background: #F2F2F2;
+ border: 1px solid #DDD;
border-radius: 4px;
- vertical-align: top;
+ padding: 12px;
+}
+#revision-compare>.body>.revisions>.action {
+ margin-right: 0;
+ padding: 18px;
}
-#revision-compare>.body>.revisions .actions {
- width: 1%;
- background: none;
- padding: 77px 10px 0 10px;
+#revision-compare>.body>.revisions>.revision>label {
+ font-size: 16px;
+ color: #555;
}
#revision-compare>.body>.nav-tabs {
margin-bottom: 20px;
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/pullrequest/requestdetail/updates/request-updates.css b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/pullrequest/requestdetail/updates/request-updates.css
index 86c1ee7027..281f7eb99c 100644
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/pullrequest/requestdetail/updates/request-updates.css
+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/pullrequest/requestdetail/updates/request-updates.css
@@ -26,11 +26,7 @@
position: relative;
}
#request-detail>.updates>.update>.alert {
- margin-bottom: 0;
- border-radius: 0;
- border-top: 0;
- border-left: 0;
- border-right: 0;
+ margin: 8px;
}
#request-detail>.updates>.update>.commits td {
padding: 8px;
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/test/TestPage.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/test/TestPage.java
index 6b47d0aca9..3992ec671f 100644
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/test/TestPage.java
+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/test/TestPage.java
@@ -2,6 +2,9 @@ package com.pmease.gitplex.web.page.test;
import org.apache.wicket.markup.html.link.Link;
+import com.pmease.commons.hibernate.dao.Dao;
+import com.pmease.gitplex.core.GitPlex;
+import com.pmease.gitplex.core.model.Repository;
import com.pmease.gitplex.web.page.base.BasePage;
@SuppressWarnings("serial")
@@ -15,6 +18,8 @@ public class TestPage extends BasePage {
@Override
public void onClick() {
+ Repository repo = GitPlex.getInstance(Dao.class).load(Repository.class, 1L);
+ System.out.println(repo.getMergeBase("master", "formfeed"));
}
});