Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 10 additions & 8 deletions ome_merge.py
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,6 @@ def __init__(self, filters, reset=False):
except:
log.error("Failed to find %s", repo_name, exc_info=1)
self.candidate_pulls = []
self.modifications = 0
self.find_candidates()

def find_candidates(self):
Expand Down Expand Up @@ -308,6 +307,11 @@ def info(self):
(pullrequest.pr.issue_url, pullrequest.get_title(), pullrequest.get_login())
print

def fast_forward(self, base):
"""Execute merge --ff-only against the current base"""
dbg("## Merging base to ensure closed PRs are included.")
call("git", "merge", "--ff-only", base)

def merge(self, comment=False):
"""Merge candidate pull requests."""
dbg("## Unique users: %s", self.unique_logins())
Expand All @@ -326,7 +330,6 @@ def merge(self, comment=False):
try:
call("git", "merge", "--no-ff", "-m", \
"%s: PR %s (%s)" % (self.commit_id(), pullrequest.get_number(), pullrequest.get_title()), pullrequest.get_sha())
self.modifications += 1
merged_pulls.append(pullrequest)
except:
call("git", "reset", "--hard", "%s" % premerge_sha)
Expand Down Expand Up @@ -356,7 +359,7 @@ def merge(self, comment=False):

call("git", "submodule", "update")

def submodules(self, info=False, comment=False):
def submodules(self, base, info=False, comment=False):
"""Recursively merge PRs for each submodule."""

submodule_paths = call("git", "submodule", "--quiet", "foreach", \
Expand All @@ -374,19 +377,18 @@ def submodules(self, info=False, comment=False):
if info:
submodule_repo.info()
else:
submodule.fast_forward(base)
submodule_repo.merge(comment)
submodule_repo.submodules(info)
self.modifications += submodule_repo.modifications
finally:
try:
if submodule_repo:
submodule_repo.cleanup()
finally:
cd(cwd)

if self.modifications:
call("git", "commit", "--allow-empty", "-a", "-n", "-m", \
"%s: Update all modules w/o hooks" % self.commit_id())
call("git", "commit", "--allow-empty", "-a", "-n", "-m", \
"%s: Update all modules w/o hooks" % self.commit_id())

def get_name(self):
"""Return name of the repository."""
Expand Down Expand Up @@ -502,7 +504,7 @@ def get_repository_info():
try:
if not args.info:
main_repo.merge(args.comment)
main_repo.submodules(args.info, args.comment) # Recursive
main_repo.submodules(args.base, args.info, args.comment) # Recursive

if args.buildnumber:
newbranch = "HEAD:%s/%g" % (args.base, args.build_number)
Expand Down