Example #1
0
 /**
  * Creates a link to the file diff. http://[GitWeb
  * URL]?a=blobdiff;f=[path];fp=[path];h=[dst];hp=[src];hb=[commit];hpb=[parent commit]
  *
  * @param path affected file path
  * @return diff link
  * @throws IOException
  */
 @Override
 public URL getDiffLink(Path path) throws IOException {
   if (path.getEditType() != EditType.EDIT
       || path.getSrc() == null
       || path.getDst() == null
       || path.getChangeSet().getParentCommit() == null) {
     return null;
   }
   GitChangeSet changeSet = path.getChangeSet();
   String spec =
       param()
           .add("a=blobdiff")
           .add("f=" + path.getPath())
           .add("fp=" + path.getPath())
           .add("h=" + path.getSrc())
           .add("hp=" + path.getDst())
           .add("hb=" + changeSet.getId())
           .add("hpb=" + changeSet.getParentCommit())
           .toString();
   return new URL(url, url.getPath() + spec);
 }
 @Test
 public void testGetParentCommit() {
   assertEquals(parent, changeSet.getParentCommit());
 }