You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Brian Denny <br...@briandenny.net> on 2002/09/29 02:01:43 UTC

[PATCH] [updated] [Issue 870] import should set svn:executable automatically

Another try, including tests this time!

As far as testing import, I followed Branko's suggestion to set one
of the greek files (in the original greek_state) executable before
import (in the setup code).  This affected some of the other (existing)
tests.

Specifically, people who write client tests should note that instead
of writing
  expected_disk = svntest.main.greek_state.copy()

you should now write
  expected_disk = svntest.actions.get_virginal_disk(1) # if checking props
or
  expected_disk = svntest.actions.get_virginal_disk()  # if not

Any objections to this way of doing things?  Wrapping my head around
the test code has been harder than writing the fix in the first place,
so i won't take offense if you think i should do the test some other
way.

This patch passes 'make check' on my FreeBSD box.
I feel as though it should be tested on Windows, but haven't been able
to do so myself.

:brian



Addresses issue 870: on import (and add), sets the svn:executable property
of files according to whether the file is actually executable by the
current user, on platforms where it makes sense.  Includes changes to
the client tests.

Thanks to the many people who contributed suggestions for this patch.

* subversion/include/svn_io.h
  : add header for new function
* subversion/libsvn_subr/io.c
  : add function 'svn_io_is_file_executable'
* subversion/libsvn_client/commit.c
  (import_file) : Check if file to be imported is executable;
                  if so, set svn:executable property.
* subversion/libsvn_wc/adm_ops.c
  (svn_wc_add) : Check if file to be added is executable;
                 if so, set svn:executable property.
                 Jeff Bellegarde suggested checking on add.
* subversion/tests/client/cmdline/svntest/main.py
  : added file "kappa" to greek_state for testing operations
    on executable files
* subversion/tests/client/cmdline/svntest/actions.py
  (guarantee_greek_repository) : set executable bits
  (get_virginal_state) : tweak status of executable file
  : add function 'get_virginal_disk'
    (abstraction of 'greek_state.copy' plus tweak executable property)
* subversion/tests/client/cmdline/schedule_tests.py
  : add test 'add_executable' (Thanks to Jeff Bellegarde)
  : add test 'revert_add_executable'
  : add test 'commit_add_executable'
  (the latter two are not strictly necessary but are included
   in keeping with the triplet paradigm)
* subversion/tests/client/cmdline/basic_tests.py
  : add test 'basic_executable_file'
  : replace calls to 'main.greek_state.copy'
    with calls to 'actions.get_virginal_disk'
* subversion/tests/client/cmdline/prop_tests.py,
  subversion/tests/client/cmdline/switch_tests.py,
  subversion/tests/client/cmdline/update_tests.py,
  subversion/tests/client/cmdline/copy_tests.py,
  subversion/tests/client/cmdline/trans_tests.py,
  subversion/tests/client/cmdline/commit_tests.py,
  subversion/tests/client/cmdline/merge_tests.py
  : replace calls to 'main.greek_state.copy'
    with calls to 'actions.get_virginal_disk'



Index: subversion/include/svn_io.h
===================================================================
--- subversion/include/svn_io.h
+++ subversion/include/svn_io.h	Thu Sep 26 21:48:06 2002
@@ -193,6 +193,16 @@
                                          svn_boolean_t ignore_enoent,
                                          apr_pool_t *pool);

+/* Determine whether a file is executable by the current user.
+ * Set *EXECUTABLE to TRUE if the file PATH is executable by the
+ * current user, otherwise set it to FALSE.
+ *
+ * On Windows and on platforms without userids, always returns FALSE.
+ */
+svn_error_t *svn_io_is_file_executable(svn_boolean_t *executable,
+                                       const char *path,
+                                       apr_pool_t *pool);
+

 /* Read a line from FILE into BUF, but not exceeding *LIMIT bytes.
  * Does not include newline, instead '\0' is put there.
Index: subversion/libsvn_wc/adm_ops.c
===================================================================
--- subversion/libsvn_wc/adm_ops.c
+++ subversion/libsvn_wc/adm_ops.c	Fri Sep 27 19:50:05 2002
@@ -731,6 +731,7 @@
   enum svn_node_kind kind;
   apr_uint32_t modify_flags = 0;
   const char *mimetype = NULL;
+  svn_boolean_t executable = FALSE;
   svn_error_t *err;
   svn_wc_adm_access_t *adm_access;

@@ -847,6 +848,17 @@
           mt_str.data = mimetype;
           mt_str.len = strlen(mimetype);
           SVN_ERR (svn_wc_prop_set (SVN_PROP_MIME_TYPE, &mt_str, path,
+                                    parent_access, pool));
+        }
+
+      /* Set svn:executable if the new addition is executable. */
+      SVN_ERR (svn_io_is_file_executable (&executable, path, pool));
+      if (executable)
+        {
+          svn_string_t emptystr;
+          emptystr.data = "";
+          emptystr.len = 0;
+          SVN_ERR (svn_wc_prop_set (SVN_PROP_EXECUTABLE, &emptystr, path,
                                     parent_access, pool));
         }
     }
