subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From stef...@apache.org
Subject svn commit: r1689775 - in /subversion/branches/svn-mergeinfo-normalizer/tools/client-side/svn-mergeinfo-normalizer: log.c logic.c mergeinfo-normalizer.h
Date Tue, 07 Jul 2015 23:36:33 GMT
Author: stefan2
Date: Tue Jul  7 23:36:33 2015
New Revision: 1689775

URL: http://svn.apache.org/r1689775
Log:
On the svn-mergeinfo-normalizer branch:
When listing the summary of deleted branches, prefix them with the revision
in which they got deleted.  Use the log info for that - if available and
omit the info if the log is not available or the point of deletion cannot
be found in it.

* tools/client-side/svn-mergeinfo-normalizer/mergeinfo-normalizer.h
  (svn_min__find_deletion): Declare new log processing function.

* tools/client-side/svn-mergeinfo-normalizer/log.c
  (log_entry_t): Add a separate storage for deletions.
  (log_entry_receiver): Gather deletions in new container.
  (svn_min__find_deletion): Implement.

* tools/client-side/svn-mergeinfo-normalizer/logic.c
  (show_obsoletes_summary): Use the log info to find the point of deletion.
  (svn_min__run_normalize): Update caller.

Modified:
    subversion/branches/svn-mergeinfo-normalizer/tools/client-side/svn-mergeinfo-normalizer/log.c
    subversion/branches/svn-mergeinfo-normalizer/tools/client-side/svn-mergeinfo-normalizer/logic.c
    subversion/branches/svn-mergeinfo-normalizer/tools/client-side/svn-mergeinfo-normalizer/mergeinfo-normalizer.h

Modified: subversion/branches/svn-mergeinfo-normalizer/tools/client-side/svn-mergeinfo-normalizer/log.c
URL: http://svn.apache.org/viewvc/subversion/branches/svn-mergeinfo-normalizer/tools/client-side/svn-mergeinfo-normalizer/log.c?rev=1689775&r1=1689774&r2=1689775&view=diff
==============================================================================
--- subversion/branches/svn-mergeinfo-normalizer/tools/client-side/svn-mergeinfo-normalizer/log.c
(original)
+++ subversion/branches/svn-mergeinfo-normalizer/tools/client-side/svn-mergeinfo-normalizer/log.c
Tue Jul  7 23:36:33 2015
@@ -46,6 +46,7 @@ typedef struct log_entry_t
   svn_revnum_t revision;
   const char *common_base;
   apr_array_header_t *paths;
+  apr_array_header_t *deletions;
 } log_entry_t;
 
 struct svn_min__log_t
@@ -94,14 +95,26 @@ log_entry_receiver(void *baton,
   entry->paths = apr_array_make(result_pool,
                                 apr_hash_count(log_entry->changed_paths),
                                 sizeof(const char *));
+  entry->deletions = NULL;
 
   for (hi = apr_hash_first(scratch_pool, log_entry->changed_paths);
        hi;
        hi = apr_hash_next(hi))
     {
       const char *path = apr_hash_this_key(hi);
+      svn_log_changed_path_t *change = apr_hash_this_val(hi);
+
       path = internalize(log->unique_paths, path, apr_hash_this_key_len(hi));
       APR_ARRAY_PUSH(entry->paths, const char *) = path;
+
+      if (change->action == 'D')
+        {
+          if (!entry->deletions)
+            entry->deletions = apr_array_make(result_pool, 4,
+                                              sizeof(const char *));
+
+          APR_ARRAY_PUSH(entry->deletions, const char *) = path;
+        }
     }
 
   count = entry->paths->nelts;
@@ -373,6 +386,35 @@ svn_min__operative_outside_subtree(svn_m
                        subtree, result_pool);
 }
 
+svn_revnum_t
+svn_min__find_deletion(svn_min__log_t *log,
+                       const char *path,
+                       apr_pool_t *scratch_pool)
+{
+  int i, k;
+  for (i = log->entries->nelts - 1; i >= 0; --i)
+    {
+      const log_entry_t *entry = APR_ARRAY_IDX(log->entries, i,
+                                               const log_entry_t *);
+      if (!entry->deletions)
+        continue;
+
+      if (!is_relevant(entry->common_base, path, NULL))
+        continue;
+
+      for (k = 0; k < entry->deletions->nelts; ++k)
+        {
+          const char *deleted_path
+            = APR_ARRAY_IDX(entry->paths, k, const char *);
+
+          if (in_subtree(deleted_path, path, NULL))
+            return entry->revision;
+        }
+    }
+
+  return SVN_INVALID_REVNUM;
+}
+
 svn_error_t *
 svn_min__print_log_stats(svn_min__log_t *log,
                          apr_pool_t *scratch_pool)

