summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xgit-bz30
1 files changed, 23 insertions, 7 deletions
diff --git a/git-bz b/git-bz
index 4e833d2..de626c0 100755
--- a/git-bz
+++ b/git-bz
@@ -1736,8 +1736,10 @@ def do_apply(*args):
bug = Bug.load(BugHandle.parse_or_die(bug_ref),
attachmentdata=True)
if len(bug.patches) == 0:
- die("No patches on bug %d" % bug.id)
+ print("No patches on bug %d" % bug.id)
+ return
+ bugs_applied = []
patches = []
patches_by_id = {}
for patch in bug.patches:
@@ -1763,12 +1765,13 @@ def do_apply(*args):
continue
else:
applied = do_apply(d_id, { 'do_not_add_url': 1} )
- if applied == -1:
+ if applied is None:
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)
+ bugs_applied.extend(applied)
orig_head = git.rev_parse("HEAD")
- print "Bug %d - %s" % (bug.id, bug.short_desc)
+ print "\nBug %d - %s" % (bug.id, bug.short_desc)
print
for patch in bug.patches:
@@ -1783,7 +1786,7 @@ def do_apply(*args):
opt = prompt_multi("Apply? [(y)es, (n)o, (i)nteractive]", ["y", "n", "i"])
if opt == "n":
- return
+ return []
elif opt == "i":
template = StringIO()
template.write("# Bug %d - %s\n\n" % (bug.id, bug.short_desc))
@@ -1858,7 +1861,7 @@ FIXME: need commit message.
f.write("%s\n" % patches[i].attach_id)
f.close()
print "Patch left in %s" % filename
- return -1
+ return None # Better would be to raise an exception
os.remove(filename)
@@ -1876,6 +1879,9 @@ FIXME: need commit message.
commits = rev_list_commits(orig_head + "..")
add_url(bug, commits)
+ bugs_applied.append(bug_ref)
+ return bugs_applied
+
def strip_bug_url(bug, commit_body):
# Strip off the trailing bug URLs we add with -u; we do this before
# using commit body in as a comment; doing it by stripping right before
@@ -2644,7 +2650,7 @@ elif command == 'apply':
help="abort the current patch set and revert to original state")
add_add_url_options()
min_args = 0
- max_args = 1
+ max_args = 1000
add_signoff_option()
elif command == 'attach':
@@ -2694,7 +2700,17 @@ if len(args) < min_args or len(args) > max_args:
if command == 'add-url':
do_add_url(*args)
elif command == 'apply':
- do_apply(*args)
+ bugs_applied = []
+ for bug_ref in args:
+ if bug_ref in bugs_applied:
+ continue
+
+ applied = do_apply(bug_ref)
+
+ if applied is None:
+ break
+
+ bugs_applied.extend(applied)
elif command == 'attach':
do_attach(*args)
elif command == 'components':