Index: subversion/libsvn_subr/io.c
===================================================================
--- subversion/libsvn_subr/io.c
+++ subversion/libsvn_subr/io.c	Fri Sep 27 19:28:23 2002
@@ -641,6 +641,49 @@
 }


+svn_error_t *
+svn_io_is_file_executable(svn_boolean_t *executable,
+                          const char *path,
+                          apr_pool_t *pool)
+{
+#if defined(APR_HAS_USER) && !defined(SVN_WIN32)
+  apr_finfo_t file_info;
+  apr_status_t apr_err;
+  apr_uid_t uid;
+  apr_gid_t gid;
+  svn_boolean_t is_user;
+  svn_boolean_t is_group;
+
+  *executable = FALSE;
+
+  /* Get file and user info. */
+  SVN_ERR (svn_io_stat (&file_info, path,
+                        (APR_FINFO_PROT | APR_FINFO_OWNER),
+                        pool));
+  apr_err = apr_current_userid (&uid, &gid, pool);
+
+  if (apr_err)
+    return svn_error_create(apr_err, 0, NULL, pool,
+                            "Error getting UID of process.");
+
+  /* Check executable bit for current user. */
+  if (apr_compare_users(uid, file_info.user) == APR_SUCCESS)
+    *executable = (file_info.protection & APR_UEXECUTE);
+
+  else if (apr_compare_groups(gid, file_info.group) == APR_SUCCESS)
+    *executable = (file_info.protection & APR_GEXECUTE);
+
+  else
+    *executable = (file_info.protection & APR_WEXECUTE);
+
+#else  /* defined(SVN_WIN32) || !defined(APR_HAS_USER) */
+  *executable = FALSE;
+#endif
+
+  return SVN_NO_ERROR;
+}
+
+


 /*** Generic streams. ***/
Index: subversion/libsvn_client/commit.c
===================================================================
--- subversion/libsvn_client/commit.c
+++ subversion/libsvn_client/commit.c	Wed Sep 25 19:14:01 2002
@@ -112,6 +112,7 @@
   apr_pool_t *subpool = svn_pool_create (hash_pool);
   const char *filepath = apr_pstrdup (hash_pool, path);
   struct imported_file *value = apr_palloc (hash_pool, sizeof (*value));
+  svn_boolean_t executable;

   /* Add the file, using the pool from the FILES hash. */
   SVN_ERR (editor->add_file (edit_path, dir_baton, NULL, SVN_INVALID_REVNUM,
@@ -123,6 +124,13 @@
   if (mimetype)
     SVN_ERR (editor->change_file_prop (file_baton, SVN_PROP_MIME_TYPE,
                                        svn_string_create (mimetype, pool),
+                                       pool));
+
+  /* If the file is executable, add that as a property to the file. */
+  SVN_ERR (svn_io_is_file_executable (&executable, path, pool));
+  if (executable)
+    SVN_ERR (editor->change_file_prop (file_baton, SVN_PROP_EXECUTABLE,
+                                       svn_string_create ("", pool),
                                        pool));

   if (notify_func)
Index: subversion/tests/clients/cmdline/copy_tests.py
===================================================================
--- subversion/tests/clients/cmdline/copy_tests.py
+++ subversion/tests/clients/cmdline/copy_tests.py	Sat Sep 28 16:40:09 2002
@@ -320,7 +320,7 @@
     })

   # Create expected disk tree for the update.
-  expected_disk = svntest.main.greek_state.copy()
+  expected_disk = svntest.actions.get_virginal_disk()
   expected_disk.add({
     'A/B/newG' : Item(),
     'A/B/newG/pi' : Item("This is the file 'pi'."),
@@ -408,7 +408,7 @@
     'A/D/G/tau' : Item(status='A '),
     })

