[augeas-devel] [PATCH] svn: lens and tests for /etc/subversion/{config, servers}

Marc Fournier marc.fournier at camptocamp.com
Mon Aug 17 16:34:03 UTC 2009


Signed-off-by: Marc Fournier <marc.fournier at camptocamp.com>
---
 lenses/subversion.aug            |   48 +++++++
 lenses/tests/test_subversion.aug |  286 ++++++++++++++++++++++++++++++++++++++
 2 files changed, 334 insertions(+), 0 deletions(-)
 create mode 100644 lenses/subversion.aug
 create mode 100644 lenses/tests/test_subversion.aug

diff --git a/lenses/subversion.aug b/lenses/subversion.aug
new file mode 100644
index 0000000..6b12d48
--- /dev/null
+++ b/lenses/subversion.aug
@@ -0,0 +1,48 @@
+(* Subversion module for Augeas
+ *   Author: Marc Fournier <marc.fournier at camptocamp.com>
+ *
+ *   Subversion configuration are regular ini files.
+ *)
+
+module Subversion =
+   autoload xfm
+
+(************************************************************************
+ * INI File settings
+ *
+ * subversion only supports comments starting with "#"
+ *
+ *************************************************************************)
+
+let comment  = IniFile.comment "#" "#"
+let sep      = IniFile.sep IniFile.sep_default IniFile.sep_default
+
+(************************************************************************
+ *                        ENTRY
+ *
+ * subversion doesn't support indented entries
+ *
+ *************************************************************************)
+
+let entry    = IniFile.entry IniFile.entry_re sep comment
+
+(************************************************************************
+ *                         TITLE
+ *
+ * subversion doesn't allow anonymous entries (outside sections)
+ *
+ *************************************************************************)
+
+let title    = IniFile.title IniFile.entry_re
+let record   = IniFile.record title entry
+
+(************************************************************************
+ *                         LENS & FILTER
+ *************************************************************************)
+
+let lns      = IniFile.lns record comment
+
+let filter   = incl "/etc/subversion/config"
+             . incl "/etc/subversion/servers"
+
+let xfm      = transform lns filter
diff --git a/lenses/tests/test_subversion.aug b/lenses/tests/test_subversion.aug
new file mode 100644
index 0000000..1855ac3
--- /dev/null
+++ b/lenses/tests/test_subversion.aug
@@ -0,0 +1,286 @@
+module Test_subversion =
+
+   let conf = "### This file configures various client-side behaviors.
+###
+### The commented-out examples below are intended to demonstrate
+### how to use this file.
+
+### Section for authentication and authorization customizations.
+[auth]
+### Set password stores used by Subversion. They should be
+### delimited by spaces or commas. The order of values determines
+### the order in which password stores are used.
+### Valid password stores:
+###   gnome-keyring        (Unix-like systems)
+###   kwallet              (Unix-like systems)
+###   keychain             (Mac OS X)
+###   windows-cryptoapi    (Windows)
+# password-stores = gnome-keyring,kwallet
+###
+### The rest of this section in this file has been deprecated.
+### Both 'store-passwords' and 'store-auth-creds' can now be
+### specified in the 'servers' file in your config directory.
+### Anything specified in this section is overridden by settings
+### specified in the 'servers' file.
+###
+### Set store-passwords to 'no' to avoid storing passwords in the
+### auth/ area of your config directory.  It defaults to 'yes',
+### but Subversion will never save your password to disk in
+### plaintext unless you tell it to (see the 'servers' file).
+### Note that this option only prevents saving of *new* passwords;
+### it doesn't invalidate existing passwords.  (To do that, remove
+### the cache files by hand as described in the Subversion book.)
+# store-passwords = no
+### Set store-auth-creds to 'no' to avoid storing any subversion
+### credentials in the auth/ area of your config directory.
+### It defaults to 'yes'.  Note that this option only prevents
+### saving of *new* credentials;  it doesn't invalidate existing
+### caches.  (To do that, remove the cache files by hand.)
+# store-auth-creds = no
+
+### Section for configuring external helper applications.
+[helpers]
+### Set editor-cmd to the command used to invoke your text editor.
+###   This will override the environment variables that Subversion
+###   examines by default to find this information ($EDITOR, 
+###   et al).
+# editor-cmd = editor (vi, emacs, notepad, etc.)
+### Set diff-cmd to the absolute path of your 'diff' program.
+###   This will override the compile-time default, which is to use
+###   Subversion's internal diff implementation.
+# diff-cmd = diff_program (diff, gdiff, etc.)
+### Set diff3-cmd to the absolute path of your 'diff3' program.
+###   This will override the compile-time default, which is to use
+###   Subversion's internal diff3 implementation.
+# diff3-cmd = diff3_program (diff3, gdiff3, etc.)
+### Set diff3-has-program-arg to 'yes' if your 'diff3' program
+###   accepts the '--diff-program' option.
+# diff3-has-program-arg = [yes | no]
+### Set merge-tool-cmd to the command used to invoke your external
+### merging tool of choice. Subversion will pass 4 arguments to
+### the specified command: base theirs mine merged
+# merge-tool-cmd = merge_command
+
+### Section for configuring tunnel agents.
+[tunnels]
+### Configure svn protocol tunnel schemes here.  By default, only
+### the 'ssh' scheme is defined.  You can define other schemes to
+### be used with 'svn+scheme://hostname/path' URLs.  A scheme
+### definition is simply a command, optionally prefixed by an
+### environment variable name which can override the command if it
+### is defined.  The command (or environment variable) may contain
+### arguments, using standard shell quoting for arguments with
+### spaces.  The command will be invoked as:
+###   <command> <hostname> svnserve -t
+### (If the URL includes a username, then the hostname will be
+### passed to the tunnel agent as <user>@<hostname>.)  Here we
+### redefine the built-in 'ssh' scheme to avoid an unfortunate
+### interaction with the \"ControlMaster auto\" feature (for
+### details, see Debian Bug #413102):
+ssh = $SVN_SSH ssh -o ControlMaster=no
+### If you wanted to define a new 'rsh' scheme, to be used with
+### 'svn+rsh:' URLs, you could do so as follows:
+# rsh = rsh
+### Or, if you wanted to specify a full path and arguments:
+# rsh = /path/to/rsh -l myusername
+### On Windows, if you are specifying a full path to a command,
+### use a forward slash (/) or a paired backslash (\\) as the
+### path separator.  A single backslash will be treated as an
+### escape for the following character.
+
+### Section for configuring miscelleneous Subversion options.
+[miscellany]
+### Set global-ignores to a set of whitespace-delimited globs
+### which Subversion will ignore in its 'status' output, and
+### while importing or adding files and directories.
+### '*' matches leading dots, e.g. '*.rej' matches '.foo.rej'.
+# global-ignores = *.o *.lo *.la *.al .libs *.so *.so.[0-9]* *.a *.pyc *.pyo
+#   *.rej *~ #*# .#* .*.swp .DS_Store
+### Set log-encoding to the default encoding for log messages
+# log-encoding = latin1
+### Set use-commit-times to make checkout/update/switch/revert
+### put last-committed timestamps on every file touched.
+# use-commit-times = yes
+### Set no-unlock to prevent 'svn commit' from automatically
+### releasing locks on files.
+# no-unlock = yes
+### Set mime-types-file to a MIME type registry file, used to
+### provide hints to Subversion's MIME type auto-detection
+### algorithm.
+# mime-types-file = /path/to/mime.types
+### Set preserved-conflict-file-exts to a whitespace-delimited
+### list of patterns matching file extensions which should be
+### preserved in generated conflict file names.  By default,
+### conflict files use custom extensions.
+# preserved-conflict-file-exts = doc ppt xls od?
+### Set enable-auto-props to 'yes' to enable automatic properties
+### for 'svn add' and 'svn import', it defaults to 'no'.
+### Automatic properties are defined in the section 'auto-props'.
+# enable-auto-props = yes
+### Set interactive-conflicts to 'no' to disable interactive
+### conflict resolution prompting.  It defaults to 'yes'.
+# interactive-conflicts = no
+
+### Section for configuring automatic properties.
+[auto-props]
+### The format of the entries is:
+###   file-name-pattern = propname[=value][;propname[=value]...]
+### The file-name-pattern can contain wildcards (such as '*' and
+### '?').  All entries which match (case-insensitively) will be
+### applied to the file.  Note that auto-props functionality
+### must be enabled, which is typically done by setting the
+### 'enable-auto-props' option.
+# *.c = svn:eol-style=native
+# *.cpp = svn:eol-style=native
+# *.h = svn:eol-style=native
+# *.dsp = svn:eol-style=CRLF
+# *.dsw = svn:eol-style=CRLF
+# *.sh = svn:eol-style=native;svn:executable
+# *.txt = svn:eol-style=native
+# *.png = svn:mime-type=image/png
+# *.jpg = svn:mime-type=image/jpeg
+# Makefile = svn:eol-style=native
+"
+
+
+   test Subversion.lns get conf =
+      { "#comment" = "## This file configures various client-side behaviors." }
+      { "#comment" = "##" }
+      { "#comment" = "## The commented-out examples below are intended to demonstrate" }
+      { "#comment" = "## how to use this file." }
+      {}
+      { "#comment" = "## Section for authentication and authorization customizations." }
+      { "auth"
+         { "#comment" = "## Set password stores used by Subversion. They should be" }
+         { "#comment" = "## delimited by spaces or commas. The order of values determines" }
+         { "#comment" = "## the order in which password stores are used." }
+         { "#comment" = "## Valid password stores:" }
+         { "#comment" = "##   gnome-keyring        (Unix-like systems)" }
+         { "#comment" = "##   kwallet              (Unix-like systems)" }
+         { "#comment" = "##   keychain             (Mac OS X)" }
+         { "#comment" = "##   windows-cryptoapi    (Windows)" }
+         { "#comment" = "password-stores = gnome-keyring,kwallet" }
+         { "#comment" = "##" }
+         { "#comment" = "## The rest of this section in this file has been deprecated." }
+         { "#comment" = "## Both 'store-passwords' and 'store-auth-creds' can now be" }
+         { "#comment" = "## specified in the 'servers' file in your config directory." }
+         { "#comment" = "## Anything specified in this section is overridden by settings" }
+         { "#comment" = "## specified in the 'servers' file." }
+         { "#comment" = "##" }
+         { "#comment" = "## Set store-passwords to 'no' to avoid storing passwords in the" }
+         { "#comment" = "## auth/ area of your config directory.  It defaults to 'yes'," }
+         { "#comment" = "## but Subversion will never save your password to disk in" }
+         { "#comment" = "## plaintext unless you tell it to (see the 'servers' file)." }
+         { "#comment" = "## Note that this option only prevents saving of *new* passwords;" }
+         { "#comment" = "## it doesn't invalidate existing passwords.  (To do that, remove" }
+         { "#comment" = "## the cache files by hand as described in the Subversion book.)" }
+         { "#comment" = "store-passwords = no" }
+         { "#comment" = "## Set store-auth-creds to 'no' to avoid storing any subversion" }
+         { "#comment" = "## credentials in the auth/ area of your config directory." }
+         { "#comment" = "## It defaults to 'yes'.  Note that this option only prevents" }
+         { "#comment" = "## saving of *new* credentials;  it doesn't invalidate existing" }
+         { "#comment" = "## caches.  (To do that, remove the cache files by hand.)" }
+         { "#comment" = "store-auth-creds = no" }
+         {}
+         { "#comment" = "## Section for configuring external helper applications." } }
+      { "helpers"
+         { "#comment" = "## Set editor-cmd to the command used to invoke your text editor." }
+         { "#comment" = "##   This will override the environment variables that Subversion" }
+         { "#comment" = "##   examines by default to find this information ($EDITOR," }
+         { "#comment" = "##   et al)." }
+         { "#comment" = "editor-cmd = editor (vi, emacs, notepad, etc.)" }
+         { "#comment" = "## Set diff-cmd to the absolute path of your 'diff' program." }
+         { "#comment" = "##   This will override the compile-time default, which is to use" }
+         { "#comment" = "##   Subversion's internal diff implementation." }
+         { "#comment" = "diff-cmd = diff_program (diff, gdiff, etc.)" }
+         { "#comment" = "## Set diff3-cmd to the absolute path of your 'diff3' program." }
+         { "#comment" = "##   This will override the compile-time default, which is to use" }
+         { "#comment" = "##   Subversion's internal diff3 implementation." }
+         { "#comment" = "diff3-cmd = diff3_program (diff3, gdiff3, etc.)" }
+         { "#comment" = "## Set diff3-has-program-arg to 'yes' if your 'diff3' program" }
+         { "#comment" = "##   accepts the '--diff-program' option." }
+         { "#comment" = "diff3-has-program-arg = [yes | no]" }
+         { "#comment" = "## Set merge-tool-cmd to the command used to invoke your external" }
+         { "#comment" = "## merging tool of choice. Subversion will pass 4 arguments to" }
+         { "#comment" = "## the specified command: base theirs mine merged" }
+         { "#comment" = "merge-tool-cmd = merge_command" }
+         {}
+         { "#comment" = "## Section for configuring tunnel agents." } }
+      { "tunnels"
+         { "#comment" = "## Configure svn protocol tunnel schemes here.  By default, only" }
+         { "#comment" = "## the 'ssh' scheme is defined.  You can define other schemes to" }
+         { "#comment" = "## be used with 'svn+scheme://hostname/path' URLs.  A scheme" }
+         { "#comment" = "## definition is simply a command, optionally prefixed by an" }
+         { "#comment" = "## environment variable name which can override the command if it" }
+         { "#comment" = "## is defined.  The command (or environment variable) may contain" }
+         { "#comment" = "## arguments, using standard shell quoting for arguments with" }
+         { "#comment" = "## spaces.  The command will be invoked as:" }
+         { "#comment" = "##   <command> <hostname> svnserve -t" }
+         { "#comment" = "## (If the URL includes a username, then the hostname will be" }
+         { "#comment" = "## passed to the tunnel agent as <user>@<hostname>.)  Here we" }
+         { "#comment" = "## redefine the built-in 'ssh' scheme to avoid an unfortunate" }
+         { "#comment" = "## interaction with the \"ControlMaster auto\" feature (for" }
+         { "#comment" = "## details, see Debian Bug #413102):" }
+         { "ssh" = "$SVN_SSH ssh -o ControlMaster=no" }
+         { "#comment" = "## If you wanted to define a new 'rsh' scheme, to be used with" }
+         { "#comment" = "## 'svn+rsh:' URLs, you could do so as follows:" }
+         { "#comment" = "rsh = rsh" }
+         { "#comment" = "## Or, if you wanted to specify a full path and arguments:" }
+         { "#comment" = "rsh = /path/to/rsh -l myusername" }
+         { "#comment" = "## On Windows, if you are specifying a full path to a command," }
+         { "#comment" = "## use a forward slash (/) or a paired backslash (\\) as the" }
+         { "#comment" = "## path separator.  A single backslash will be treated as an" }
+         { "#comment" = "## escape for the following character." }
+         {}
+         { "#comment" = "## Section for configuring miscelleneous Subversion options." } }
+      { "miscellany"
+         { "#comment" = "## Set global-ignores to a set of whitespace-delimited globs" }
+         { "#comment" = "## which Subversion will ignore in its 'status' output, and" }
+         { "#comment" = "## while importing or adding files and directories." }
+         { "#comment" = "## '*' matches leading dots, e.g. '*.rej' matches '.foo.rej'." }
+         { "#comment" = "global-ignores = *.o *.lo *.la *.al .libs *.so *.so.[0-9]* *.a *.pyc *.pyo" }
+         { "#comment" = "*.rej *~ #*# .#* .*.swp .DS_Store" }
+         { "#comment" = "## Set log-encoding to the default encoding for log messages" }
+         { "#comment" = "log-encoding = latin1" }
+         { "#comment" = "## Set use-commit-times to make checkout/update/switch/revert" }
+         { "#comment" = "## put last-committed timestamps on every file touched." }
+         { "#comment" = "use-commit-times = yes" }
+         { "#comment" = "## Set no-unlock to prevent 'svn commit' from automatically" }
+         { "#comment" = "## releasing locks on files." }
+         { "#comment" = "no-unlock = yes" }
+         { "#comment" = "## Set mime-types-file to a MIME type registry file, used to" }
+         { "#comment" = "## provide hints to Subversion's MIME type auto-detection" }
+         { "#comment" = "## algorithm." }
+         { "#comment" = "mime-types-file = /path/to/mime.types" }
+         { "#comment" = "## Set preserved-conflict-file-exts to a whitespace-delimited" }
+         { "#comment" = "## list of patterns matching file extensions which should be" }
+         { "#comment" = "## preserved in generated conflict file names.  By default," }
+         { "#comment" = "## conflict files use custom extensions." }
+         { "#comment" = "preserved-conflict-file-exts = doc ppt xls od?" }
+         { "#comment" = "## Set enable-auto-props to 'yes' to enable automatic properties" }
+         { "#comment" = "## for 'svn add' and 'svn import', it defaults to 'no'." }
+         { "#comment" = "## Automatic properties are defined in the section 'auto-props'." }
+         { "#comment" = "enable-auto-props = yes" }
+         { "#comment" = "## Set interactive-conflicts to 'no' to disable interactive" }
+         { "#comment" = "## conflict resolution prompting.  It defaults to 'yes'." }
+         { "#comment" = "interactive-conflicts = no" }
+         {}
+         { "#comment" = "## Section for configuring automatic properties." } }
+      { "auto-props"
+         { "#comment" = "## The format of the entries is:" }
+         { "#comment" = "##   file-name-pattern = propname[=value][;propname[=value]...]" }
+         { "#comment" = "## The file-name-pattern can contain wildcards (such as '*' and" }
+         { "#comment" = "## '?').  All entries which match (case-insensitively) will be" }
+         { "#comment" = "## applied to the file.  Note that auto-props functionality" }
+         { "#comment" = "## must be enabled, which is typically done by setting the" }
+         { "#comment" = "## 'enable-auto-props' option." }
+         { "#comment" = "*.c = svn:eol-style=native" }
+         { "#comment" = "*.cpp = svn:eol-style=native" }
+         { "#comment" = "*.h = svn:eol-style=native" }
+         { "#comment" = "*.dsp = svn:eol-style=CRLF" }
+         { "#comment" = "*.dsw = svn:eol-style=CRLF" }
+         { "#comment" = "*.sh = svn:eol-style=native;svn:executable" }
+         { "#comment" = "*.txt = svn:eol-style=native" }
+         { "#comment" = "*.png = svn:mime-type=image/png" }
+         { "#comment" = "*.jpg = svn:mime-type=image/jpeg" }
+         { "#comment" = "Makefile = svn:eol-style=native" } }
-- 
1.6.3.3




More information about the augeas-devel mailing list