Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Fix commit message generation.

  • Loading branch information...
commit 10662ed248c80193b72d76d89d7f05cb860186f1 1 parent ec017f8
Marc Jessome authored

Showing 1 changed file with 10 additions and 8 deletions. Show diff stats Hide diff stats

  1. +10 8 scripts/autoland/hgpusher.py
18 scripts/autoland/hgpusher.py
@@ -319,7 +319,8 @@ def verify(self):
319 319 # 3. patch applies using 'qimport; qpush'
320 320 (patch_success, err) = import_patch(self.active_repo,
321 321 patch, self.try_run, self.bug_id, self.branch,
322   - user=patch.user, try_syntax=self.try_syntax)
  322 + user=patch.user, try_syntax=self.try_syntax,
  323 + landing_user=self.user)
323 324 if not patch_success:
324 325 log.error('[Patch %s] could not verify import:\n%s'
325 326 % (patch.num, err))
@@ -419,7 +420,7 @@ def has_sufficient_permissions(user_email, branch):
419 420 return common.in_ldap_group(LDAP, user_email, group)
420 421
421 422 def import_patch(repo, patch, try_run, bug_id, branch, user=None,
422   - try_syntax=config['hg_try_syntax']):
  423 + try_syntax=config['hg_try_syntax'], landing_user=None):
423 424 """
424 425 Import patch file patch into a mercurial queue.
425 426
@@ -436,13 +437,13 @@ def import_patch(repo, patch, try_run, bug_id, branch, user=None,
436 437 return (ret == 0, err)
437 438
438 439 cmd = ['qrefresh', '-R', repo]
439   - # if a user field specified, which may only be on a Try run,
440   - # qrefesh that name in there
441   - if user:
  440 + # This will only ever be specified on a try run, but just make sure
  441 + if try_run and user:
442 442 cmd.extend(['-u', user])
443 443 # if it is not a try run, handle the addition of a=... r=... (al=... b=...)
444 444 if not try_run:
445   - c_msg = generate_commit_message(repo, user, bug_id, patch, branch)
  445 + c_msg = generate_commit_message(repo, landing_user,
  446 + bug_id, patch, branch)
446 447 if not c_msg: return (0, "Couldn't generate commit message")
447 448 cmd.extend(['-m', c_msg])
448 449
@@ -486,8 +487,9 @@ def generate_commit_message(repo, user, bug_id, patch, branch):
486 487 % (r_types[rev['type']], rev['reviewer']['email'])
487 488 if not re.search('\s+a=[^\s]+', output):
488 489 app = get_approval_for_branch(patch, branch)
489   - if not app: return None
490   - output += ' a=%s' % (app['approver']['email'])
  490 + # if not app: return None
  491 + if app:
  492 + output += ' a=%s' % (app['approver']['email'])
491 493 output += ' (al=%s b=%s)' % (user, bug_id)
492 494 return output
493 495

0 comments on commit 10662ed

Please sign in to comment.
Something went wrong with that request. Please try again.