-  expected_disk = svntest.main.greek_state.copy()
+  expected_disk = svntest.actions.get_virginal_disk()

   expected_status = svntest.actions.get_virginal_state(wc_dir, 3)

Index: subversion/tests/clients/cmdline/prop_tests.py
===================================================================
--- subversion/tests/clients/cmdline/prop_tests.py
+++ subversion/tests/clients/cmdline/prop_tests.py	Sat Sep 28 16:16:22 2002
@@ -65,7 +65,7 @@
                        os.path.join(wc_dir, 'A', 'D', 'G'))

   # What we expect the disk tree to look like:
-  expected_disk = svntest.main.greek_state.copy()
+  expected_disk = svntest.actions.get_virginal_disk(1)
   expected_disk.tweak('A/mu', props={'blue' : 'azul', 'green' : 'verde'})
   expected_disk.tweak('A/D/G', props={'red' : 'rojo'})

@@ -166,7 +166,7 @@
     })

   # Create expected disk tree for the update.
-  expected_disk = svntest.main.greek_state.copy()
+  expected_disk = svntest.actions.get_virginal_disk(1)
   expected_disk.tweak('A/mu', props={'blue' : 'azul'})
   expected_disk.tweak('A/D/H', props={'red' : 'rojo'})

@@ -243,7 +243,7 @@
     })

   # Create expected disk tree for the update.
-  expected_disk = svntest.main.greek_state
+  expected_disk = svntest.actions.get_virginal_disk(1)

   # Create expected status tree for the update.
   expected_status = svntest.actions.get_virginal_state(wc_dir, 1)
@@ -346,7 +346,7 @@
     })

   # Create expected disk tree for the update.
-  expected_disk = svntest.main.greek_state.copy()
+  expected_disk = svntest.actions.get_virginal_disk(1)
   expected_disk.tweak('A/mu', props={'cash-sound' : 'beep!'})
   expected_disk.tweak('A', props={'foo' : 'baz'})

@@ -509,7 +509,7 @@
   expected_status.tweak('iota', status='__')
   expected_status.tweak('A/B/lambda', status='__')

-  expected_disk = svntest.main.greek_state.copy()
+  expected_disk = svntest.actions.get_virginal_disk(1)
   expected_disk.tweak('iota', props={'cash-sound' : 'cha-ching!'})
   expected_disk.tweak('A/B/lambda', props={'boson' : 'W'})

Index: subversion/tests/clients/cmdline/basic_tests.py
===================================================================
--- subversion/tests/clients/cmdline/basic_tests.py
+++ subversion/tests/clients/cmdline/basic_tests.py	Sat Sep 28 16:45:16 2002
@@ -199,7 +199,7 @@
     })

   # Create expected disk tree for the update.
-  expected_disk = svntest.main.greek_state.copy()
+  expected_disk = svntest.actions.get_virginal_disk()
   expected_disk.tweak('A/mu',
                       contents=expected_disk.desc['A/mu'].contents
                       + 'appended mu text')
@@ -299,7 +299,7 @@
     })

   # Create expected disk tree for the update.
-  expected_disk = svntest.main.greek_state.copy()
+  expected_disk = svntest.actions.get_virginal_disk()
   expected_disk.tweak('A/mu',
                       contents=expected_disk.desc['A/mu'].contents
                       + 'appended mu text')
@@ -441,7 +441,7 @@
     })

   # Create expected disk tree for the update.
-  expected_disk = svntest.main.greek_state.copy()
+  expected_disk = svntest.actions.get_virginal_disk()
   expected_disk.tweak('A/mu',
                       contents=backup_mu_text + ' Appended to line 10 of mu')
   expected_disk.tweak('A/D/G/rho',
@@ -512,7 +512,7 @@
     })

   # Create expected disk tree for the update.
