comparison mercurial/commands.py @ 41382:2f2a7ea62e9a

commands: check for modheads being None Python 2 allows the > operator to be used with a None and an int. Python 3 does not. So we need to ensure the value isn't None before comparing with >. Differential Revision: https://phab.mercurial-scm.org/D5702
author Gregory Szorc <gregory.szorc@gmail.com>
date Fri, 25 Jan 2019 15:31:07 -0800
parents 609d6d8646db
children 0bd56c291359
comparison
equal deleted inserted replaced
41381:423a6b2ddafa 41382:2f2a7ea62e9a
4360 return hg.updatetotally(ui, repo, checkout, brev) 4360 return hg.updatetotally(ui, repo, checkout, brev)
4361 except error.UpdateAbort as inst: 4361 except error.UpdateAbort as inst:
4362 msg = _("not updating: %s") % stringutil.forcebytestr(inst) 4362 msg = _("not updating: %s") % stringutil.forcebytestr(inst)
4363 hint = inst.hint 4363 hint = inst.hint
4364 raise error.UpdateAbort(msg, hint=hint) 4364 raise error.UpdateAbort(msg, hint=hint)
4365 if modheads > 1: 4365 if modheads is not None and modheads > 1:
4366 currentbranchheads = len(repo.branchheads()) 4366 currentbranchheads = len(repo.branchheads())
4367 if currentbranchheads == modheads: 4367 if currentbranchheads == modheads:
4368 ui.status(_("(run 'hg heads' to see heads, 'hg merge' to merge)\n")) 4368 ui.status(_("(run 'hg heads' to see heads, 'hg merge' to merge)\n"))
4369 elif currentbranchheads > 1: 4369 elif currentbranchheads > 1:
4370 ui.status(_("(run 'hg heads .' to see heads, 'hg merge' to " 4370 ui.status(_("(run 'hg heads .' to see heads, 'hg merge' to "