Skip to content
This repository was archived by the owner on Dec 13, 2017. It is now read-only.

Commit e4bd790

Browse files
authored
Merge pull request #78 from ar613/work
Updating plugin for Bitbucket Server 5.
2 parents 8ca23a1 + 7dc4f3c commit e4bd790

File tree

5 files changed

+8392
-8
lines changed

5 files changed

+8392
-8
lines changed

pom.xml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
<groupId>com.plugin.commitgraph</groupId>
77
<artifactId>commitgraph</artifactId>
8-
<version>2.1</version>
8+
<version>3.0</version>
99

1010
<organization>
1111
<name>Chason Choate</name>
@@ -111,7 +111,7 @@
111111
</plugin>
112112
<plugin>
113113
<artifactId>maven-compiler-plugin</artifactId>
114-
<version>3.3</version>
114+
<version>3.6.1</version>
115115
<configuration>
116116
<source>1.8</source>
117117
<target>1.8</target>
@@ -121,9 +121,9 @@
121121
</build>
122122

123123
<properties>
124-
<bitbucket.version>4.0.2</bitbucket.version>
124+
<bitbucket.version>5.0.1</bitbucket.version>
125125
<bitbucket.data.version>${bitbucket.version}</bitbucket.data.version>
126-
<amps.version>6.1.0</amps.version>
126+
<amps.version>6.3.0</amps.version>
127127
<plugin.testrunner.version>1.2.3</plugin.testrunner.version>
128128
</properties>
129129
</project>

src/main/java/networkservlet/NetworkServlet.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@
3636

3737
public class NetworkServlet extends HttpServlet {
3838

39-
private final static String FORMAT = "%H|%P|%aN|%aE|%at".replace( "|", "%x02" ) + "%n%B%n%x03END%x04";
4039
static final String NETWORK_PAGE = "bitbucket.plugin.network";
4140
static final String NETWORK_PAGE_FRAGMENT = "bitbucket.plugin.network_fragment";
4241

@@ -147,7 +146,7 @@ protected Page<Commit> getCommits(final Repository repository,
147146
CommitsCommandParameters ccp = new CommitsCommandParameters.Builder().all( true ).build();
148147
PagedCommitOutputHandler pcoh = new PagedCommitOutputHandler( repository, ccp, pr );
149148
GitScmCommandBuilder revList = gitScm.getCommandBuilderFactory().builder(repository).command("rev-list");
150-
revList.argumentAt(0, "--pretty=" + FORMAT );
149+
revList.argumentAt(0, "--pretty=" + pcoh.getCommitReader().getFormat() );
151150
revList.argumentAt(1, "--branches=*" );
152151
revList.argumentAt(2, "--tags=*" );
153152
revList.argumentAt(3, "--topo-order" );

src/main/java/networkservlet/PagedCommitOutputHandler.java

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package networkservlet;
22

33
import java.io.IOException;
4+
import java.nio.charset.Charset;
45
import java.util.ArrayList;
56
import java.util.List;
67

@@ -11,6 +12,7 @@
1112
import com.atlassian.bitbucket.scm.CommandOutputHandler;
1213
import com.atlassian.bitbucket.scm.CommitsCommandParameters;
1314
import com.atlassian.bitbucket.scm.git.command.CommitReader;
15+
import com.atlassian.bitbucket.scm.git.command.CommitReaderSettings;
1416
import com.atlassian.bitbucket.util.Page;
1517
import com.atlassian.bitbucket.util.PageRequest;
1618
import com.atlassian.bitbucket.util.PageUtils;
@@ -19,12 +21,16 @@ public class PagedCommitOutputHandler extends LineReaderOutputHandler implements
1921
{
2022
private final List<Commit> commits;
2123
private final PageRequest pageRequest;
24+
private final CommitReaderSettings.Builder commitReaderSettingsBuilder;
2225
private final CommitReader commitReader;
2326

2427
public PagedCommitOutputHandler( Repository repository, CommitsCommandParameters parameters, PageRequest pageRequest )
2528
{
26-
super( "UTF-8" );
27-
this.commitReader = new CommitReader( repository, parameters.isWithMessages() )
29+
super( Charset.forName("UTF-8") );
30+
this.commitReaderSettingsBuilder = new CommitReaderSettings.Builder();
31+
commitReaderSettingsBuilder.repository(repository);
32+
commitReaderSettingsBuilder.withMessages(parameters.isWithMessages());
33+
this.commitReader = new CommitReader( commitReaderSettingsBuilder.build() )
2834
{
2935
protected void ping()
3036
{
@@ -41,6 +47,11 @@ public Page<Commit> getOutput()
4147
return PageUtils.createPage( this.commits, this.pageRequest );
4248
}
4349

50+
public CommitReader getCommitReader()
51+
{
52+
return this.commitReader;
53+
}
54+
4455
protected Commit readCommit( LineReader reader ) throws IOException
4556
{
4657
return this.commitReader.readCommit( reader );
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
The MIT License
2+
3+
Copyright (c) 2008-2010 Dmitry Baranovskiy
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in
13+
all copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21+
THE SOFTWARE.

0 commit comments

Comments
 (0)