summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJonathan Druart <jonathan.druart@bugs.koha-community.org>2016-09-08 22:46:41 +0100
committerJonathan Druart <jonathan.druart@bugs.koha-community.org>2016-09-08 23:00:19 +0100
commit127f251ce377f2a4b1300452a0ab93a7ee5e6481 (patch)
tree89c5541b888455285679719e5c0b922937fcaed3
parentabebfb52b52eebe8d44a66562459e2707b9badf9 (diff)
downloadgit-bz-127f251ce377f2a4b1300452a0ab93a7ee5e6481.tar.gz
Apply dependencies on cascade
If a bug report depends on others in Needs Signoff, Signed Off or Passed QA status, you will now be able to apply the patches from the dependent bugs. Note that if something is going wrong, the process won't continue as you could expect. git bz apply --continue will continue the patch set in conflict and not the followings. For instance Bug 42 depends on bug 421 and 422 which depends on bug 4221 % git bz apply 42 Bug 42 Depends on bug 421 Follow? [(y)es, (n)o] y Bug 421 - XXX Apply? [(y)es, (n)o, (i)nteractive] Applying: Bug 421: commit msg 421 Bug 42 Depends on bug 422 Follow? [(y)es, (n)o] y Bug 422 Depends on bug 4221 Follow? [(y)es, (n)o] y Bug 4221 - XXX Apply? [(y)es, (n)o, (i)nteractive] Applying: Bug 4221: commit msg 4221 Bug 422 - XXX Apply? [(y)es, (n)o, (i)nteractive] Applying: Bug 422: commit msg 422 Bug 42 - XXX Apply? [(y)es, (n)o, (i)nteractive] Applying: Bug 42: commit msg 42
-rwxr-xr-xgit-bz28
1 files changed, 26 insertions, 2 deletions
diff --git a/git-bz b/git-bz
index 643d14c..5d89815 100755
--- a/git-bz
+++ b/git-bz
@@ -1649,6 +1649,7 @@ def do_apply(*args):
git_dir = git.rev_parse(git_dir=True)
resuming = global_options.resolved or global_options.skip or global_options.abort
+ do_not_add_url = 0
if len(args) == 0:
if not resuming:
die(parser.get_usage())
@@ -1690,6 +1691,8 @@ def do_apply(*args):
die(parser.get_usage())
bug_ref = args[0]
+ if len(args) > 1:
+ do_not_add_url = args[1]['do_not_add_url']
orig_head = git.rev_parse("HEAD")
bug = Bug.load(BugHandle.parse_or_die(bug_ref),
@@ -1706,6 +1709,27 @@ def do_apply(*args):
for pid in patch_ids:
patches.append(patches_by_id[pid])
else:
+ dependencies = bug.depends.split(' ');
+ for d_id in dependencies:
+ if d_id == '':
+ continue
+ dep_bug = Bug.load(BugHandle.parse_or_die(d_id),
+ attachmentdata=False)
+ s = dep_bug.bug_status
+ if s == "Needs Signoff" \
+ or s == 'Signed Off' \
+ or s == 'Passed QA':
+ print "\nBug %s Depends on bug %s" % ( bug.id, dep_bug.id)
+ opt = prompt_multi("Follow? [(y)es, (n)o]", ["y", "n"])
+ if opt == "n":
+ continue
+ else:
+ applied = do_apply(d_id, { 'do_not_add_url': 1} )
+ if applied == -1:
+ die("\nCannot apply cleanly patches from bug %s. Everything will be left dirty.\ngit bz apply --continue will not continue the process if patches from other bug reports need to be applied." % d_id)
+
+ orig_head = git.rev_parse("HEAD")
+
print "Bug %d - %s" % (bug.id, bug.short_desc)
print
@@ -1796,7 +1820,7 @@ FIXME: need commit message.
f.write("%s\n" % patches[i].attach_id)
f.close()
print "Patch left in %s" % filename
- return
+ return -1
os.remove(filename)
@@ -1806,7 +1830,7 @@ FIXME: need commit message.
except CalledProcessError:
print >>sys.stderr, "Warning: left dummy commit message"
- if global_options.add_url:
+ if global_options.add_url and not do_not_add_url:
# Slightly hacky. We could add the URLs as we go by using
# git-mailinfo to parse each patch, calling
# add_url_to_subject_body(), and then reassembling. That would