Modified: subversion/branches/svn-mergeinfo-normalizer/tools/client-side/svn-mergeinfo-normalizer/logic.c
URL: http://svn.apache.org/viewvc/subversion/branches/svn-mergeinfo-normalizer/tools/client-side/svn-mergeinfo-normalizer/logic.c?rev=1689775&r1=1689774&r2=1689775&view=diff
==============================================================================
--- subversion/branches/svn-mergeinfo-normalizer/tools/client-side/svn-mergeinfo-normalizer/logic.c
(original)
+++ subversion/branches/svn-mergeinfo-normalizer/tools/client-side/svn-mergeinfo-normalizer/logic.c
Tue Jul  7 23:36:33 2015
@@ -768,6 +768,7 @@ processing_title(svn_min__opt_state_t *o
 
 static svn_error_t *
 show_obsoletes_summary(svn_min__branch_lookup_t *lookup,
+                       svn_min__log_t *log,
                        svn_min__opt_state_t *opt_state,
                        apr_pool_t *scratch_pool)
 {
@@ -793,10 +794,18 @@ show_obsoletes_summary(svn_min__branch_l
                              paths->nelts));
   for (i = 0; i < paths->nelts; ++i)
     {
+      svn_revnum_t deletion_rev; 
       const char *path = APR_ARRAY_IDX(paths, i, const char *);
 
       svn_pool_clear(iterpool);
-      SVN_ERR(svn_cmdline_printf(iterpool, _("    %s\n"), path));
+      deletion_rev = log ? svn_min__find_deletion(log, path, iterpool)
+                         : SVN_INVALID_REVNUM;
+
+      if (SVN_IS_VALID_REVNUM(deletion_rev))
+        SVN_ERR(svn_cmdline_printf(iterpool, _("    [r%ld] %s\n"),
+                                   deletion_rev, path));
+      else
+        SVN_ERR(svn_cmdline_printf(iterpool, _("    %s\n"), path));
     }
 
   svn_pool_destroy(iterpool);
@@ -878,7 +887,8 @@ svn_min__run_normalize(apr_getopt_t *os,
       SVN_ERR(svn_min__remove_empty_mergeinfo(wc_mergeinfo));
 
       /* Show a summary of deleted branches. */
-      SVN_ERR(show_obsoletes_summary(lookup, cmd_baton->opt_state, iterpool));
+      SVN_ERR(show_obsoletes_summary(lookup, log, cmd_baton->opt_state,
+                                     iterpool));
 
       /* show results */
       if (!cmd_baton->opt_state->quiet)

Modified: subversion/branches/svn-mergeinfo-normalizer/tools/client-side/svn-mergeinfo-normalizer/mergeinfo-normalizer.h
URL: http://svn.apache.org/viewvc/subversion/branches/svn-mergeinfo-normalizer/tools/client-side/svn-mergeinfo-normalizer/mergeinfo-normalizer.h?rev=1689775&r1=1689774&r2=1689775&view=diff
==============================================================================
--- subversion/branches/svn-mergeinfo-normalizer/tools/client-side/svn-mergeinfo-normalizer/mergeinfo-normalizer.h
(original)
+++ subversion/branches/svn-mergeinfo-normalizer/tools/client-side/svn-mergeinfo-normalizer/mergeinfo-normalizer.h
Tue Jul  7 23:36:33 2015
@@ -180,6 +180,11 @@ svn_min__operative_outside_subtree(svn_m
                                    svn_rangelist_t *ranges,
                                    apr_pool_t *result_pool);
 
+svn_revnum_t
+svn_min__find_deletion(svn_min__log_t *log,
+                       const char *path,
+                       apr_pool_t *scratch_pool);
+
 svn_error_t *
 svn_min__print_log_stats(svn_min__log_t *log,
                          apr_pool_t *scratch_pool);



Mime
View raw message