[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: [PATCH] Re: propedit on svn:mime-type

From: Alex Waugh <alex_at_alexwaugh.com>
Date: 2003-03-12 00:25:31 CET

In message <3E6E5E38.5080804@xbc.nu>
          Branko Cibej <brane@xbc.nu> wrote:

> The rest is fine; I'll commit if you can fix these nits.

* subversion/tests/clients/cmdline/prop_tests.py
  (strip_or_add_whitespace): Rename to prop_value_conversions. Add more tests
  for whitespace stripping and forcing svn:executable.

Index: subversion/tests/clients/cmdline/prop_tests.py
===================================================================
--- subversion/tests/clients/cmdline/prop_tests.py (revision 5279)
+++ subversion/tests/clients/cmdline/prop_tests.py (working copy)
@@ -740,8 +740,8 @@
 
 #----------------------------------------------------------------------
 
-def strip_or_add_whitespace(sbox):
- "some svn: properties should have whitespace stripped or added"
+def prop_value_conversions(sbox):
+ "some svn: properties should be converted"
 
   # Bootstrap
   if sbox.build():
@@ -749,7 +749,10 @@
 
   wc_dir = sbox.wc_dir
   A_path = os.path.join(wc_dir, 'A')
+ B_path = os.path.join(wc_dir, 'A', 'B')
   iota_path = os.path.join(wc_dir, 'iota')
+ lambda_path = os.path.join(wc_dir, 'A', 'B', 'lambda')
+ mu_path = os.path.join(wc_dir, 'A', 'mu')
 
   # We'll use a file to set the prop values, so that weird characters
   # in the props don't confuse the shell.
@@ -765,20 +768,38 @@
 
   # Leading and trailing whitespace should be stripped
   set_prop('svn:mime-type', ' text/html\n\n', iota_path)
+ set_prop('svn:mime-type', 'text/html', mu_path)
 
   # Leading and trailing whitespace should be stripped
   set_prop('svn:eol-style', '\nnative\n', iota_path)
+ set_prop('svn:eol-style', 'native', mu_path)
 
   # A trailing newline should be added
   set_prop('svn:ignore', '*.o\nfoo.c', A_path)
+ set_prop('svn:ignore', '*.o\nfoo.c\n', B_path)
 
   # A trailing newline should be added
   set_prop('svn:externals', 'foo http://foo.com/repos', A_path)
+ set_prop('svn:externals', 'foo http://foo.com/repos\n', B_path)
 
   # Leading and trailing whitespace should be stripped, but not internal
   # whitespace
   set_prop('svn:keywords', ' Rev Date \n', iota_path)
+ set_prop('svn:keywords', 'Rev Date', mu_path)
 
+ # svn:executable value should be forced to a '*'
+ set_prop('svn:executable', 'foo', iota_path)
+ set_prop('svn:executable', '', lambda_path)
+ set_prop('svn:executable', ' ', mu_path)
+
+ # Anything else should be untouched
+ set_prop('svn:some-prop', 'bar', lambda_path)
+ set_prop('svn:some-prop', ' bar baz', mu_path)
+ set_prop('svn:some-prop', 'bar\n', iota_path)
+ set_prop('some-prop', 'bar', lambda_path)
+ set_prop('some-prop', ' bar baz', mu_path)
+ set_prop('some-prop', 'bar\n', iota_path)
+
   # Close and remove the prop value file
   propval_file.close()
   os.unlink(propval_path)
@@ -792,6 +813,14 @@
     print "Actual standard output: ", out, "\n"
     return 1
 
+ out, err = svntest.main.run_svn(None, 'pg', 'svn:mime-type', mu_path)
+ exp_out = ['text/html\n']
+ if out != exp_out:
+ print "svn pg svn:mime-type output does not match expected."
+ print "Expected standard output: ", exp_out, "\n"
+ print "Actual standard output: ", out, "\n"
+ return 1
+
   # Check svn:eol-style
   out, err = svntest.main.run_svn(None, 'pg', 'svn:eol-style', iota_path)
   exp_out = ['native\n']
@@ -801,6 +830,14 @@
     print "Actual standard output: ", out, "\n"
     return 1
 
+ out, err = svntest.main.run_svn(None, 'pg', 'svn:eol-style', mu_path)
+ exp_out = ['native\n']
+ if out != exp_out:
+ print "svn pg svn:eol-style output does not match expected."
+ print "Expected standard output: ", exp_out, "\n"
+ print "Actual standard output: ", out, "\n"
+ return 1
+
   # Check svn:ignore
   # FIXME: Temporarily disabled on Windows due to \r\n vs. \n issues
   if not svntest.main.windows:
@@ -812,6 +849,14 @@
       print "Actual standard output: ", out, "\n"
       return 1
 
+ out, err = svntest.main.run_svn(None, 'pg', 'svn:ignore', B_path)
+ exp_out = ['*.o\n', 'foo.c\n', '\n']
+ if out != exp_out:
+ print "svn pg svn:ignore output does not match expected."
+ print "Expected standard output: ", exp_out, "\n"
+ print "Actual standard output: ", out, "\n"
+ return 1
+
   # Check svn:externals
   # FIXME: Temporarily disabled on Windows due to \r\n vs. \n issues
   if not svntest.main.windows:
@@ -823,6 +868,14 @@
       print "Actual standard output: ", out, "\n"
       return 1
 
+ out, err = svntest.main.run_svn(None, 'pg', 'svn:externals', B_path)
+ exp_out = ['foo http://foo.com/repos\n', '\n']
+ if out != exp_out:
+ print "svn pg svn:externals output does not match expected."
+ print "Expected standard output: ", exp_out, "\n"
+ print "Actual standard output: ", out, "\n"
+ return 1
+
   # Check svn:keywords
   out, err = svntest.main.run_svn(None, 'pg', 'svn:keywords', iota_path)
   exp_out = ['Rev Date\n']
@@ -832,6 +885,97 @@
     print "Actual standard output: ", out, "\n"
     return 1
 
+ out, err = svntest.main.run_svn(None, 'pg', 'svn:keywords', mu_path)
+ exp_out = ['Rev Date\n']
+ if out != exp_out:
+ print "svn pg svn:keywords output does not match expected."
+ print "Expected standard output: ", exp_out, "\n"
+ print "Actual standard output: ", out, "\n"
+ return 1
+
+
+ # Check svn:executable
+ out, err = svntest.main.run_svn(None, 'pg', 'svn:executable', iota_path)
+ exp_out = ['*\n']
+ if out != exp_out:
+ print "svn pg svn:keywords output does not match expected."
+ print "Expected standard output: ", exp_out, "\n"
+ print "Actual standard output: ", out, "\n"
+ return 1
+
+ out, err = svntest.main.run_svn(None, 'pg', 'svn:executable', lambda_path)
+ exp_out = ['*\n']
+ if out != exp_out:
+ print "svn pg svn:keywords output does not match expected."
+ print "Expected standard output: ", exp_out, "\n"
+ print "Actual standard output: ", out, "\n"
+ return 1
+
+ out, err = svntest.main.run_svn(None, 'pg', 'svn:executable', mu_path)
+ exp_out = ['*\n']
+ if out != exp_out:
+ print "svn pg svn:keywords output does not match expected."
+ print "Expected standard output: ", exp_out, "\n"
+ print "Actual standard output: ", out, "\n"
+ return 1
+
+ # Check other props
+ out, err = svntest.main.run_svn(None, 'pg', 'svn:some-prop',
+ lambda_path)
+ exp_out = ['bar\n']
+ if out != exp_out:
+ print "svn pg svn:keywords output does not match expected."
+ print "Expected standard output: ", exp_out, "\n"
+ print "Actual standard output: ", out, "\n"
+ return 1
+
+ out, err = svntest.main.run_svn(None, 'pg', 'svn:some-prop', mu_path)
+ exp_out = [' bar baz\n']
+ if out != exp_out:
+ print "svn pg svn:keywords output does not match expected."
+ print "Expected standard output: ", exp_out, "\n"
+ print "Actual standard output: ", out, "\n"
+ return 1
+
+ # FIXME: Temporarily disabled on Windows due to \r\n vs. \n issues
+ if not svntest.main.windows:
+ out, err = svntest.main.run_svn(None, 'pg', 'svn:some-prop',
+ iota_path)
+ exp_out = ['bar\n', '\n']
+ if out != exp_out:
+ print "svn pg svn:keywords output does not match expected."
+ print "Expected standard output: ", exp_out, "\n"
+ print "Actual standard output: ", out, "\n"
+ return 1
+
+ out, err = svntest.main.run_svn(None, 'pg', 'some-prop', lambda_path)
+ exp_out = ['bar\n']
+ if out != exp_out:
+ print "svn pg svn:keywords output does not match expected."
+ print "Expected standard output: ", exp_out, "\n"
+ print "Actual standard output: ", out, "\n"
+ return 1
+
+ out, err = svntest.main.run_svn(None, 'pg', 'some-prop', mu_path)
+ exp_out = [' bar baz\n']
+ if out != exp_out:
+ print "svn pg svn:keywords output does not match expected."
+ print "Expected standard output: ", exp_out, "\n"
+ print "Actual standard output: ", out, "\n"
+ return 1
+
+ # FIXME: Temporarily disabled on Windows due to \r\n vs. \n issues
+ if not svntest.main.windows:
+ out, err = svntest.main.run_svn(None, 'pg', 'some-prop',
+ iota_path)
+ exp_out = ['bar\n', '\n']
+ if out != exp_out:
+ print "svn pg svn:keywords output does not match expected."
+ print "Expected standard output: ", exp_out, "\n"
+ print "Actual standard output: ", out, "\n"
+ return 1
+
+
   return 0
 
 
@@ -855,7 +999,7 @@
               # If we learn how to write a pre-revprop-change hook for
               # non-Posix platforms, we won't have to skip here:
               Skip(revprop_change, (os.name != 'posix')),
- strip_or_add_whitespace,
+ prop_value_conversions,
              ]
 
 if __name__ == '__main__':
 

-- 
Alex Waugh                                           alex@alexwaugh.com
PHP, Roots, Subversion, WebJames and more from http://www.alexwaugh.com/
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Wed Mar 12 00:22:22 2003

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.