Bug#708170: clone doesn't properly handle blocked-by [only uses blocks]

Daniel Hartwig <[email protected]>
Newsgroups gmane.linux.debian.devel.debbugs
Message-ID <[email protected]>
Don Armstrong <[email protected]> wrote:
> On Mon, 13 May 2013, Jakub Wilk wrote:
> > Apparently the blocked-by relation between #692286 and #708166 was
> > inverted.
>
> Yeah; this is a bug in the cloning; I'll get a fix out for it soonish.

My perlfu is weak, but something like attached?
0001-make-clone-properly-handle-blocked-by-bugs.patch (text/x-diff, 1.8 KB)
>From 3ce917993c54c3e84851cfc44e367ba51e97e54d Mon Sep 17 00:00:00 2001
From: Daniel Hartwig <[email protected]>
Date: Wed, 29 May 2013 13:35:13 +0800
Subject: [PATCH] make clone properly handle blocked-by bugs

* Debbugs/Control.pm (clone_bug): Ensure that each new bug is
  correctly blocked-by the same bugs as the original.  Refactor for
  both blocks and blocked-by, perform only the minimal number of
  updates.

Closes: #708170
---
 Debbugs/Control.pm |   32 +++++++++++++++-----------------
 1 file changed, 15 insertions(+), 17 deletions(-)

diff --git a/Debbugs/Control.pm b/Debbugs/Control.pm
index 44d0062..7ce0f15 100644
--- a/Debbugs/Control.pm
+++ b/Debbugs/Control.pm
@@ -2962,25 +2962,23 @@ sub clone_bug {
     __end_control(%info);
     # bugs that this bug is blocking are also blocked by the new clone(s)
     for my $bug (split ' ', $data->{blocks}) {
-	for my $new_bug (@new_bugs) {
-	    set_blocks(bug => $new_bug,
-		       block => $bug,
-		       hash_slice(%param,
-				  keys %common_options,
-				  keys %append_action_options),
-		      );
-	}
+	set_blocks(bug => $bug,
+		   block => @new_bugs,
+		   add => 1,
+		   hash_slice(%param,
+			      keys %common_options,
+			      keys %append_action_options),
+		  );
     }
     # bugs that this bug is blocked by are also blocking the new clone(s)
-    for my $bug (split ' ', $data->{blockedby}) {
-	for my $new_bug (@new_bugs) {
-	    set_blocks(bug => $bug,
-		       block => $new_bug,
-		       hash_slice(%param,
-				  keys %common_options,
-				  keys %append_action_options),
-		      );
-	}
+    my @blockers = split ' ', $data->{blockedby};
+    for my $new_bug (@new_bugs) {
+	set_blocks(bug => $new_bug,
+		   block => @blockers,
+		   hash_slice(%param,
+			      keys %common_options,
+			      keys %append_action_options),
+		  );
     }
 }
 
-- 
1.7.10.4
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.