Uploaded image for project: 'Subversion'
  1. Subversion
  2. SVN-1006

SWIG translation of svn_fs_paths_changed() is incorrect

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • all
    • 0.18
    • bindings_swig_python
    • None

    Description

      Using svn.fs.paths_changed() via the SWIG bindings currently produces
      an incorrect result; the apr_hash_t is converted to a dictionary of
      properties by default instead of a dictionary of paths mapped to
      svn_fs_path_change_t values.
      
      This patch minimally fixes that up, but requires ugliness like...
      
      changes = svn.fs.paths_changed(root, pool)
      for change in changes.keys():
        print svn.fs.path_change_t_change_kind_get(changes[change])
      
      ...just to retrieve a value. Perhaps someone with more swig-fu than I
      could enhance this to allow "changes[change].change_kind" to work? :-)
      It looks like svn.fs.dir_entries() might need to have the same magic
      applied to it as well.
      
      Simple patch included below:
      
      * subversion/bindings/swig/svn_fs.i: Add an exception to the apr_hash_t
        translation for svn_fs_paths_changed().
      
      Index: subversion/bindings/swig/svn_fs.i
      ===================================================================
      --- subversion/bindings/swig/svn_fs.i	(revision 3850)
      +++ subversion/bindings/swig/svn_fs.i	(working copy)
      @@ -102,6 +102,19 @@
               svn_swig_py_convert_hash(*$1, SWIGTYPE_p_svn_fs_dirent_t));
       }
       
      +/*
      -----------------------------------------------------------------------
      +   and except for svn_fs_paths_changed, which returns
      svn_fs_path_change_t
      +   structures
      +*/
      +
      +%typemap(in,numinputs=0) apr_hash_t **changed_paths_p = apr_hash_t
      **OUTPUT;
      +%typemap(python, argout, fragment="t_output_helper")
      +apr_hash_t **changed_paths_p {
      +    $result = t_output_helper(
      +      $result,
      +      svn_swig_py_convert_hash(*$1, SWIGTYPE_p_svn_fs_path_change_t));
      +}
      +
       /*
      ----------------------------------------------------------------------- */
      

      Original issue reported by emarshal

      Attachments

        1. 1_swig.diff
          0.8 kB
          Subversion Importer

        Activity

          People

            Unassigned Unassigned
            subversion-importer Subversion Importer
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: