Browse Source

Implemented RPC administration of indexed branches

tags/v0.9.0
James Moger 12 years ago
parent
commit
e9de3f7fd5

+ 1
- 0
docs/02_rpc.mkd View File

@@ -63,6 +63,7 @@ The Gitblit API includes methods for retrieving and interpreting RSS feeds. The
<tr><th>Release</th><th>Protocol Version</th></tr>
<tr><td>Gitblit v0.7.0</td><td>1 (inferred version)</td></tr>
<tr><td>Gitblit v0.8.0</td><td>2</td></tr>
<tr><td>Gitblit v0.9.0</td><td>3</td></tr>
</tbody>
</table>

+ 1
- 1
src/com/gitblit/RpcServlet.java View File

@@ -49,7 +49,7 @@ public class RpcServlet extends JsonServlet {
private static final long serialVersionUID = 1L;
public static final int PROTOCOL_VERSION = 2;
public static final int PROTOCOL_VERSION = 3;
public RpcServlet() {
super();

+ 17
- 1
src/com/gitblit/client/EditRepositoryDialog.java View File

@@ -105,6 +105,8 @@ public class EditRepositoryDialog extends JDialog {
private JPalette<String> setsPalette;
private JPalette<String> teamsPalette;
private JPalette<String> indexedBranchesPalette;
private JPalette<String> preReceivePalette;
@@ -258,6 +260,12 @@ public class EditRepositoryDialog extends JDialog {
.add(newFieldPanel(Translation.get("gb.federationSets"),
setsPalette), BorderLayout.CENTER);
indexedBranchesPalette = new JPalette<String>();
JPanel indexedBranchesPanel = new JPanel(new BorderLayout(5, 5));
indexedBranchesPanel
.add(newFieldPanel(Translation.get("gb.indexedBranches"),
indexedBranchesPalette), BorderLayout.CENTER);
preReceivePalette = new JPalette<String>(true);
preReceiveInherited = new JLabel();
JPanel preReceivePanel = new JPanel(new BorderLayout(5, 5));
@@ -277,6 +285,9 @@ public class EditRepositoryDialog extends JDialog {
panel.addTab(Translation.get("gb.teams"), teamsPanel);
}
panel.addTab(Translation.get("gb.federation"), federationPanel);
if (protocolVersion >= 3) {
panel.addTab(Translation.get("gb.indexedBranches"), indexedBranchesPanel);
}
panel.addTab(Translation.get("gb.preReceiveScripts"), preReceivePanel);
panel.addTab(Translation.get("gb.postReceiveScripts"), postReceivePanel);
@@ -433,7 +444,8 @@ public class EditRepositoryDialog extends JDialog {
if (repository.federationStrategy.exceeds(FederationStrategy.EXCLUDE)) {
repository.federationSets = setsPalette.getSelections();
}
repository.indexedBranches = indexedBranchesPalette.getSelections();
repository.preReceiveScripts = preReceivePalette.getSelections();
repository.postReceiveScripts = postReceivePalette.getSelections();
return true;
@@ -470,6 +482,10 @@ public class EditRepositoryDialog extends JDialog {
public void setFederationSets(List<String> all, List<String> selected) {
setsPalette.setObjects(all, selected);
}
public void setIndexedBranches(List<String> all, List<String> selected) {
indexedBranchesPalette.setObjects(all, selected);
}
public void setPreReceiveScripts(List<String> all, List<String> inherited,
List<String> selected) {

+ 2
- 0
src/com/gitblit/client/RepositoriesPanel.java View File

@@ -357,6 +357,7 @@ public abstract class RepositoriesPanel extends JPanel {
dialog.setTeams(gitblit.getTeamnames(), null);
dialog.setRepositories(gitblit.getRepositories());
dialog.setFederationSets(gitblit.getFederationSets(), null);
dialog.setIndexedBranches(new ArrayList<String>(), null);
dialog.setPreReceiveScripts(gitblit.getPreReceiveScriptsUnused(null),
gitblit.getPreReceiveScriptsInherited(null), null);
dialog.setPostReceiveScripts(gitblit.getPostReceiveScriptsUnused(null),
@@ -419,6 +420,7 @@ public abstract class RepositoriesPanel extends JPanel {
dialog.setTeams(gitblit.getTeamnames(), gitblit.getPermittedTeamnames(repository));
dialog.setRepositories(gitblit.getRepositories());
dialog.setFederationSets(gitblit.getFederationSets(), repository.federationSets);
dialog.setIndexedBranches(repository.getLocalBranches(), repository.indexedBranches);
dialog.setPreReceiveScripts(gitblit.getPreReceiveScriptsUnused(repository),
gitblit.getPreReceiveScriptsInherited(repository), repository.preReceiveScripts);
dialog.setPostReceiveScripts(gitblit.getPostReceiveScriptsUnused(repository),

+ 14
- 0
src/com/gitblit/models/RepositoryModel.java View File

@@ -22,6 +22,7 @@ import java.util.List;
import com.gitblit.Constants.AccessRestrictionType;
import com.gitblit.Constants.FederationStrategy;
import com.gitblit.utils.ArrayUtils;
import com.gitblit.utils.StringUtils;
/**
@@ -77,6 +78,19 @@ public class RepositoryModel implements Serializable, Comparable<RepositoryModel
this.federationSets = new ArrayList<String>();
this.federationStrategy = FederationStrategy.FEDERATE_THIS;
}
public List<String> getLocalBranches() {
if (ArrayUtils.isEmpty(availableRefs)) {
return new ArrayList<String>();
}
List<String> localBranches = new ArrayList<String>();
for (String ref : availableRefs) {
if (ref.startsWith("refs/heads")) {
localBranches.add(ref);
}
}
return localBranches;
}
@Override
public String toString() {

+ 2
- 9
src/com/gitblit/wicket/pages/EditRepositoryPage.java View File

@@ -39,7 +39,6 @@ import org.apache.wicket.model.IModel;
import org.apache.wicket.model.Model;
import org.apache.wicket.model.util.CollectionModel;
import org.apache.wicket.model.util.ListModel;
import org.eclipse.jgit.lib.Constants;
import com.gitblit.Constants.AccessRestrictionType;
import com.gitblit.Constants.FederationStrategy;
@@ -117,14 +116,8 @@ public class EditRepositoryPage extends RootSubPage {
new StringChoiceRenderer(), 8, false);
// indexed local branches palette
List<String> allLocalBranches = new ArrayList<String>();
if (!ArrayUtils.isEmpty(repositoryModel.availableRefs)) {
for (String ref : repositoryModel.availableRefs) {
if (ref.startsWith(Constants.R_HEADS)) {
allLocalBranches.add(ref);
}
}
}
List<String> allLocalBranches = repositoryModel.getLocalBranches();
final Palette<String> indexedBranchesPalette = new Palette<String>("indexedBranches", new ListModel<String>(
indexedBranches), new CollectionModel<String>(allLocalBranches),
new StringChoiceRenderer(), 8, false);

Loading…
Cancel
Save