-  expected_disk = svntest.main.greek_state.copy()
+  expected_disk = svntest.actions.get_virginal_disk()
   expected_disk.tweak('A/mu', contents="""<<<<<<< .mine
 This is the file 'mu'.
 Conflicting appended text for mu=======
@@ -748,7 +748,7 @@
     })

   # Create expected disk tree (iota will have gamma's contents)
-  expected_disk = svntest.main.greek_state.copy()
+  expected_disk = svntest.actions.get_virginal_disk()
   expected_disk.tweak('iota',
                       contents=expected_disk.desc['A/D/gamma'].contents)

@@ -786,7 +786,7 @@

   # Create expected disk tree (iota will have gamma's contents,
   # A/D/H/* will look like A/D/G/*)
-  expected_disk = svntest.main.greek_state.copy()
+  expected_disk = svntest.actions.get_virginal_disk()
   expected_disk.tweak('iota',
                       contents=expected_disk.desc['A/D/gamma'].contents)
   expected_disk.remove('A/D/H/chi', 'A/D/H/omega', 'A/D/H/psi')
@@ -1201,6 +1201,28 @@
   if svntest.actions.run_and_verify_status(wc_dir, expected_status):
     return 1

+#----------------------------------------------------------------------
+
+def basic_executable_file(sbox):
+  "basic checkout of executable file"
+
+  if sbox.build():
+    return 1
+
+  if os.name == 'posix':
+    wc_dir = sbox.wc_dir
+
+    # What we expect the disk tree to look like:
+    expected_disk = svntest.actions.get_virginal_disk(1)
+
+    # Read the real disk tree.  Notice we are passing the (normally
+    # disabled) "load props" flag to this routine.  This will run 'svn
+    # proplist' on every item in the working copy!
+    actual_disk_tree = svntest.tree.build_tree_from_wc(wc_dir, 1)
+
+    # Compare actual vs. expected disk trees.
+    return svntest.tree.compare_trees(expected_disk.old_tree(), actual_disk_tree)
+

 #----------------------------------------------------------------------
 def nonexistent_repository(sbox):
@@ -1264,6 +1286,7 @@
               basic_delete,
               basic_checkout_deleted,
               basic_node_kind_change,
+              basic_executable_file,
               nonexistent_repository,
               ### todo: more tests needed:
               ### test "svn rm http://some_url"
Index: subversion/tests/clients/cmdline/update_tests.py
===================================================================
--- subversion/tests/clients/cmdline/update_tests.py
+++ subversion/tests/clients/cmdline/update_tests.py	Sat Sep 28 16:28:16 2002
@@ -143,7 +143,7 @@

   # Create expected disk tree for the update --
   #    look!  binary contents, and a binary property!
-  expected_disk = svntest.main.greek_state.copy()
+  expected_disk = svntest.actions.get_virginal_disk(1)
   expected_disk.add({
     'A/theta' : Item(theta_contents_local,
                      props={'svn:mime-type' : 'application/octet-stream'}),
@@ -276,7 +276,7 @@

   # Create expected disk tree for the update --
   #    look!  binary contents, and a binary property!
-  expected_disk = svntest.main.greek_state.copy()
+  expected_disk = svntest.actions.get_virginal_disk(1)
   expected_disk.add({
     'A/theta' : Item(theta_contents,
                      props={'svn:mime-type' : 'application/octet-stream'}),
@@ -343,7 +343,7 @@
     })

   # Create expected disk tree for the update.
-  expected_disk = svntest.main.greek_state.copy()
+  expected_disk = svntest.actions.get_virginal_disk()

   # Create expected status tree for the update.
   expected_status = svntest.actions.get_virginal_state(wc_dir, 1)
@@ -392,7 +392,7 @@
   expected_output = svntest.wc.State(wc_dir, { })

   # Create expected disk tree for the update.
-  expected_disk = svntest.main.greek_state.copy()
+  expected_disk = svntest.actions.get_virginal_disk()
   expected_disk.add({
     'A/B/zeta' : Item("This is the file 'zeta'."),
     })
@@ -430,6 +430,7 @@
   # Create expected output tree for an update to rev 0
   expected_output = svntest.wc.State(wc_dir, {
     'iota' : Item(status='D '),
+    'kappa' : Item(status='D '),
     'A' : Item(status='D '),
     })

@@ -504,7 +505,7 @@
     })

   # Expected disk tree for the update.
-  expected_disk = svntest.main.greek_state.copy()
+  expected_disk = svntest.actions.get_virginal_disk()
   expected_disk.tweak('iota',
                       contents="This is the file 'iota'.\nA change to iota.\n")

@@ -590,7 +591,7 @@
     })

   # Create expected disk tree for the update.
-  expected_disk = svntest.main.greek_state.copy()
+  expected_disk = svntest.actions.get_virginal_disk()
   expected_disk.tweak('A/mu', contents= """<<<<<<< .mine
 This is the file 'mu'.
 Conflicting appended text for mu=======
Index: subversion/tests/clients/cmdline/trans_tests.py
===================================================================
--- subversion/tests/clients/cmdline/trans_tests.py
+++ subversion/tests/clients/cmdline/trans_tests.py	Sat Sep 28 16:37:20 2002
@@ -365,7 +365,7 @@
     'A/D/G/rho' : Item(status='CU'),
     })

