Yi EungJun 2015-03-09
code: Rename getBranchNames() to getRefNames()
The method actually doesn't return branch names but ref names,
@24d7a14e2802b157f368c06d8478f5cd54c269af
app/controllers/CodeApp.java
--- app/controllers/CodeApp.java
+++ app/controllers/CodeApp.java
@@ -94,7 +94,7 @@
         path = HttpUtil.decodePathSegment(path);
 
         PlayRepository repository = RepositoryService.getRepository(project);
-        List<String> branches = repository.getBranchNames();
+        List<String> branches = repository.getRefNames();
         List<ObjectNode> recursiveData = RepositoryService.getMetaDataFromAncestorDirectories(
                 repository, branch, path);
 
app/controllers/ProjectApp.java
--- app/controllers/ProjectApp.java
+++ app/controllers/ProjectApp.java
@@ -169,7 +169,7 @@
         Project project = Project.findByOwnerAndProjectName(ownerId, projectName);
         Form<Project> projectForm = form(Project.class).fill(project);
         PlayRepository repository = RepositoryService.getRepository(project);
-        return ok(setting.render("title.projectSetting", projectForm, project, repository.getBranchNames()));
+        return ok(setting.render("title.projectSetting", projectForm, project, repository.getRefNames()));
     }
 
     @Transactional
@@ -246,7 +246,7 @@
 
         if (validateWhenUpdate(ownerId, filledUpdatedProjectForm)) {
             return badRequest(setting.render("title.projectSetting",
-                    filledUpdatedProjectForm, project, repository.getBranchNames()));
+                    filledUpdatedProjectForm, project, repository.getRefNames()));
         }
 
         Project updatedProject = filledUpdatedProjectForm.get();
app/models/Project.java
--- app/models/Project.java
+++ app/models/Project.java
@@ -224,7 +224,7 @@
     public Date lastUpdateDate() {
         try {
             PlayRepository repository = RepositoryService.getRepository(this);
-            List<String> branches = repository.getBranchNames();
+            List<String> branches = repository.getRefNames();
             if (!branches.isEmpty() && repository instanceof GitRepository) {
                 GitRepository gitRepo = new GitRepository(owner, name);
                 List<Commit> history = gitRepo.getHistory(0, 2, "HEAD", null);
app/playRepository/GitRepository.java
--- app/playRepository/GitRepository.java
+++ app/playRepository/GitRepository.java
@@ -842,7 +842,7 @@
      * @return a list of the name strings
      */
     @Override
-    public List<String> getBranchNames() {
+    public List<String> getRefNames() {
         List<String> branches = new ArrayList<>();
 
         for(String refName : repository.getAllRefs().keySet()) {
@@ -1821,7 +1821,7 @@
 
     @Override
     public boolean isEmpty() {
-        return this.getBranchNames().isEmpty();
+        return this.getRefNames().isEmpty();
     }
 
     /*
app/playRepository/PlayRepository.java
--- app/playRepository/PlayRepository.java
+++ app/playRepository/PlayRepository.java
@@ -56,7 +56,7 @@
 
     public abstract Commit getCommit(String rev) throws IOException, SVNException;
 
-    public abstract List<String> getBranchNames();
+    public abstract List<String> getRefNames();
 
     public abstract ObjectNode getMetaDataFromPath(String branch, String path) throws IOException, SVNException, GitAPIException;
 
app/playRepository/SVNRepository.java
--- app/playRepository/SVNRepository.java
+++ app/playRepository/SVNRepository.java
@@ -33,7 +33,6 @@
 import org.eclipse.jgit.diff.RawText;
 import org.joda.time.format.DateTimeFormatter;
 import org.joda.time.format.ISODateTimeFormat;
-import org.tigris.subversion.javahl.ClientException;
 import org.tmatesoft.svn.core.*;
 import org.tmatesoft.svn.core.io.SVNRepositoryFactory;
 import org.tmatesoft.svn.core.wc.SVNClientManager;
@@ -148,7 +147,7 @@
     @Override
     public ObjectNode getMetaDataFromPath(String branch, String path) throws
             IOException, SVNException {
-        List<String> branches = getBranchNames();
+        List<String> branches = getRefNames();
         if (!branches.contains(branch)) {
             return null;
         }
@@ -301,7 +300,7 @@
     }
 
     @Override
-    public List<String> getBranchNames() {
+    public List<String> getRefNames() {
         ArrayList<String> branches = new ArrayList<>();
         branches.add(SVNRevision.HEAD.getName());
         return branches;
app/views/code/history.scala.html
--- app/views/code/history.scala.html
+++ app/views/code/history.scala.html
@@ -95,7 +95,7 @@
 
                 @if(path == null){
                 <select id="branches" data-toggle="select2" data-format="branch" data-dropdown-css-class="branches" class="pull-right">
-                    @defining(RepositoryService.getRepository(project).getBranchNames()) { branches =>
+                    @defining(RepositoryService.getRepository(project).getRefNames()) { branches =>
                         @for(branchName <- branches){
                             <option value="@routes.CodeHistoryApp.history(project.owner, project.name, URLEncoder.encode(branchName, "UTF-8"), null)"
                                     @if(selectedBranch){ @if(branchItemName(branchName) == branchItemName(selectedBranch)){ selected } }>
app/views/code/svnDiff.scala.html
--- app/views/code/svnDiff.scala.html
+++ app/views/code/svnDiff.scala.html
@@ -39,7 +39,7 @@
                     <span class="d-caret"><span class="caret"></span></span>
                 </button>
                 <ul class="dropdown-menu">
-                @defining(RepositoryService.getRepository(project).getBranchNames()) { branches =>
+                @defining(RepositoryService.getRepository(project).getRefNames()) { branches =>
                     @for(branch <- branches){
                         @common.branchItem("history", project, branch, null,
                             utils.TemplateHelper.equals(branch, selectedBranch))
Add a comment
List