~jelmer/subvertpy/unstable

« back to all changes in this revision

Viewing changes to subvertpy/wc.c

  • Committer: Jelmer Vernooij
  • Date: 2011-10-26 03:07:30 UTC
  • mfrom: (1940.9.173)
  • Revision ID: jelmer@debian.org-20111026030730-8omgd8zi7y7zh0e8
New upstream release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
563
563
                return NULL;
564
564
 
565
565
        ret->pool = Pool(NULL);
566
 
        if (ret->pool == NULL)
 
566
        if (ret->pool == NULL) {
 
567
                PyObject_Del(ret);
567
568
                return NULL;
 
569
        }
568
570
 
569
571
        dup_status = svn_wc_dup_status2(status, ret->pool);
570
572
        if (dup_status == NULL)
685
687
        svn_string_t *cvalue;
686
688
        PyObject *notify_func = Py_None;
687
689
 
688
 
        if (!PyArg_ParseTuple(args, "ss#s|bO", &name, &value, &vallen, &path, &skip_checks,
 
690
        if (!PyArg_ParseTuple(args, "sz#s|bO", &name, &value, &vallen, &path, &skip_checks,
689
691
                                                  &notify_func))
690
692
                return NULL;
691
693
 
694
696
        temp_pool = Pool(NULL);
695
697
        if (temp_pool == NULL)
696
698
                return NULL;
697
 
        cvalue = svn_string_ncreate(value, vallen, temp_pool);
 
699
        if (value == NULL) {
 
700
                cvalue = NULL;
 
701
        } else {
 
702
                cvalue = svn_string_ncreate(value, vallen, temp_pool);
 
703
        }
698
704
#if ONLY_SINCE_SVN(1, 6)
699
705
        RUN_SVN_WITH_POOL(temp_pool, svn_wc_prop_set3(name, cvalue, path, admobj->adm, 
700
706
                                skip_checks, py_wc_notify_func, (void *)notify_func, 
842
848
        temp_pool = Pool(NULL);
843
849
        if (temp_pool == NULL)
844
850
                return NULL;
845
 
        RUN_SVN_WITH_POOL(temp_pool, svn_wc_get_prop_diffs(&propchanges, &original_props, 
 
851
        RUN_SVN_WITH_POOL(temp_pool, svn_wc_get_prop_diffs(&propchanges, &original_props,
846
852
                                svn_path_canonicalize(path, temp_pool), admobj->adm, temp_pool));
847
853
        py_propchanges = PyList_New(propchanges->nelts);
848
854
        if (py_propchanges == NULL) {
857
863
                        pyval = Py_BuildValue("(sO)", el.name, Py_None);
858
864
                if (pyval == NULL) {
859
865
                        apr_pool_destroy(temp_pool);
860
 
                        return NULL;
861
 
                }
862
 
                PyList_SetItem(py_propchanges, i, pyval);
 
866
                        Py_DECREF(py_propchanges);
 
867
                        return NULL;
 
868
                }
 
869
                if (PyList_SetItem(py_propchanges, i, pyval) != 0) {
 
870
                        Py_DECREF(py_propchanges);
 
871
                        apr_pool_destroy(temp_pool);
 
872
                        return NULL;
 
873
                }
863
874
        }
864
875
        py_orig_props = prop_hash_to_dict(original_props);
865
876
        apr_pool_destroy(temp_pool);
866
 
        if (py_orig_props == NULL)
 
877
        if (py_orig_props == NULL) {
 
878
                Py_DECREF(py_propchanges);
867
879
                return NULL;
 
880
        }
868
881
        return Py_BuildValue("(NN)", py_propchanges, py_orig_props);
869
882
}
870
883
 
1005
1018
                return NULL;
1006
1019
        traversal_info = svn_wc_init_traversal_info(temp_pool);
1007
1020
#if ONLY_SINCE_SVN(1, 6)
1008
 
        RUN_SVN_WITH_POOL(temp_pool, svn_wc_crawl_revisions4(path, admobj->adm, 
 
1021
        RUN_SVN_WITH_POOL(temp_pool, svn_wc_crawl_revisions4(svn_path_canonicalize(path, temp_pool), admobj->adm, 
1009
1022
                                &py_ra_reporter, (void *)reporter, 
1010
1023
                                restore_files, recurse?svn_depth_infinity:svn_depth_files,
1011
1024
                                honor_depth_exclude,
1013
1026
                                py_wc_notify_func, (void *)notify_func,
1014
1027
                                traversal_info, temp_pool));
1015
1028
#elif ONLY_SINCE_SVN(1, 5)
1016
 
        RUN_SVN_WITH_POOL(temp_pool, svn_wc_crawl_revisions3(path, admobj->adm, 
 
1029
        RUN_SVN_WITH_POOL(temp_pool, svn_wc_crawl_revisions3(svn_path_canonicalize(path, temp_pool), admobj->adm, 
1017
1030
                                &py_ra_reporter, (void *)reporter, 
1018
1031
                                restore_files, recurse?svn_depth_infinity:svn_depth_files, 
1019
1032
                                depth_compatibility_trick, use_commit_times, 
1020
1033
                                py_wc_notify_func, (void *)notify_func,
1021
1034
                                traversal_info, temp_pool));
1022
1035
#else
1023
 
        RUN_SVN_WITH_POOL(temp_pool, svn_wc_crawl_revisions2(path, admobj->adm, 
 
1036
        RUN_SVN_WITH_POOL(temp_pool, svn_wc_crawl_revisions2(svn_path_canonicalize(path, temp_pool), admobj->adm, 
1024
1037
                                &py_ra_reporter, (void *)reporter, 
1025
1038
                                restore_files, recurse, use_commit_times, 
1026
1039
                                py_wc_notify_func, (void *)notify_func,
1173
1186
        apr_array_header_t *wcprop_changes = NULL;
1174
1187
        AdmObject *admobj = (AdmObject *)self;
1175
1188
        apr_pool_t *temp_pool;
 
1189
        int digest_len;
1176
1190
        svn_boolean_t remove_changelist = FALSE;
1177
1191
        char *kwnames[] = { "path", "recurse", "new_revnum", "rev_date", "rev_author", 
1178
1192
                                                "wcprop_changes", "remove_lock", "digest", "remove_changelist", NULL };
1179
1193
 
1180
 
        if (!PyArg_ParseTupleAndKeywords(args, kwargs, "sblzz|Obzb", kwnames, 
 
1194
        if (!PyArg_ParseTupleAndKeywords(args, kwargs, "sblzz|Obz#b", kwnames, 
1181
1195
                                                                         &path, &recurse, &new_revnum, &rev_date,
1182
1196
                                                                         &rev_author, &py_wcprop_changes, 
1183
 
                                                                         &remove_lock, &digest, &remove_changelist))
 
1197
                                                                         &remove_lock, &digest, &digest_len, &remove_changelist))
1184
1198
                return NULL;
1185
1199
 
1186
1200
#if PY_VERSION_HEX < 0x02050000
2203
2217
        svn_boolean_t recurse = FALSE;
2204
2218
        apr_pool_t *temp_pool;
2205
2219
        apr_array_header_t *wcprop_changes;
 
2220
        int digest_len;
2206
2221
 
2207
 
        if (!PyArg_ParseTuple(args, "sO!|bObbz", &path, &Adm_Type, &admobj, &recurse, &py_wcprop_changes, &remove_lock, &remove_changelist, &digest))
 
2222
        if (!PyArg_ParseTuple(args, "sO!|bObbz#", &path, &Adm_Type, &admobj,
 
2223
                                                  &recurse, &py_wcprop_changes, &remove_lock,
 
2224
                                                  &remove_changelist, &digest, &digest_len))
2208
2225
                return NULL;
2209
2226
 
2210
2227
        temp_pool = Pool(NULL);
2223
2240
        }
2224
2241
 
2225
2242
        if (digest != NULL) {
 
2243
                if (digest_len != APR_MD5_DIGESTSIZE) {
 
2244
                        PyErr_SetString(PyExc_ValueError, "Invalid size for md5 digest");
 
2245
                        apr_pool_destroy(temp_pool);
 
2246
                        return NULL;
 
2247
                }
2226
2248
                digest = apr_pstrdup(self->pool, digest);
2227
2249
                if (digest == NULL) {
2228
2250
                        PyErr_NoMemory();