-  expected_disk = svntest.main.greek_state.copy()
+  expected_disk = svntest.actions.get_virginal_disk()
   expected_disk.tweak('A/D/G/rho', contents="""<<<<<<< .mine
 1
 2
Index: subversion/tests/clients/cmdline/commit_tests.py
===================================================================
--- subversion/tests/clients/cmdline/commit_tests.py
+++ subversion/tests/clients/cmdline/commit_tests.py	Sat Sep 28 16:40:25 2002
@@ -620,7 +620,7 @@
   expected_output = svntest.wc.State(wc_dir, {})

   # Expected disk tree:  everything but gamma
-  expected_disk = svntest.main.greek_state.copy()
+  expected_disk = svntest.actions.get_virginal_disk()
   expected_disk.remove('A/D/gamma')

   # Expected status after update:  totally clean revision 2, minus gamma.
@@ -676,7 +676,7 @@
   expected_output = svntest.wc.State(wc_dir, {})

   # Expected disk tree:  everything except files in H
-  expected_disk = svntest.main.greek_state.copy()
+  expected_disk = svntest.actions.get_virginal_disk()
   expected_disk.remove('A/D/H', 'A/D/H/chi', 'A/D/H/omega', 'A/D/H/psi')

   # Expected status after update:  totally clean revision 2, minus H.
Index: subversion/tests/clients/cmdline/schedule_tests.py
===================================================================
--- subversion/tests/clients/cmdline/schedule_tests.py
+++ subversion/tests/clients/cmdline/schedule_tests.py	Sat Sep 28 16:47:06 2002
@@ -165,6 +165,36 @@

   return svntest.actions.run_and_verify_status(wc_dir, expected_status)

+#----------------------------------------------------------------------
+
+def add_executable(sbox):
+  "schedule: add some executable files"
+
+  if os.name == 'posix':
+    if sbox.build():
+      return 1
+    def runTest(wc_dir, fileName, perm, executable):
+      fileName = os.path.join(wc_dir, fileName)
+      if executable:
+        expected = (["\n"], [])
+      else:
+        expected = ([], [])
+      f = open(fileName,"w")
+      f.close()
+      os.chmod(fileName,perm)
+      svntest.main.run_svn(None, 'add', fileName)
+      return expected != svntest.main.run_svn(None, 'propget',
+                                              "svn:executable", fileName)
+    test_cases = [
+      ("all_exe",  0777, True),
+      ("none_exe", 0666, False),
+      ("user_exe", 0766, True),
+      ("group_exe", 0676, False),
+      ("other_exe", 0667, False),
+      ]
+    for test_case in test_cases:
+      if runTest(sbox.wc_dir, *test_case):
+        return 1

 #----------------------------------------------------------------------

@@ -324,6 +354,44 @@

 #----------------------------------------------------------------------

+def revert_add_executable(sbox):
+  "revert: add some executable files"
+
+  if os.name == 'posix':
+    if add_executable(sbox):
+      return 1
+
+    wc_dir = sbox.wc_dir
+    all_path = os.path.join(wc_dir, 'all_exe')
+    none_path = os.path.join(wc_dir, 'none_exe')
+    user_path = os.path.join(wc_dir, 'user_exe')
+    group_path = os.path.join(wc_dir, 'group_exe')
+    other_path = os.path.join(wc_dir, 'other_exe')
+
+    expected_output = ["Reverted " + all_path + "\n",
+                       "Reverted " + none_path + "\n",
+                       "Reverted " + user_path + "\n",
+                       "Reverted " + group_path + "\n",
+                       "Reverted " + other_path + "\n"]
+
+    output, errput = svntest.main.run_svn (None, 'revert',
+                                           '--recursive', wc_dir)
+
+    # Make sure we got the right output.
+    if len(errput) > 0:
+      print errput
+      return 1
+
+    ### do we really need to sort these?
+    output.sort()
+    expected_output.sort()
+    if output != expected_output:
+      return 1
+
+    return 0
+
+#----------------------------------------------------------------------
+
 def revert_delete_files(sbox):
   "revert: delete some files"

@@ -436,6 +504,17 @@

 #----------------------------------------------------------------------

+def commit_add_executable(sbox):
+  "commit: add some executable files"
+
+  if add_executable(sbox):
+    return 1
+
+  return 1
+  return 0
+
+#----------------------------------------------------------------------
+
 def commit_delete_files(sbox):
   "commit: delete some files"

@@ -466,16 +545,19 @@
               add_files,
               add_directories,
               nested_adds,
+              add_executable,
               delete_files,
               delete_dirs,
               revert_add_files,
               revert_add_directories,
               revert_nested_adds,
+              revert_add_executable,
               revert_delete_files,
               revert_delete_dirs,
               svntest.main.XFAIL(commit_add_files),
               svntest.main.XFAIL(commit_add_directories),
               svntest.main.XFAIL(commit_nested_adds),
+              svntest.main.XFAIL(commit_add_executable),
               svntest.main.XFAIL(commit_delete_files),
               svntest.main.XFAIL(commit_delete_dirs),
              ]
Index: subversion/tests/clients/cmdline/svntest/actions.py
===================================================================
--- subversion/tests/clients/cmdline/svntest/actions.py
+++ subversion/tests/clients/cmdline/svntest/actions.py	Sat Sep 28 17:16:44 2002
@@ -43,6 +43,13 @@
     # dump the greek tree to disk.
     main.greek_state.write_to_disk(main.greek_dump_dir)

+    if os.name == 'posix':
+      # set executable bits
+      kappa_path = os.path.join(main.greek_dump_dir, 'kappa')
+      mu_path = os.path.join(main.greek_dump_dir, 'A', 'mu')
+      os.chmod(kappa_path, 0766)  # executable
+      os.chmod(mu_path, 0676)    # not executable by current user
+
     # build a URL for doing an import.
     url = main.test_area_url + '/' + main.pristine_dir

@@ -607,7 +614,21 @@
   state.desc[''] = wc.StateItem()
   state.tweak(contents=None, status='_ ', wc_rev=rev, repos_rev=rev)

-  return state
+  if os.name == 'posix':
+    # svn:executable property => underscore in 2nd column
+    state.tweak('kappa', contents=None, status='__', wc_rev=rev, repos_rev=rev)
+    return state
+
+
+def get_virginal_disk(incl_props=0):
+  "Return a virginal expected disk state."
+  disk = main.greek_state.copy()
+
+  if incl_props and (os.name == 'posix'):
+    # properties to be expected at first checkout
+    disk.tweak('kappa', props={'svn:executable' : ''})
+
+  return disk


 # Cheap administrative directory locking
Index: subversion/tests/clients/cmdline/svntest/main.py
===================================================================
--- subversion/tests/clients/cmdline/svntest/main.py
+++ subversion/tests/clients/cmdline/svntest/main.py	Sat Sep 28 16:57:49 2002
@@ -142,6 +142,7 @@
 _item = wc.StateItem
 greek_state = wc.State('', {
   'iota'        : _item("This is the file 'iota'."),
+  'kappa'       : _item("This is the executable file 'kappa'."),
   'A'           : _item(),
   'A/mu'        : _item("This is the file 'mu'."),
   'A/B'         : _item(),
Index: subversion/tests/clients/cmdline/merge_tests.py
===================================================================
--- subversion/tests/clients/cmdline/merge_tests.py
+++ subversion/tests/clients/cmdline/merge_tests.py	Sat Sep 28 16:39:43 2002
@@ -223,7 +223,7 @@
                                         'A/D/G/tau'  : Item(status='C '),
                                         })

-  expected_disk = svntest.main.greek_state.copy()
+  expected_disk = svntest.actions.get_virginal_disk()
   expected_disk.tweak('A/mu',
                       contents=expected_disk.desc['A/mu'].contents
                       + mu_text)
Index: subversion/tests/clients/cmdline/switch_tests.py
===================================================================
--- subversion/tests/clients/cmdline/switch_tests.py
+++ subversion/tests/clients/cmdline/switch_tests.py	Sat Sep 28 16:54:31 2002
@@ -62,11 +62,11 @@

 #----------------------------------------------------------------------

-def get_routine_disk_state(wc_dir):
+def get_routine_disk_state(wc_dir, check_props=0):
   """get the routine disk list for WC_DIR at the completion of an
   initial call to do_routine_switching()"""

-  disk = svntest.main.greek_state.copy()
+  disk = svntest.actions.get_virginal_disk(check_props)

   # iota has the same contents as gamma
   disk.tweak('iota', contents=disk.desc['A/D/gamma'].contents)
@@ -101,7 +101,7 @@
       })

     # Create expected disk tree (iota will have gamma's contents)
-    expected_disk = svntest.main.greek_state.copy()
+    expected_disk = svntest.actions.get_virginal_disk()
     expected_disk.tweak('iota',
                         contents=expected_disk.desc['A/D/gamma'].contents)

@@ -381,7 +381,7 @@
     })

   # Create expected disk tree
-  expected_disk = get_routine_disk_state(wc_dir)
+  expected_disk = get_routine_disk_state(wc_dir, 1)

   # Create expected status
   expected_status = get_routine_status_state(wc_dir)
@@ -503,7 +503,7 @@
     })

   # Create expected disk tree
-  expected_disk = get_routine_disk_state(wc_dir)
+  expected_disk = get_routine_disk_state(wc_dir, 1)
   expected_disk.tweak('A/D/gamma', contents="This is the file 'gamma'.apple")
   expected_disk.tweak('A/D/G/pi', contents="This is the file 'pi'.watermelon")
   expected_disk.tweak('A/B/E/alpha',



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: [PATCH] [updated] [Issue 870] import should set svn:executable automatically

Posted by Branko Čibej <br...@xbc.nu>.
Brian Denny wrote:

>Another try, including tests this time!
>
>As far as testing import, I followed Branko's suggestion to set one
>of the greek files (in the original greek_state) executable before
>import (in the setup code).  This affected some of the other (existing)
>tests.
>
>Specifically, people who write client tests should note that instead
>of writing
>  expected_disk = svntest.main.greek_state.copy()
>
>you should now write
>  expected_disk = svntest.actions.get_virginal_disk(1) # if checking props
>or
>  expected_disk = svntest.actions.get_virginal_disk()  # if not
>
>Any objections to this way of doing things?  Wrapping my head around
>the test code has been harder than writing the fix in the first place,
>so i won't take offense if you think i should do the test some other
>way.
>  
>
Doesn't that simply mean that the greek state should encapsulate 
executableness somehow? Changing these calls will just make the tests 
slower.


-- 
Brane Čibej   <br...@xbc.nu>   http://www.xbc.nu/brane/


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: [PATCH] [updated] [Issue 870] import should set svn:executable automatically

Posted by Branko Čibej <br...@xbc.nu>.
Brian Denny wrote:

>  
>
>>How on earth did you create this patch? When I try to apply it, I get:
>>    
>>
>
>my best guess is that it was munged by a mail clients, cuz i just
>tried reverting my working copy and applying the patch myself,
>and it worked just fine.
>
>so here it is again, as an attachment this time.
>  
>
This worked without a hitch. Committed in revision 3311, finally. Thanks!

-- 
Brane Čibej   <br...@xbc.nu>   http://www.xbc.nu/brane/


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: [PATCH] [updated] [Issue 870] import should set svn:executable automatically

Posted by Brian Denny <br...@briandenny.net>.

> How on earth did you create this patch? When I try to apply it, I get:

my best guess is that it was munged by a mail clients, cuz i just
tried reverting my working copy and applying the patch myself,
and it worked just fine.

so here it is again, as an attachment this time.

fwiw, the patch was created using 'svn diff', against a working copy
that was completely up to date as of the patch's creation.

% patch --version
Patch version 2.1

# in the root of the subversion wc
% patch -p0 < executable.patch
[this works for me.]

see attached file.

-brian

Re: [PATCH] [updated] [Issue 870] import should set svn:executable automatically

Posted by Branko Čibej <br...@xbc.nu>.
Brian Denny wrote:

>Another try, including tests this time!
>
>As far as testing import, I followed Branko's suggestion to set one
>of the greek files (in the original greek_state) executable before
>import (in the setup code).  This affected some of the other (existing)
>tests.
>

How on earth did you create this patch? When I try to apply it, I get:

patching file `subversion/include/svn_io.h'
patch: **** malformed patch at line 7:
 apr_pool_t *pool);



-- 
Brane Čibej   <br...@xbc.nu>   http://www.xbc.nu/brane/


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org