Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

added ${num} tag which referrs to file number in change list

added GitHub linking
  • Loading branch information...
commit 57d2415149f26286e189d632a92090f91d94c1d8 1 parent 4f5fd3b
isungurov authored
View
14 src/main/java/com/xiplink/jira/git/FileDiff.java
@@ -27,6 +27,7 @@
public class FileDiff {
+ private final int number;
private final RevCommit commit;
private DiffEntry diffEntry;
@@ -54,9 +55,11 @@
if (walk.getTreeCount() <= 2) {
List<DiffEntry> entries = DiffEntry.scan(walk);
+ int number = 0;
for (DiffEntry entry : entries) {
- final FileDiff d = new FileDiff(commit, entry);
+ final FileDiff d = new FileDiff(commit, entry, number);
r.add(d);
+ number++;
}
} else { // DiffEntry does not support walks with more than two trees
final int nTree = walk.getTreeCount();
@@ -144,9 +147,14 @@ public ChangeType getChange() {
return modes.toArray(new FileMode[]{});
}
- FileDiff(final RevCommit c, final DiffEntry entry) {
+ public int getNumber() {
+ return number;
+ }
+
+ FileDiff(final RevCommit c, final DiffEntry entry, final int num) {
diffEntry = entry;
commit = c;
+ number = num;
}
private static class FileDiffForMerges extends FileDiff {
@@ -157,7 +165,7 @@ public ChangeType getChange() {
private FileMode[] modes;
private FileDiffForMerges(final RevCommit c) {
- super(c, null);
+ super(c, null, 0);
}
@Override
View
1  src/main/java/com/xiplink/jira/git/linkrenderer/LinkFormatRenderer.java
@@ -68,6 +68,7 @@ public String getRevisionLink(RevCommit revision) {
public String getChangePathLink(RevCommit revision, FileDiff path) {
Map<String, String> subst = EasyMap.build(
+ "${num}", Integer.toString(path.getNumber()),
"${rev}", revision.getId().name(),
"${path}", path.getPath(),
"${parent}", revision.getParent(0).getId().name()
View
13 src/main/resources/gitweblinktypes.properties
@@ -1,4 +1,4 @@
-types=gitweb fisheye
+types=gitweb fisheye github
#---------------------------------
# gitweb
@@ -32,3 +32,14 @@ gitwebclient.changeset=${origin}/gitwebclient/revisionDetails.jsp?location=/&rev
gitwebclient.file.added=${origin}/gitwebclient/changedResource.jsp?location=/&url=${path}&rev=${rev}&action=add
gitwebclient.file.modified=${origin}/gitwebclient/changedResource.jsp?location=/&url=${path}&rev=${rev}&action=modify
gitwebclient.file.deleted=${origin}/gitwebclient/changedResource.jsp?location=/&url=${path}&rev=${rev}&action=delete
+
+#---------------------------------
+# github.com
+#---------------------------------
+
+github.name=GitHub
+github.view=
+github.changeset=https://github.com/<user>/<project>/commit/${rev}
+github.file.added=https://github.com/<user>/<project>/commit/${rev}#diff-${num}
+github.file.modified=https://github.com/<user>/<project>/commit/${rev}#diff-${num}
+github.file.deleted=https://github.com/<user>/<project>/commit/${rev}#diff-${num}

0 comments on commit 57d2415

Please sign in to comment.
Something went wrong with that request. Please try again.