comparison mercurial/dispatch.py @ 15019:f4b7be3f8430 stable

dispatch: don't rewrap aliases that have the same definition Previously aliases that overrode existing commands would wrap the old alias on every call to dispatch() (twice actually), which is an obvious re-entrancy issue for things like the command server or TortoiseHG.
author Idan Kamara <idankk86@gmail.com>
date Thu, 04 Aug 2011 19:41:23 +0300
parents 188936b334b1
children 1e45b92f4fb2
comparison
equal deleted inserted replaced
15018:e89f62dcd723 15019:f4b7be3f8430
352 # aliases are processed after extensions have been loaded, so they 352 # aliases are processed after extensions have been loaded, so they
353 # may use extension commands. Aliases can also use other alias definitions, 353 # may use extension commands. Aliases can also use other alias definitions,
354 # but only if they have been defined prior to the current definition. 354 # but only if they have been defined prior to the current definition.
355 for alias, definition in ui.configitems('alias'): 355 for alias, definition in ui.configitems('alias'):
356 aliasdef = cmdalias(alias, definition, cmdtable) 356 aliasdef = cmdalias(alias, definition, cmdtable)
357
358 try:
359 olddef = cmdtable[aliasdef.cmd][0]
360 if olddef.definition == aliasdef.definition:
361 continue
362 except (KeyError, AttributeError):
363 # definition might not exist or it might not be a cmdalias
364 pass
365
357 cmdtable[aliasdef.cmd] = (aliasdef, aliasdef.opts, aliasdef.help) 366 cmdtable[aliasdef.cmd] = (aliasdef, aliasdef.opts, aliasdef.help)
358 if aliasdef.norepo: 367 if aliasdef.norepo:
359 commands.norepo += ' %s' % alias 368 commands.norepo += ' %s' % alias
360 369
361 def _parse(ui, args): 370 def _parse(ui, args):