| | |
| | | import org.eclipse.jgit.revwalk.RevCommit;
|
| | |
|
| | | import com.gitblit.GitBlit;
|
| | | import com.gitblit.utils.DiffUtils;
|
| | | import com.gitblit.utils.JGitUtils;
|
| | | import com.gitblit.utils.StringUtils;
|
| | | import com.gitblit.wicket.GitBlitWebSession;
|
| | |
| | | super(params);
|
| | |
|
| | | if (!params.containsKey("r")) {
|
| | | GitBlitWebSession.get().cacheErrorMessage("Repository not specified!");
|
| | | GitBlitWebSession.get().cacheErrorMessage(getString("gb.repositoryNotSpecified"));
|
| | | redirectToInterceptPage(new RepositoriesPage());
|
| | | return;
|
| | | }
|
| | |
| | |
|
| | | Repository r = GitBlit.self().getRepository(repositoryName);
|
| | | if (r == null) {
|
| | | GitBlitWebSession.get().cacheErrorMessage("Can not load repository " + repositoryName);
|
| | | GitBlitWebSession.get().cacheErrorMessage(getString("gb.canNotLoadRepository") + " " + repositoryName);
|
| | | redirectToInterceptPage(new RepositoriesPage());
|
| | | return;
|
| | | }
|
| | |
|
| | | RevCommit commit = JGitUtils.getCommit(r, objectId);
|
| | | if (commit == null) {
|
| | | GitBlitWebSession.get().cacheErrorMessage("Commit is null");
|
| | | GitBlitWebSession.get().cacheErrorMessage(getString("gb.commitIsNull"));
|
| | | redirectToInterceptPage(new RepositoriesPage());
|
| | | return;
|
| | | }
|
| | |
| | | if (!StringUtils.isEmpty(baseObjectId)) {
|
| | | baseCommit = JGitUtils.getCommit(r, baseObjectId);
|
| | | }
|
| | | String patch = JGitUtils.getCommitPatch(r, baseCommit, commit, blobPath);
|
| | | String patch = DiffUtils.getCommitPatch(r, baseCommit, commit, blobPath);
|
| | | add(new Label("patchText", patch));
|
| | | r.close();
|
| | | }
|