comparison mercurial/cmdutil.py @ 51551:a151fd01e98c

postincoming: move to cmdutil This looks like a good place for it to live.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Wed, 27 Mar 2024 17:29:48 +0000
parents f15cb5111a1e
children 15e680a44502
comparison
equal deleted inserted replaced
51550:f28d5d68b71a 51551:a151fd01e98c
4133 def hgabortgraft(ui, repo): 4133 def hgabortgraft(ui, repo):
4134 """abort logic for aborting graft using 'hg abort'""" 4134 """abort logic for aborting graft using 'hg abort'"""
4135 with repo.wlock(): 4135 with repo.wlock():
4136 graftstate = statemod.cmdstate(repo, b'graftstate') 4136 graftstate = statemod.cmdstate(repo, b'graftstate')
4137 return abortgraft(ui, repo, graftstate) 4137 return abortgraft(ui, repo, graftstate)
4138
4139
4140 def postincoming(ui, repo, modheads, optupdate, checkout, brev):
4141 """Run after a changegroup has been added via pull/unbundle
4142
4143 This takes arguments below:
4144
4145 :modheads: change of heads by pull/unbundle
4146 :optupdate: updating working directory is needed or not
4147 :checkout: update destination revision (or None to default destination)
4148 :brev: a name, which might be a bookmark to be activated after updating
4149
4150 return True if update raise any conflict, False otherwise.
4151 """
4152 if modheads == 0:
4153 return False
4154 if optupdate:
4155 # avoid circular import
4156 from . import hg
4157
4158 try:
4159 return hg.updatetotally(ui, repo, checkout, brev)
4160 except error.UpdateAbort as inst:
4161 msg = _(b"not updating: %s") % stringutil.forcebytestr(inst)
4162 hint = inst.hint
4163 raise error.UpdateAbort(msg, hint=hint)
4164 if ui.quiet:
4165 pass # we won't report anything so the other clause are useless.
4166 elif modheads is not None and modheads > 1:
4167 currentbranchheads = len(repo.branchheads())
4168 if currentbranchheads == modheads:
4169 ui.status(
4170 _(b"(run 'hg heads' to see heads, 'hg merge' to merge)\n")
4171 )
4172 elif currentbranchheads > 1:
4173 ui.status(
4174 _(b"(run 'hg heads .' to see heads, 'hg merge' to merge)\n")
4175 )
4176 else:
4177 ui.status(_(b"(run 'hg heads' to see heads)\n"))
4178 elif not ui.configbool(b'commands', b'update.requiredest'):
4179 ui.status(_(b"(run 'hg update' to get a working copy)\n"))
4180 return False