~svn/ubuntu/oneiric/subversion/ppa

« back to all changes in this revision

Viewing changes to subversion/libsvn_repos/rev_hunt.c

  • Committer: Package Import Robot
  • Author(s): Peter Samuelson
  • Date: 2011-06-01 17:07:33 UTC
  • mto: (0.4.8 sid) (1.9.1 upstream) (44.3.2 quantal)
  • mto: This revision was merged to the branch mainline in revision 57.
  • Revision ID: package-import@ubuntu.com-20110601170733-voh3ackx4i28pc77
Tags: upstream-1.6.17dfsg
ImportĀ upstreamĀ versionĀ 1.6.17dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
1029
1029
};
1030
1030
 
1031
1031
/* Check for merges in OLD_PATH_REV->PATH at OLD_PATH_REV->REVNUM.  Store
1032
 
   the mergeinfo difference in MERGED_MERGEINFO, allocated in POOL. */
 
1032
   the mergeinfo difference in *MERGED_MERGEINFO, allocated in POOL.  The
 
1033
   returned *MERGED_MERGEINFO will be NULL if there are no changes. */
1033
1034
static svn_error_t *
1034
1035
get_merged_mergeinfo(apr_hash_t **merged_mergeinfo,
1035
1036
                     svn_repos_t *repos,
1039
1040
  apr_pool_t *subpool = svn_pool_create(pool);
1040
1041
  apr_hash_t *curr_mergeinfo, *prev_mergeinfo, *deleted, *changed;
1041
1042
  svn_error_t *err;
 
1043
  svn_fs_root_t *root;
 
1044
  apr_hash_t *changed_paths;
 
1045
  const char *path = old_path_rev->path;
 
1046
 
 
1047
  /* Getting/parsing/diffing svn:mergeinfo is expensive, so only do it
 
1048
     if there is a property change. */
 
1049
  SVN_ERR(svn_fs_revision_root(&root, repos->fs, old_path_rev->revnum,
 
1050
                               subpool));
 
1051
  SVN_ERR(svn_fs_paths_changed2(&changed_paths, root, subpool));
 
1052
  while (1)
 
1053
    {
 
1054
      svn_fs_path_change2_t *changed_path = apr_hash_get(changed_paths,
 
1055
                                                         path,
 
1056
                                                         APR_HASH_KEY_STRING);
 
1057
      if (changed_path && changed_path->prop_mod)
 
1058
        break;
 
1059
      if (svn_dirent_is_root(path, strlen(path)))
 
1060
        {
 
1061
          svn_pool_destroy(subpool);
 
1062
          *merged_mergeinfo = NULL;
 
1063
          return SVN_NO_ERROR;
 
1064
        }
 
1065
      path = svn_path_dirname(path, subpool);
 
1066
    }
1042
1067
 
1043
1068
  /* First, find the mergeinfo difference for old_path_rev->revnum, and
1044
1069
     old_path_rev->revnum - 1. */
1048
1073
                           old_path_rev->revnum - 1, subpool);
1049
1074
  if (err && err->apr_err == SVN_ERR_FS_NOT_FOUND)
1050
1075
    {
1051
 
      /* If the path doesn't exist in the previous revision, assume empty
1052
 
         mergeinfo. */
 
1076
      /* If the path doesn't exist in the previous revision, assume no
 
1077
         merges */
1053
1078
      svn_error_clear(err);
1054
 
      prev_mergeinfo = apr_hash_make(subpool);
 
1079
      svn_pool_destroy(subpool);
 
1080
      *merged_mergeinfo = NULL;
 
1081
      return SVN_NO_ERROR;
1055
1082
    }
1056
1083
  else
1057
1084
    SVN_ERR(err);
1059
1086
  /* Then calculate and merge the differences. */
1060
1087
  SVN_ERR(svn_mergeinfo_diff(&deleted, &changed, prev_mergeinfo, curr_mergeinfo,
1061
1088
                             FALSE, subpool));
1062
 
  SVN_ERR(svn_mergeinfo_merge(changed, deleted, subpool));
 
1089
  if (apr_hash_count(deleted))
 
1090
    SVN_ERR(svn_mergeinfo_merge(changed, deleted, subpool));
1063
1091
 
1064
1092
  /* Store the result. */
1065
 
  *merged_mergeinfo = svn_mergeinfo_dup(changed, pool);
 
1093
  if (apr_hash_count(changed))
 
1094
    *merged_mergeinfo = svn_mergeinfo_dup(changed, pool);
 
1095
  else
 
1096
    *merged_mergeinfo = NULL;
1066
1097
 
1067
1098
  svn_pool_destroy(subpool);
1068
1099