comparison mercurial/cmdutil.py @ 47062:f38bf44e077f stable

black: make codebase compatible with black v21.4b2 and v20.8b1 I don't know what exact version of black made it care about these whitespace differences, but this is the version I got when I just installed it with `pip3 install black`. I'm intentionally not increasing the version of black required, as I don't want to force everyone to upgrade their version of black, and these fixes are backwards compatible with black v20.8b1. If there are more issues in the future and this becomes a maintenance burden I may do so in a future change. Tested with both versions of black (I got the older version via `pip3 install black==20.8b1`) Differential Revision: https://phab.mercurial-scm.org/D10539
author Kyle Lippincott <spectral@google.com>
date Fri, 30 Apr 2021 16:13:02 -0700
parents d9531094cf8e
children bea4717415c0
comparison
equal deleted inserted replaced
47061:bd2ed1032b4e 47062:f38bf44e077f
324 324
325 return datemaydiffer 325 return datemaydiffer
326 326
327 327
328 def checknotesize(ui, opts): 328 def checknotesize(ui, opts):
329 """ make sure note is of valid format """ 329 """make sure note is of valid format"""
330 330
331 note = opts.get(b'note') 331 note = opts.get(b'note')
332 if not note: 332 if not note:
333 return 333 return
334 334
970 970
971 raise error.UnknownCommand(cmd, allcmds) 971 raise error.UnknownCommand(cmd, allcmds)
972 972
973 973
974 def changebranch(ui, repo, revs, label, opts): 974 def changebranch(ui, repo, revs, label, opts):
975 """ Change the branch name of given revs to label """ 975 """Change the branch name of given revs to label"""
976 976
977 with repo.wlock(), repo.lock(), repo.transaction(b'branches'): 977 with repo.wlock(), repo.lock(), repo.transaction(b'branches'):
978 # abort in case of uncommitted merge or dirty wdir 978 # abort in case of uncommitted merge or dirty wdir
979 bailifchanged(repo) 979 bailifchanged(repo)
980 revs = scmutil.revrange(repo, revs) 980 revs = scmutil.revrange(repo, revs)
1106 for s in sorted(ctx.substate): 1106 for s in sorted(ctx.substate):
1107 ctx.sub(s).bailifchanged(hint=hint) 1107 ctx.sub(s).bailifchanged(hint=hint)
1108 1108
1109 1109
1110 def logmessage(ui, opts): 1110 def logmessage(ui, opts):
1111 """ get the log message according to -m and -l option """ 1111 """get the log message according to -m and -l option"""
1112 1112
1113 check_at_most_one_arg(opts, b'message', b'logfile') 1113 check_at_most_one_arg(opts, b'message', b'logfile')
1114 1114
1115 message = opts.get(b'message') 1115 message = opts.get(b'message')
1116 logfile = opts.get(b'logfile') 1116 logfile = opts.get(b'logfile')
3918 nodes = repo.vfs.read(b'graftstate').splitlines() 3918 nodes = repo.vfs.read(b'graftstate').splitlines()
3919 return {b'nodes': nodes} 3919 return {b'nodes': nodes}
3920 3920
3921 3921
3922 def hgabortgraft(ui, repo): 3922 def hgabortgraft(ui, repo):
3923 """ abort logic for aborting graft using 'hg abort'""" 3923 """abort logic for aborting graft using 'hg abort'"""
3924 with repo.wlock(): 3924 with repo.wlock():
3925 graftstate = statemod.cmdstate(repo, b'graftstate') 3925 graftstate = statemod.cmdstate(repo, b'graftstate')
3926 return abortgraft(ui, repo, graftstate) 3926 return abortgraft(ui, repo, graftstate)