]> source.dussan.org Git - gitblit.git/commitdiff
Revised incremental push tags feature
authorJames Moger <james.moger@gitblit.com>
Mon, 1 Apr 2013 21:41:22 +0000 (17:41 -0400)
committerJames Moger <james.moger@gitblit.com>
Mon, 1 Apr 2013 21:41:22 +0000 (17:41 -0400)
13 files changed:
releases.moxie
src/main/distrib/data/gitblit.properties
src/main/java/com/gitblit/GitBlit.java
src/main/java/com/gitblit/GitServlet.java
src/main/java/com/gitblit/client/EditRepositoryDialog.java
src/main/java/com/gitblit/models/RepositoryModel.java
src/main/java/com/gitblit/utils/DiffUtils.java
src/main/java/com/gitblit/utils/JGitUtils.java
src/main/java/com/gitblit/wicket/GitBlitWebApp.properties
src/main/java/com/gitblit/wicket/pages/EditRepositoryPage.html
src/main/java/com/gitblit/wicket/pages/EditRepositoryPage.java
src/test/java/com/gitblit/tests/GitBlitSuite.java
src/test/java/com/gitblit/tests/GitServletTest.java

index 15c7da9b30b0c07d74899618a919b39973599cc0..bb6b0d16f82051bf5406b8ade5ff06381abf8e7b 100644 (file)
@@ -24,12 +24,13 @@ r17: {
         - Use standard ServletRequestWrapper instead of custom wrapper (issue 224)\r
 \r
     additions: \r
-        - Support --baseFolder parameter in Federation Client\r
+        - Option to automatically tag branch tips on each push with an incremental revision number\r
+     - Implemented multiple repository owners\r
      - Optional periodic LDAP user and team pre-fetching & synchronization\r
      - Display name and version in Tomcat Manager\r
      - FogBugz post-receive hook script\r
-     - Implemented multiple repository owners\r
      - Chinese translation\r
+        - Support --baseFolder parameter in Federation Client\r
         - Added weblogic.xml to WAR for deployment on WebLogic (issue 199)\r
         - Support username substitution in web.otherUrls (issue 213)\r
         - Option to force client-side basic authentication instead of form-based authentication if web.authenticateViewPages=true (issue 222)\r
@@ -59,6 +60,9 @@ r17: {
        \r
        dependencyChanges:\r
        - JGit 2.3.1.201302201838-r\r
+       \r
+       settings:\r
+    - { name: 'git.defaultIncrementalPushTagPrefix', defaultValue: 'r' }\r
 }\r
 \r
 #\r
index 8c90258bdc33c15fd69fe164a2221aa4e56a2376..c881f14f923d179f550b4ff186c67b479c3c1356 100644 (file)
@@ -146,6 +146,17 @@ git.defaultAccessRestriction = NONE
 # SINCE 1.1.0\r
 git.defaultAuthorizationControl = NAMED\r
 \r
+# The default incremental push tag prefix.  Tag prefix applied to a repository\r
+# that has automatic push tags enabled and does not specify a custom tag prefix.\r
+#\r
+# If incremental push tags are enabled, the tips of each branch in the push will\r
+# be tagged with an increasing revision integer.\r
+#\r
+# e.g. refs/tags/r2345 or refs/tags/rev_2345 \r
+#\r
+# SINCE 1.3.0\r
+git.defaultIncrementalPushTagPrefix = r\r
+\r
 # Enable JGit-based garbage collection. (!!EXPERIMENTAL!!)\r
 #\r
 # USE AT YOUR OWN RISK!\r
index 6d44f4612fad4d4f0502e9071395f5b1b2a883b8..1a817ab76e89d4ea518a0ecd7af7a2d0818016cb 100644 (file)
@@ -1676,7 +1676,8 @@ public class GitBlit implements ServletContextListener {
                        model.addOwners(ArrayUtils.fromString(getConfig(config, "owner", "")));\r
                        model.useTickets = getConfig(config, "useTickets", false);\r
                        model.useDocs = getConfig(config, "useDocs", false);\r
-                       model.useIncrementalRevisionNumbers = getConfig(config, "useIncrementalRevisionNumbers", false);\r
+                       model.useIncrementalPushTags = getConfig(config, "useIncrementalPushTags", false);\r
+                       model.incrementalPushTagPrefix = getConfig(config, "incrementalPushTagPrefix", null);\r
                        model.allowForks = getConfig(config, "allowForks", true);\r
                        model.accessRestriction = AccessRestrictionType.fromName(getConfig(config,\r
                                        "accessRestriction", settings.getString(Keys.git.defaultAccessRestriction, null)));\r
@@ -2198,7 +2199,13 @@ public class GitBlit implements ServletContextListener {
                config.setString(Constants.CONFIG_GITBLIT, null, "owner", ArrayUtils.toString(repository.owners));\r
                config.setBoolean(Constants.CONFIG_GITBLIT, null, "useTickets", repository.useTickets);\r
                config.setBoolean(Constants.CONFIG_GITBLIT, null, "useDocs", repository.useDocs);\r
-               config.setBoolean(Constants.CONFIG_GITBLIT, null, "useIncrementalRevisionNumbers", repository.useIncrementalRevisionNumbers);\r
+               config.setBoolean(Constants.CONFIG_GITBLIT, null, "useIncrementalPushTags", repository.useIncrementalPushTags);\r
+               if (StringUtils.isEmpty(repository.incrementalPushTagPrefix) ||\r
+                               repository.incrementalPushTagPrefix.equals(settings.getString(Keys.git.defaultIncrementalPushTagPrefix, "r"))) {\r
+                       config.unset(Constants.CONFIG_GITBLIT, null, "incrementalPushTagPrefix");\r
+               } else {\r
+                       config.setString(Constants.CONFIG_GITBLIT, null, "incrementalPushTagPrefix", repository.incrementalPushTagPrefix);\r
+               }\r
                config.setBoolean(Constants.CONFIG_GITBLIT, null, "allowForks", repository.allowForks);\r
                config.setString(Constants.CONFIG_GITBLIT, null, "accessRestriction", repository.accessRestriction.name());\r
                config.setString(Constants.CONFIG_GITBLIT, null, "authorizationControl", repository.authorizationControl.name());\r
index cb47b3238004b06197450e70947a2d6d1cefa462..b64e44e59259a6df44e5b94d378ef4365afe1e3a 100644 (file)
@@ -23,7 +23,6 @@ import java.io.IOException;
 import java.text.MessageFormat;\r
 import java.util.Collection;\r
 import java.util.Enumeration;\r
-import java.util.Iterator;\r
 import java.util.LinkedHashSet;\r
 import java.util.List;\r
 import java.util.Map;\r
@@ -33,9 +32,7 @@ import javax.servlet.ServletConfig;
 import javax.servlet.ServletContext;\r
 import javax.servlet.ServletException;\r
 import javax.servlet.http.HttpServletRequest;\r
-import javax.servlet.http.Part;\r
 \r
-import org.eclipse.jgit.api.Git;\r
 import org.eclipse.jgit.http.server.resolver.DefaultReceivePackFactory;\r
 import org.eclipse.jgit.http.server.resolver.DefaultUploadPackFactory;\r
 import org.eclipse.jgit.lib.PersonIdent;\r
@@ -55,6 +52,7 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;\r
 \r
 import com.gitblit.Constants.AccessRestrictionType;\r
+import com.gitblit.client.Translation;\r
 import com.gitblit.models.RepositoryModel;\r
 import com.gitblit.models.UserModel;\r
 import com.gitblit.utils.ClientLogger;\r
@@ -297,26 +295,41 @@ public class GitServlet extends org.eclipse.jgit.http.server.GitServlet {
                                return;\r
                        }\r
 \r
-                       UserModel user = getUserModel(rp);\r
+                       UserModel user = getUserModel(rp);                      \r
                        RepositoryModel repository = GitBlit.self().getRepositoryModel(repositoryName);\r
                        \r
-                       if (repository.useIncrementalRevisionNumbers) {\r
-                               List<ReceiveCommand> allCommands = rp.getAllCommands();\r
-                               String cmds = "";\r
-                               for (ReceiveCommand receiveCommand : allCommands) {\r
-                                       cmds += receiveCommand.getType() + "_"\r
-                                                       + receiveCommand.getResult() + "_"\r
-                                                       + receiveCommand.getMessage() + ", ";\r
-                                       if (receiveCommand.getType().equals(\r
-                                                       ReceiveCommand.Type.UPDATE)\r
-                                                       && receiveCommand.getResult().equals(\r
-                                                                       ReceiveCommand.Result.OK)) {\r
-                                               // if type=update and update was ok, autotag\r
-                                               String objectId = receiveCommand.getNewId().toString()\r
-                                                               .replace("AnyObjectId[", "").replace("]", "");\r
-                                               boolean result = JGitUtils\r
-                                                               .createIncrementalRevisionTag(\r
-                                                                               rp.getRepository(), objectId);                                          \r
+                       if (repository.useIncrementalPushTags) {\r
+                               // tag each pushed branch tip\r
+                               String emailAddress = user.emailAddress == null ? rp.getRefLogIdent().getEmailAddress() : user.emailAddress;\r
+                               PersonIdent userIdent = new PersonIdent(user.getDisplayName(), emailAddress);\r
+\r
+                               for (ReceiveCommand cmd : commands) {\r
+                                       if (!cmd.getRefName().startsWith("refs/heads/")) {\r
+                                               // only tag branch ref changes\r
+                                               continue;\r
+                                       }\r
+                                       \r
+                                       if (!ReceiveCommand.Type.DELETE.equals(cmd.getType())\r
+                                                       && ReceiveCommand.Result.OK.equals(cmd.getResult())) {\r
+                                               String objectId = cmd.getNewId().getName();\r
+                                               String branch = cmd.getRefName().substring("refs/heads/".length());\r
+                                               // get translation based on the server's locale setting\r
+                                               String template = Translation.get("gb.incrementalPushTagMessage");\r
+                                               String msg = MessageFormat.format(template, branch);\r
+                                               String prefix;\r
+                                               if (StringUtils.isEmpty(repository.incrementalPushTagPrefix)) {\r
+                                                       prefix = GitBlit.getString(Keys.git.defaultIncrementalPushTagPrefix, "r");\r
+                                               } else {\r
+                                                       prefix = repository.incrementalPushTagPrefix;\r
+                                               }\r
+                                               \r
+                                               JGitUtils.createIncrementalRevisionTag(\r
+                                                                       rp.getRepository(),\r
+                                                                       objectId,\r
+                                                                       userIdent,\r
+                                                                       prefix,\r
+                                                                       "0",\r
+                                                                       msg);\r
                                        }\r
                                }                               \r
                        }\r
@@ -332,6 +345,9 @@ public class GitServlet extends org.eclipse.jgit.http.server.GitServlet {
                                        case CREATE:\r
                                                logger.info(MessageFormat.format("{0} CREATED {1} in {2}", user.username, cmd.getRefName(), repository.name));\r
                                                break;\r
+                                       case UPDATE:\r
+                                               logger.info(MessageFormat.format("{0} UPDATED {1} in {2} (from {3} to {4})", user.username, cmd.getRefName(), repository.name, cmd.getOldId().name(), cmd.getNewId().name()));\r
+                                               break;\r
                                        case UPDATE_NONFASTFORWARD:\r
                                                logger.info(MessageFormat.format("{0} UPDATED NON-FAST-FORWARD {1} in {2} (from {3} to {4})", user.username, cmd.getRefName(), repository.name, cmd.getOldId().name(), cmd.getNewId().name()));\r
                                                break;\r
index 25f42f4a2e01ae69193220fc2529e9fb8b921c4b..118c5c828af510f543a463beeb17d6390db365eb 100644 (file)
@@ -92,7 +92,7 @@ public class EditRepositoryDialog extends JDialog {
 \r
        private JCheckBox useDocs;\r
 \r
-       private JCheckBox useIncrementalRevisionNumbers;\r
+       private JCheckBox useIncrementalPushTags;\r
        \r
        private JCheckBox showRemoteBranches;\r
 \r
@@ -214,8 +214,8 @@ public class EditRepositoryDialog extends JDialog {
                                anRepository.useTickets);\r
                useDocs = new JCheckBox(Translation.get("gb.useDocsDescription"),\r
                                anRepository.useDocs);\r
-               useIncrementalRevisionNumbers = new JCheckBox(Translation.get("gb.useIncrementalRevisionNumbersDescription"),\r
-                               anRepository.useIncrementalRevisionNumbers);\r
+               useIncrementalPushTags = new JCheckBox(Translation.get("gb.useIncrementalPushTagsDescription"),\r
+                               anRepository.useIncrementalPushTags);\r
                showRemoteBranches = new JCheckBox(\r
                                Translation.get("gb.showRemoteBranchesDescription"),\r
                                anRepository.showRemoteBranches);\r
@@ -314,7 +314,7 @@ public class EditRepositoryDialog extends JDialog {
                fieldsPanel\r
                                .add(newFieldPanel(Translation.get("gb.enableDocs"), useDocs));\r
                fieldsPanel\r
-               .add(newFieldPanel(Translation.get("gb.enableIncrementalRevisionNumbers"), useIncrementalRevisionNumbers));\r
+               .add(newFieldPanel(Translation.get("gb.enableIncrementalPushTags"), useIncrementalPushTags));\r
                fieldsPanel.add(newFieldPanel(Translation.get("gb.showRemoteBranches"),\r
                                showRemoteBranches));\r
                fieldsPanel.add(newFieldPanel(Translation.get("gb.showReadme"),\r
@@ -569,7 +569,7 @@ public class EditRepositoryDialog extends JDialog {
                repository.gcThreshold = gcThreshold.getText();\r
                repository.useTickets = useTickets.isSelected();\r
                repository.useDocs = useDocs.isSelected();\r
-               repository.useIncrementalRevisionNumbers = useIncrementalRevisionNumbers.isSelected();\r
+               repository.useIncrementalPushTags = useIncrementalPushTags.isSelected();\r
                repository.showRemoteBranches = showRemoteBranches.isSelected();\r
                repository.showReadme = showReadme.isSelected();\r
                repository.skipSizeCalculation = skipSizeCalculation.isSelected();\r
index 1f2ee2df64110fceb19d4615397cd07581a4e00e..5c906e5ef50a2be32742928a10950b685f121d3c 100644 (file)
@@ -50,7 +50,8 @@ public class RepositoryModel implements Serializable, Comparable<RepositoryModel
        public boolean showRemoteBranches;\r
        public boolean useTickets;\r
        public boolean useDocs;\r
-       public boolean useIncrementalRevisionNumbers;\r
+       public boolean useIncrementalPushTags;\r
+       public String incrementalPushTagPrefix;\r
        public AccessRestrictionType accessRestriction;\r
        public AuthorizationControl authorizationControl;\r
        public boolean allowAuthenticated;\r
@@ -202,7 +203,6 @@ public class RepositoryModel implements Serializable, Comparable<RepositoryModel
                clone.showRemoteBranches = false;\r
                clone.allowForks = false;\r
                clone.useDocs = useDocs;\r
-               clone.useIncrementalRevisionNumbers = useIncrementalRevisionNumbers;\r
                clone.useTickets = useTickets;\r
                clone.skipSizeCalculation = skipSizeCalculation;\r
                clone.skipSummaryMetrics = skipSummaryMetrics;\r
index 04b5b0b1c7ef888505901ebba3de6ccabccfb5aa..67871d2234829ebdcc62a04f2f519b70a52c7d1a 100644 (file)
@@ -16,6 +16,7 @@
 package com.gitblit.utils;\r
 \r
 import java.io.ByteArrayOutputStream;\r
+import java.text.MessageFormat;\r
 import java.util.ArrayList;\r
 import java.util.List;\r
 \r
@@ -274,7 +275,7 @@ public class DiffUtils {
                                lines.add(line);\r
                        }\r
                } catch (Throwable t) {\r
-                       LOGGER.error("failed to generate blame!", t);\r
+                       LOGGER.error(MessageFormat.format("failed to generate blame for {0} {1}!", blobPath, objectId), t);\r
                }\r
                return lines;\r
        }\r
index 4326700df28231a3665080b82cb0184b0217fcf1..c3aae275b31eeed775df492de8b8cb48dc8a53c7 100644 (file)
@@ -19,6 +19,7 @@ import java.io.ByteArrayOutputStream;
 import java.io.File;\r
 import java.io.IOException;\r
 import java.io.InputStream;\r
+import java.text.DecimalFormat;\r
 import java.text.MessageFormat;\r
 import java.util.ArrayList;\r
 import java.util.Arrays;\r
@@ -82,8 +83,6 @@ import org.eclipse.jgit.util.io.DisabledOutputStream;
 import org.slf4j.Logger;\r
 import org.slf4j.LoggerFactory;\r
 \r
-import com.gitblit.GitBlit;\r
-import com.gitblit.Keys;\r
 import com.gitblit.models.GitNote;\r
 import com.gitblit.models.PathModel;\r
 import com.gitblit.models.PathModel.PathChangeModel;\r
@@ -98,7 +97,6 @@ import com.gitblit.models.SubmoduleModel;
  */\r
 public class JGitUtils {\r
 \r
-       private static final String REVISION_TAG_PREFIX = "rev_";\r
        static final Logger LOGGER = LoggerFactory.getLogger(JGitUtils.class);\r
 \r
        /**\r
@@ -1692,59 +1690,58 @@ public class JGitUtils {
                }\r
                return list;\r
        }\r
-       \r
+\r
        /**\r
         * this method creates an incremental revision number as a tag according to\r
-        * the amount of already existing tags, which start with a defined prefix {@link REVISION_TAG_PREFIX}\r
+        * the amount of already existing tags, which start with a defined prefix.\r
         * \r
         * @param repository\r
         * @param objectId\r
+        * @param tagger\r
+        * @param prefix\r
+        * @param intPattern\r
+        * @param message\r
         * @return true if operation was successful, otherwise false\r
         */\r
-       public static boolean createIncrementalRevisionTag(Repository repository, String objectId) {\r
+       public static boolean createIncrementalRevisionTag(Repository repository,\r
+                       String objectId, PersonIdent tagger, String prefix, String intPattern, String message) {\r
                boolean result = false;\r
                Iterator<Entry<String, Ref>> iterator = repository.getTags().entrySet().iterator();\r
-               long revisionNumber = 1;\r
+               long lastRev = 0;\r
                while (iterator.hasNext()) {\r
                        Entry<String, Ref> entry = iterator.next();\r
-                       if (entry.getKey().startsWith(REVISION_TAG_PREFIX)) {\r
-                               revisionNumber++;\r
+                       if (entry.getKey().startsWith(prefix)) {\r
+                               try {\r
+                                       long val = Long.parseLong(entry.getKey().substring(prefix.length()));\r
+                                       if (val > lastRev) {\r
+                                               lastRev = val;\r
+                                       }\r
+                               } catch (Exception e) {\r
+                                       // this tag is NOT an incremental revision tag\r
+                               }\r
                        }\r
                }\r
-               result = createTag(repository,REVISION_TAG_PREFIX+revisionNumber,objectId);\r
+               DecimalFormat df = new DecimalFormat(intPattern);\r
+               result = createTag(repository, objectId, tagger, prefix + df.format((lastRev + 1)), message);\r
                return result;\r
        }\r
 \r
-       /**\r
-        * creates a tag in a repository referring to the current head\r
-        * \r
-        * @param repository\r
-        * @param tag, the string label\r
-        * @return boolean, true if operation was successful, otherwise false\r
-        */\r
-       public static boolean createTag(Repository repository, String tag) {\r
-               return createTag(repository, tag, null);\r
-       }\r
-       \r
        /**\r
         * creates a tag in a repository\r
         * \r
         * @param repository\r
-        * @param tag, the string label\r
         * @param objectId, the ref the tag points towards\r
+        * @param tagger, the person tagging the object\r
+        * @param tag, the string label\r
+        * @param message, the string message\r
         * @return boolean, true if operation was successful, otherwise false\r
         */\r
-       public static boolean createTag(Repository repository, String tag,\r
-                       String objectId) {\r
+       public static boolean createTag(Repository repository, String objectId, PersonIdent tagger, String tag, String message) {\r
                try {                   \r
-                       PersonIdent author = new PersonIdent("GitblitAutoTagPush",\r
-                                       "gitblit@localhost");\r
-\r
-                       LOGGER.debug("createTag in repo: "+repository.getDirectory().getAbsolutePath());\r
                        Git gitClient = Git.open(repository.getDirectory());\r
                        TagCommand tagCommand = gitClient.tag();\r
-                       tagCommand.setTagger(author);\r
-                       tagCommand.setMessage("autotag");\r
+                       tagCommand.setTagger(tagger);\r
+                       tagCommand.setMessage(message);\r
                        if (objectId != null) {\r
                                RevObject revObj = getCommit(repository, objectId);\r
                                tagCommand.setObjectId(revObj);\r
@@ -1753,7 +1750,7 @@ public class JGitUtils {
                        Ref call = tagCommand.call();                   \r
                        return call != null ? true : false;\r
                } catch (Exception e) {\r
-                       e.printStackTrace();\r
+                       error(e, repository, "Failed to create tag {1} in repository {0}", objectId, tag);\r
                }\r
                return false;\r
        }\r
index 81eecb2bdb4ba569c7d3c08e4bb999d76d1cfa62..f2d4a36cf4c7dc9369321acaa949de107b226e89 100644 (file)
@@ -73,7 +73,6 @@ gb.accessRestriction = access restriction
 gb.name = name\r
 gb.enableTickets = enable tickets\r
 gb.enableDocs = enable docs\r
-gb.enableIncrementalRevisionNumbers = enable incremental revision numbers\r
 gb.save = save\r
 gb.showRemoteBranches = show remote branches\r
 gb.editUsers = edit users\r
@@ -86,7 +85,6 @@ gb.cloneRestricted = authenticated clone & push
 gb.viewRestricted = authenticated view, clone, & push\r
 gb.useTicketsDescription = readonly, distributed Ticgit issues\r
 gb.useDocsDescription = enumerates Markdown documentation in repository\r
-gb.useIncrementalRevisionNumbersDescription = automatic tagging of each push with an incremental revision number\r
 gb.showRemoteBranchesDescription = show remote branches\r
 gb.canAdminDescription = can administer Gitblit server\r
 gb.permittedUsers = permitted users\r
@@ -448,3 +446,6 @@ gb.owners = owners
 gb.sessionEnded = Session has been closed\r
 gb.closeBrowser = Please close the browser to properly end the session.\r
 gb.doesNotExistInTree = {0} does not exist in tree {1}
+gb.enableIncrementalPushTags = enable incremental push tags\r
+gb.useIncrementalPushTagsDescription = on push, automatically tag each branch tip with an incremental revision number\r
+gb.incrementalPushTagMessage = Auto-tagged [{0}] branch on push
\ No newline at end of file
index 37ea0dd25c04f10864c4bc7e45da9bced5bee433..f8ecb992d4aeeb5f0d91c4a583e91752fabf597a 100644 (file)
@@ -35,7 +35,7 @@
                                <tr><th colspan="2"><hr/></th></tr>\r
                                <tr><th><wicket:message key="gb.enableTickets"></wicket:message></th><td class="edit"><label class="checkbox"><input type="checkbox" wicket:id="useTickets" tabindex="7" /> &nbsp;<span class="help-inline"><wicket:message key="gb.useTicketsDescription"></wicket:message></span></label></td></tr>\r
                                <tr><th><wicket:message key="gb.enableDocs"></wicket:message></th><td class="edit"><label class="checkbox"><input type="checkbox" wicket:id="useDocs" tabindex="8" /> &nbsp;<span class="help-inline"><wicket:message key="gb.useDocsDescription"></wicket:message></span></label></td></tr>\r
-                               <tr><th><wicket:message key="gb.enableIncrementalRevisionNumbers"></wicket:message></th><td class="edit"><label class="checkbox"><input type="checkbox" wicket:id="useIncrementalRevisionNumbers" tabindex="8" /> &nbsp;<span class="help-inline"><wicket:message key="gb.useIncrementalRevisionNumbersDescription"></wicket:message></span></label></td></tr>\r
+                               <tr><th><wicket:message key="gb.enableIncrementalPushTags"></wicket:message></th><td class="edit"><label class="checkbox"><input type="checkbox" wicket:id="useIncrementalPushTags" tabindex="8" /> &nbsp;<span class="help-inline"><wicket:message key="gb.useIncrementalPushTagsDescription"></wicket:message></span></label></td></tr>\r
                                <tr><th><wicket:message key="gb.showRemoteBranches"></wicket:message></th><td class="edit"><label class="checkbox"><input type="checkbox" wicket:id="showRemoteBranches" tabindex="9" /> &nbsp;<span class="help-inline"><wicket:message key="gb.showRemoteBranchesDescription"></wicket:message></span></label></td></tr>\r
                                <tr><th><wicket:message key="gb.showReadme"></wicket:message></th><td class="edit"><label class="checkbox"><input type="checkbox" wicket:id="showReadme" tabindex="10" /> &nbsp;<span class="help-inline"><wicket:message key="gb.showReadmeDescription"></wicket:message></span></label></td></tr>\r
                                <tr><th><wicket:message key="gb.skipSizeCalculation"></wicket:message></th><td class="edit"><label class="checkbox"><input type="checkbox" wicket:id="skipSizeCalculation" tabindex="11" /> &nbsp;<span class="help-inline"><wicket:message key="gb.skipSizeCalculationDescription"></wicket:message></span></label></td></tr>\r
index 2cbb88cc4b0c2d4551b685c75d687c3a9a55d2d3..58d3390c35d5255eb6b14670f9c78297aa1f3677 100644 (file)
@@ -422,7 +422,7 @@ public class EditRepositoryPage extends RootSubPage {
                                new FederationTypeRenderer()));\r
                form.add(new CheckBox("useTickets"));\r
                form.add(new CheckBox("useDocs"));\r
-               form.add(new CheckBox("useIncrementalRevisionNumbers"));\r
+               form.add(new CheckBox("useIncrementalPushTags"));\r
                form.add(new CheckBox("showRemoteBranches"));\r
                form.add(new CheckBox("showReadme"));\r
                form.add(new CheckBox("skipSizeCalculation"));\r
index b0179c37cc4a535b5a668d09d04bf20802231e00..64d792ec9662581fa55ac4d983d2f25801d0ad91 100644 (file)
@@ -153,7 +153,9 @@ public class GitBlitSuite {
                        enableTickets("ticgit.git");\r
                        enableDocs("ticgit.git");\r
                        showRemoteBranches("ticgit.git");\r
+                       automaticallyTagBranchTips("ticgit.git");\r
                        showRemoteBranches("test/jgit.git");\r
+                       automaticallyTagBranchTips("test/jgit.git");    \r
                }\r
        }\r
 \r
@@ -198,6 +200,16 @@ public class GitBlitSuite {
                }\r
        }\r
        \r
+       private static void automaticallyTagBranchTips(String repositoryName) {\r
+               try {\r
+                       RepositoryModel model = GitBlit.self().getRepositoryModel(repositoryName);\r
+                       model.useIncrementalPushTags = true;\r
+                       GitBlit.self().updateRepositoryModel(model.name, model, false);\r
+               } catch (GitBlitException g) {\r
+                       g.printStackTrace();\r
+               }\r
+       }\r
+       \r
        public static void close(File repository) {\r
                try {\r
                        File gitDir = FileKey.resolve(repository, FS.detect());\r
index a05b3650bcf2a976cc523772890df1fd0c33bb0e..8d1fa104c79f20261247536059593a0b69f41641 100644 (file)
@@ -248,7 +248,7 @@ public class GitServletTest {
                w.close();\r
                git.add().addFilepattern(file.getName()).call();\r
                git.commit().setMessage("test commit").call();\r
-               git.push().setPushAll().call();\r
+               git.push().setPushAll().setCredentialsProvider(new UsernamePasswordCredentialsProvider(account, password)).call();\r
                GitBlitSuite.close(git);\r
        }\r
        \r
@@ -283,7 +283,7 @@ public class GitServletTest {
                git.commit().setMessage("test commit").call();\r
                \r
                try {\r
-                       git.push().setPushAll().call();\r
+                       git.push().setPushAll().setCredentialsProvider(new UsernamePasswordCredentialsProvider(account, password)).call();\r
                        assertTrue(false);\r
                } catch (Exception e) {\r
                        assertTrue(e.getCause().getMessage().contains("access forbidden"));\r
@@ -293,7 +293,7 @@ public class GitServletTest {
                model.isFrozen = false;\r
                GitBlit.self().updateRepositoryModel(model.name, model, false);\r
 \r
-               git.push().setPushAll().call();\r
+               git.push().setPushAll().setCredentialsProvider(new UsernamePasswordCredentialsProvider(account, password)).call();\r
                GitBlitSuite.close(git);\r
        }\r
        \r
@@ -317,7 +317,7 @@ public class GitServletTest {
                git.add().addFilepattern(file.getName()).call();\r
                git.commit().setMessage("test commit followed by push to non-bare repository").call();\r
                try {\r
-                       git.push().setPushAll().call();\r
+                       git.push().setPushAll().setCredentialsProvider(new UsernamePasswordCredentialsProvider(account, password)).call();\r
                        assertTrue(false);\r
                } catch (Exception e) {\r
                        assertTrue(e.getCause().getMessage().contains("git-receive-pack not permitted"));\r