Skip to content

Commit

Permalink
Introduce HOOK_UPDATE_COMMIT_ID
Browse files Browse the repository at this point in the history
  • Loading branch information
misery committed Jan 31, 2025
1 parent 653e975 commit 30fd22a
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions contrib/mercurial_git_push.py
Original file line number Diff line number Diff line change
Expand Up @@ -982,11 +982,17 @@ def _get_request(self):
links = 'submitter,update,latest_diff,draft,file_attachments'

if self._topic is None:
node = (
self.nodes(False)
if os.environ.get('HOOK_UPDATE_COMMIT_ID')
else self.commit_id
)

reqs = self.root.get_review_requests(repository=self.repo,
status='submitted',
only_fields=fields,
only_links=links,
commit_id=self.nodes(False))
commit_id=node)
if len(reqs) > 0:
raise HookError('Changeset "%s" is already known '
'in review request "%s"' %
Expand Down Expand Up @@ -1824,8 +1830,9 @@ def _handle_approved_review_requests(self, revreqs):
if self._is_multi_head_forbidden() and self._is_multi_head():
log.error('Multiple heads per branch are forbidden!')
elif 'DEBUGFAIL' not in OPTIONS:
for r in revreqs:
r.prepare_close()
if os.environ.get('HOOK_UPDATE_COMMIT_ID'):
for r in revreqs:
r.prepare_close()

for r in revreqs:
log.info('Closing review request: %s', r.id())
Expand Down

0 comments on commit 30fd22a

Please sign in to comment.