Skip to content

svn --config-dir suport (Bugzilla #19171) #531

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
vladak opened this issue May 22, 2013 · 2 comments
Open

svn --config-dir suport (Bugzilla #19171) #531

vladak opened this issue May 22, 2013 · 2 comments
Labels

Comments

@vladak
Copy link
Member

vladak commented May 22, 2013

status NEW severity normal in component indexer for ---
Reported in version unspecified on platform ANY/Generic
Assigned to: Trond Norbye

Original attachment names and IDs:

  • svndir.patch (ID 4626)

On 2012-02-13 06:50:21 +0000, Jens Elkner wrote:

Created attachment 4626
patch

allow to set a non-default user configuration directory (--config-dir)

@vladak
Copy link
Member Author

vladak commented May 22, 2013

svndir.patch:

# HG changeset patch
# User jel+opengrok@cs.uni-magdeburg.de
# Date 1329111890 -3600
# Node ID 1f51a59fda801a5e753e998a8d2ba507e6273a70
# Parent  261116507c7ae7e640a63cd43271988908d92c4f
svn: allow to set a non-default user configuration directory (--config-dir)

diff -r 261116507c7a -r 1f51a59fda80 src/org/opensolaris/opengrok/history/SubversionRepository.java
--- a/src/org/opensolaris/opengrok/history/SubversionRepository.java    Mon Feb 13 06:12:47 2012 +0100
+++ b/src/org/opensolaris/opengrok/history/SubversionRepository.java    Mon Feb 13 06:44:50 2012 +0100
@@ -61,10 +61,18 @@
         "org.opensolaris.opengrok.history.Subversion";
     /** The command to use to access the repository if none was given explicitly */
     public static final String CMD_FALLBACK = "svn";
+    /** The system property name to obtain the subversion user configuration 
+     * directory to use, i.e. the value for the svn option --config-dir. Gets
+     * ignored, if not set.
+     */
+    public static final String CONFIG_DIRECTORY_KEY =
+        "org.opensolaris.opengrok.history.Subversion.configdir";
+    
     private static final Logger logger = 
         Logger.getLogger(SubversionRepository.class.getName());

     protected String reposPath;
+    private String configDir;

     public SubversionRepository() {
         type = "Subversion";
@@ -98,6 +106,9 @@
             List<String> cmd = new ArrayList<String>();
             cmd.add(this.cmd);
             cmd.add("info");
+            if (configDir != null) {
+                cmd.add(configDir);
+            }
             cmd.add("--xml");
             File directory = new File(getDirectoryName());

@@ -169,6 +180,9 @@
         cmd.add("log");
         cmd.add("--trust-server-cert");
         cmd.add("--non-interactive");
+        if (configDir != null) {
+            cmd.add(configDir);
+        }
         cmd.add("--xml");
         cmd.add("-v");
         if (sinceRevision != null) {
@@ -198,6 +212,9 @@
         ensureCommand(CMD_PROPERTY_KEY, CMD_FALLBACK);
         cmd.add(this.cmd);
         cmd.add("cat");
+        if (configDir != null) {
+            cmd.add(configDir);
+        }
         cmd.add("-r");
         cmd.add(rev);
         cmd.add(escapeFileName(filename));
@@ -290,6 +307,9 @@
         argv.add("annotate");
         argv.add("--trust-server-cert");
         argv.add("--non-interactive");
+        if (configDir != null) {
+            argv.add(configDir);
+        }
         argv.add("--xml");
         if (revision != null) {
             argv.add("-r");
@@ -351,6 +371,9 @@
         cmd.add("update");
         cmd.add("--trust-server-cert");
         cmd.add("--non-interactive");
+        if (configDir != null) {
+            cmd.add(configDir);
+        }
         Executor executor = new Executor(cmd, directory);
         if (executor.exec() != 0) {
             throw new IOException(executor.getErrorString());
@@ -370,7 +393,11 @@
     public boolean isWorking() {
         if (working == null) {
             ensureCommand(CMD_PROPERTY_KEY, CMD_FALLBACK);
-            working = checkCmd(cmd, "--help");
+            configDir = System.getProperty(CONFIG_DIRECTORY_KEY);
+            if (configDir != null) {
+                configDir = "--config-dir='" + configDir + "'";
+            }
+            working = checkCmd(cmd, configDir != null ? configDir + " --help" : "--help");
         }
         return working.booleanValue();
     }

@vladak
Copy link
Member Author

vladak commented Dec 14, 2017

The above patch should probably be reworked so that the config dir path is part of the configuration.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant