branch feature/GIT updated (635def1 -> de7e177)
This is an automated email from the git hooks/post-receive script. New change to branch feature/GIT in repository scmwebeditor. See http://git.nuiton.org/scmwebeditor.git from 635def1 Changed the editor's style for RST files and translated french comments to english new de7e177 Corrected a few bugs The 1 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "adds" were already present in the repository and have only been added to this reference. Detailed log of new commits: commit de7e177c9afd20ba1917381eae8e5d4abae30c31 Author: Hugo PIGEON <hpigeon@codelutin.com> Date: Thu Apr 30 16:25:06 2015 +0200 Corrected a few bugs Summary of changes: .../org/nuiton/scmwebeditor/GitConnection.java | 33 ++++++++++++++-------- .../nuiton/scmwebeditor/ScmWebEditorConfig.java | 22 ++++----------- .../scmwebeditor/ScmWebEditorConfigOption.java | 8 +++--- .../org/nuiton/scmwebeditor/SvnConnection.java | 6 ++-- .../actions/ScmWebEditorMainAction.java | 14 +++++++-- .../nuiton/scmwebeditor/actions/SearchAction.java | 6 ++++ src/main/resources/scmwebeditor.properties | 8 +++--- src/main/webapp/WEB-INF/content/search.jsp | 33 +++++++++++++--------- src/main/webapp/css/main.css | 4 +++ 9 files changed, 78 insertions(+), 56 deletions(-) -- To stop receiving notification emails like this one, please contact nuiton.org SCM administrator <admin+scm@nuiton.org>.
This is an automated email from the git hooks/post-receive script. New commit to branch feature/GIT in repository scmwebeditor. See http://git.nuiton.org/scmwebeditor.git commit de7e177c9afd20ba1917381eae8e5d4abae30c31 Author: Hugo PIGEON <hpigeon@codelutin.com> Date: Thu Apr 30 16:25:06 2015 +0200 Corrected a few bugs --- .../org/nuiton/scmwebeditor/GitConnection.java | 33 ++++++++++++++-------- .../nuiton/scmwebeditor/ScmWebEditorConfig.java | 22 ++++----------- .../scmwebeditor/ScmWebEditorConfigOption.java | 8 +++--- .../org/nuiton/scmwebeditor/SvnConnection.java | 6 ++-- .../actions/ScmWebEditorMainAction.java | 14 +++++++-- .../nuiton/scmwebeditor/actions/SearchAction.java | 6 ++++ src/main/resources/scmwebeditor.properties | 8 +++--- src/main/webapp/WEB-INF/content/search.jsp | 33 +++++++++++++--------- src/main/webapp/css/main.css | 4 +++ 9 files changed, 78 insertions(+), 56 deletions(-) diff --git a/src/main/java/org/nuiton/scmwebeditor/GitConnection.java b/src/main/java/org/nuiton/scmwebeditor/GitConnection.java index b35ec22..6369c42 100644 --- a/src/main/java/org/nuiton/scmwebeditor/GitConnection.java +++ b/src/main/java/org/nuiton/scmwebeditor/GitConnection.java @@ -80,9 +80,23 @@ public class GitConnection implements ScmConnection { log.debug("Git repository"); } - if (address.contains(".git")) { + if (address.equals(".git")) { + throw new IOException("Can not reach Git repository"); + } else if (address.contains(".git")) { addressGit = address.substring(0, address.indexOf(".git") + 4); fileName = address.substring(address.indexOf(".git") + 4); + } else if (address.startsWith("git://")) { + String lastPart = address.substring(address.lastIndexOf("/") + 1); + + if (lastPart.contains(".")) { + // if the path is for a file + addressGit = address.substring(0, address.length() - lastPart.length() - 1); + fileName = address.substring(address.lastIndexOf("/") + 1); + } else { + // if the path is for a directory + addressGit = address; + fileName = ""; + } } else { addressGit = address; fileName = address.substring(address.lastIndexOf("/") + 1); @@ -219,7 +233,8 @@ public class GitConnection implements ScmConnection { treeWalk.setRecursive(false); // the directories we have to open to find the requested url - ArrayList<String> dirs = Lists.newArrayList(url.substring(url.indexOf(".git") + 4).split("/")); + String path = url.substring(url.indexOf(".git") + 4); + ArrayList<String> dirs = Lists.newArrayList(path.split("/")); while (treeWalk.next()) { @@ -267,11 +282,9 @@ public class GitConnection implements ScmConnection { } if (action.getDirectories() != null) { - Iterator<Map.Entry<String, String>> iter1 = action.getDirectories().entrySet().iterator(); - while (iter1.hasNext()) { - Map.Entry<String, String> ent = (Map.Entry<String, String>) iter1.next(); + for (Map.Entry<String, String> entry : action.getDirectories().entrySet()) { - String value = ent.getValue(); + String value = entry.getValue(); TreeNode node = new TreeNode(); node.setId(value); @@ -822,10 +835,6 @@ public class GitConnection implements ScmConnection { if (cloneNeeded) { - if (log.isDebugEnabled()) { - log.debug("Cloning : username == " + username + " ; password == " + password); - } - CredentialsProvider credentials = new UsernamePasswordCredentialsProvider(username, password); CloneCommand clone = Git.cloneRepository(); @@ -842,7 +851,7 @@ public class GitConnection implements ScmConnection { } catch (TransportException e) { FileUtils.deleteDirectory(localDirectory); if (log.isErrorEnabled()) { - log.error("Can't clone the remote repository", e); + log.error("Can't clone the remote repository: " + addressGit, e); } if (e.getMessage().endsWith("500 Internal Server Error")) { @@ -861,7 +870,7 @@ public class GitConnection implements ScmConnection { if (log.isDebugEnabled()) { - log.debug("Connection to local repostitory"); + log.debug("Connection to local repository"); } // Connection to the local repository diff --git a/src/main/java/org/nuiton/scmwebeditor/ScmWebEditorConfig.java b/src/main/java/org/nuiton/scmwebeditor/ScmWebEditorConfig.java index d34f2d3..578b8f1 100644 --- a/src/main/java/org/nuiton/scmwebeditor/ScmWebEditorConfig.java +++ b/src/main/java/org/nuiton/scmwebeditor/ScmWebEditorConfig.java @@ -56,33 +56,23 @@ public class ScmWebEditorConfig { } public static List<String> getEditableFiles() { - return getEditableFiles(getConfig()); + return getConfig().getOptionAsList(ScmWebEditorConfigOption.EDITABLE_FILES.getKey()).getOption(); } - public static List<String> getEditableFiles(ApplicationConfig config) { - return config.getOptionAsList(ScmWebEditorConfigOption.EDITABLESFILES.getKey()).getOption(); - } - - public static String getLocalRepositoriesPath() { return getLocalRepositoriesPath(getConfig()); } + public static String getLocalRepositoriesPath() { - public static String getLocalRepositoriesPath(ApplicationConfig config) { String key = ScmWebEditorConfigOption.LOCAL_REPOSITORIES_PATH.getKey(); - return config.getOption(key); + return getConfig().getOption(key); } - public static List<String> getSupportedScms() { return getSupportedScms(getConfig()); } + public static List<String> getSupportedScms() { - public static List<String> getSupportedScms(ApplicationConfig config) { String key = ScmWebEditorConfigOption.SUPPORTED_SCMS.getKey(); - return Arrays.asList(config.getOption(key).split(",")); + return getConfig().getOptionAsList(key).getOption(); } public static String getKey() { - return getKey(getConfig()); - } - - public static String getKey(ApplicationConfig config) { - return config.getOption(ScmWebEditorConfigOption.COOKIES_PRIVATE_KEY.getKey()); + return getConfig().getOption(ScmWebEditorConfigOption.COOKIES_PRIVATE_KEY.getKey()); } diff --git a/src/main/java/org/nuiton/scmwebeditor/ScmWebEditorConfigOption.java b/src/main/java/org/nuiton/scmwebeditor/ScmWebEditorConfigOption.java index e22a3ad..dac5a80 100644 --- a/src/main/java/org/nuiton/scmwebeditor/ScmWebEditorConfigOption.java +++ b/src/main/java/org/nuiton/scmwebeditor/ScmWebEditorConfigOption.java @@ -27,10 +27,10 @@ import org.nuiton.config.ConfigOptionDef; public enum ScmWebEditorConfigOption implements ConfigOptionDef { CONFIG_FILE(ApplicationConfig.CONFIG_FILE_NAME, "The file name", "scmwebeditor.properties", String.class, false, false), - EDITABLESFILES("editableFiles", "description", "Files types that are editable", String.class, true, true), - COOKIES_PRIVATE_KEY("cookiePrivateKey", "Private key for cookies", null, String.class, true, true), - LOCAL_REPOSITORIES_PATH("localRepositoriesPath", "The path where the local repositories will be stored", "/var/local/swe", String.class, false, true), - SUPPORTED_SCMS("supportedScms", "The SCMs which can be used", null, String.class, false, true); + EDITABLE_FILES("swe.editableFiles", "description", "Files types that are editable", String.class, true, true), + COOKIES_PRIVATE_KEY("swe.cookiePrivateKey", "Private key for cookies", null, String.class, true, true), + LOCAL_REPOSITORIES_PATH("swe.localRepositoriesPath", "The path where the local repositories will be stored", "/var/local/swe", String.class, false, true), + SUPPORTED_SCMS("swe.supportedScms", "The SCMs that can be used", null, String.class, false, true); private final String key; diff --git a/src/main/java/org/nuiton/scmwebeditor/SvnConnection.java b/src/main/java/org/nuiton/scmwebeditor/SvnConnection.java index 8a6732b..90eb314 100644 --- a/src/main/java/org/nuiton/scmwebeditor/SvnConnection.java +++ b/src/main/java/org/nuiton/scmwebeditor/SvnConnection.java @@ -215,11 +215,9 @@ public class SvnConnection implements ScmConnection { if (action.getDirectories() != null) { - Iterator<Map.Entry<String, String>> iter1 = action.getDirectories().entrySet().iterator(); - while (iter1.hasNext()) { - Map.Entry<String, String> ent = (Map.Entry<String, String>) iter1.next(); + for (Map.Entry<String, String> entry : action.getDirectories().entrySet()) { - String value = ent.getValue(); + String value = entry.getValue(); TreeNode node = new TreeNode(); node.setId(value); diff --git a/src/main/java/org/nuiton/scmwebeditor/actions/ScmWebEditorMainAction.java b/src/main/java/org/nuiton/scmwebeditor/actions/ScmWebEditorMainAction.java index f0c8812..6d346b6 100644 --- a/src/main/java/org/nuiton/scmwebeditor/actions/ScmWebEditorMainAction.java +++ b/src/main/java/org/nuiton/scmwebeditor/actions/ScmWebEditorMainAction.java @@ -270,14 +270,24 @@ public class ScmWebEditorMainAction extends ScmWebEditorBaseAction implements Se getScmSession().addScmUser(repositoryUUID, username, pw); } + String name = username; + String password = pw; + + if (name == null) { + name = "anonymous"; + } + if (password == null) { + password = "anonymous"; + } + /* * Getting the file and its revision */ try { - originalText = scmConn.getFileContent(address, username, pw); - numRevision = scmConn.getHeadRevisionNumber(address, username, pw); + originalText = scmConn.getFileContent(address, name, password); + numRevision = scmConn.getHeadRevisionNumber(address, name, password); } catch (AuthenticationException e) { request.setAttribute(PARAMETER_ADDRESS, address); diff --git a/src/main/java/org/nuiton/scmwebeditor/actions/SearchAction.java b/src/main/java/org/nuiton/scmwebeditor/actions/SearchAction.java index d2d6a70..47c7bb0 100644 --- a/src/main/java/org/nuiton/scmwebeditor/actions/SearchAction.java +++ b/src/main/java/org/nuiton/scmwebeditor/actions/SearchAction.java @@ -156,6 +156,12 @@ public class SearchAction extends ScmWebEditorBaseAction { returnCode = scmConn.search(this); + /* + BrowseDto totto = new BrowseDto(); + totto.setUrl(address); + returnCode = scmConn.search(totto); + */ + if (files == null && directories == null) { return returnCode; } diff --git a/src/main/resources/scmwebeditor.properties b/src/main/resources/scmwebeditor.properties index b1dbd70..5e66892 100644 --- a/src/main/resources/scmwebeditor.properties +++ b/src/main/resources/scmwebeditor.properties @@ -19,7 +19,7 @@ # <http://www.gnu.org/licenses/lgpl-3.0.html>. # #L% ### -editableFiles=text,xml,javascript,sh,x-tex,x-java -cookiePrivateKey=ZvcCyhfRTVZoQz3B/IpYdw== -localRepositoriesPath=/var/local/swe -supportedScms=SVN,Git +swe.editableFiles=text,xml,javascript,sh,x-tex,x-java +swe.cookiePrivateKey=ZvcCyhfRTVZoQz3B/IpYdw== +swe.localRepositoriesPath=/var/local/swe +swe.supportedScms=SVN,Git diff --git a/src/main/webapp/WEB-INF/content/search.jsp b/src/main/webapp/WEB-INF/content/search.jsp index 9fbb0ec..f1f0187 100644 --- a/src/main/webapp/WEB-INF/content/search.jsp +++ b/src/main/webapp/WEB-INF/content/search.jsp @@ -101,21 +101,26 @@ </div> <s:if test="error"> + <s:text name="scm.cantFindRepo"/> + </s:if> +<s:else> + + <s:set id="scm.upload"> + <s:text name="scm.upload"/> + </s:set> + <s:set id="scm.uploadTitle"> + <s:text name="scm.uploadTitle"/> + </s:set> + + <s:set name="address"> + <s:property value="address"/> + </s:set> + <center> + <s:submit name="uploadButton" value="%{scm.upload}" title="%{scm.uploadTitle}" + onClick="javascript:upload_popup('doUpload.action', 'upload' , getElementById('addressInput'), '%{scmType}' );"/> + </center> -<s:set id="scm.upload"> - <s:text name="scm.upload"/> -</s:set> -<s:set id="scm.uploadTitle"> - <s:text name="scm.uploadTitle"/> -</s:set> - -<s:set name="address"> - <s:property value="address"/> -</s:set> -<center> - <s:submit name="uploadButton" value="%{scm.upload}" title="%{scm.uploadTitle}" - onClick="javascript:upload_popup('doUpload.action', 'upload' , getElementById('addressInput'), '%{scmType}' );"/> -</center> +</s:else> diff --git a/src/main/webapp/css/main.css b/src/main/webapp/css/main.css index 66842be..215c0c6 100644 --- a/src/main/webapp/css/main.css +++ b/src/main/webapp/css/main.css @@ -334,3 +334,7 @@ li { overflow: scroll; height: 568px; } + +.CodeMirror { + height: 500px; +} -- To stop receiving notification emails like this one, please contact nuiton.org SCM administrator <admin+scm@nuiton.org>.
participants (1)
-
nuiton.org scm