comparison mercurial/cmdutil.py @ 50821:489268c8ee7e

cmdutil: migrate `opts` on commitstatus() to native kwargs
author Matt Harbison <matt_harbison@yahoo.com>
date Sat, 19 Aug 2023 23:06:40 -0400
parents 7b0cc86c5d74
children 13ad1b2ad3b4
comparison
equal deleted inserted replaced
50820:b922c767b214 50821:489268c8ee7e
3327 edittext.append(b"") 3327 edittext.append(b"")
3328 3328
3329 return b"\n".join(edittext) 3329 return b"\n".join(edittext)
3330 3330
3331 3331
3332 def commitstatus(repo, node, branch, bheads=None, tip=None, opts=None): 3332 def commitstatus(repo, node, branch, bheads=None, tip=None, **opts):
3333 if opts is None:
3334 opts = {}
3335 ctx = repo[node] 3333 ctx = repo[node]
3336 parents = ctx.parents() 3334 parents = ctx.parents()
3337 3335
3338 if tip is not None and repo.changelog.tip() == tip: 3336 if tip is not None and repo.changelog.tip() == tip:
3339 # avoid reporting something like "committed new head" when 3337 # avoid reporting something like "committed new head" when
3340 # recommitting old changesets, and issue a helpful warning 3338 # recommitting old changesets, and issue a helpful warning
3341 # for most instances 3339 # for most instances
3342 repo.ui.warn(_(b"warning: commit already existed in the repository!\n")) 3340 repo.ui.warn(_(b"warning: commit already existed in the repository!\n"))
3343 elif ( 3341 elif (
3344 not opts.get(b'amend') 3342 not opts.get('amend')
3345 and bheads 3343 and bheads
3346 and node not in bheads 3344 and node not in bheads
3347 and not any( 3345 and not any(
3348 p.node() in bheads and p.branch() == branch for p in parents 3346 p.node() in bheads and p.branch() == branch for p in parents
3349 ) 3347 )
3376 # C C y additional head from merge 3374 # C C y additional head from merge
3377 # C H n merge with a head 3375 # C H n merge with a head
3378 # 3376 #
3379 # H H n head merge: head count decreases 3377 # H H n head merge: head count decreases
3380 3378
3381 if not opts.get(b'close_branch'): 3379 if not opts.get('close_branch'):
3382 for r in parents: 3380 for r in parents:
3383 if r.closesbranch() and r.branch() == branch: 3381 if r.closesbranch() and r.branch() == branch:
3384 repo.ui.status( 3382 repo.ui.status(
3385 _(b'reopening closed branch head %d\n') % r.rev() 3383 _(b'reopening closed branch head %d\n') % r.rev()
3386 ) 3384 )