# HG changeset patch # User Martijn Pieters # Date 1454583811 0 # Thu Feb 04 11:03:31 2016 +0000 # Node ID d42bf856ee0973105bb4d09f00f5405cf812b4c8 # Parent 7d22fc236798ee05ff55054fff060a112c663303 Make fbamend responsible for supporting automv. Summary: This facilitates moving automv out of this repository to Mercurial proper. Use extensions.afterloaded() to avoid relying on module load order. Test Plan: Run the test suite with ../../hg/tests/run-tests.py Reviewers: rmcelroy, durham Differential Revision: https://phabricator.fb.com/D2896456 diff --git a/automv.py b/automv.py --- a/automv.py +++ b/automv.py @@ -19,13 +19,6 @@ entry = wrapcommand(commands.table, 'commit', mvcheck) entry[1].append(('', 'no-move-detection', None, _('disable automatic' + 'file move detection'))) - try: - module = extensions.find('fbamend') - entry = wrapcommand(module.cmdtable, 'amend', mvcheck) - entry[1].append(('', 'no-move-detection', None, - _('disable automatic' + 'file move detection'))) - except KeyError: - pass def mvcheck(orig, ui, repo, *pats, **opts): if not opts.get('no_move_detection'): diff --git a/fbamend.py b/fbamend.py --- a/fbamend.py +++ b/fbamend.py @@ -58,6 +58,17 @@ ] + amendopts + commands.walkopts + commands.commitopts, _('hg amend [OPTION]...'))(amend) + def has_automv(loaded): + if not loaded: + return + automv = extensions.find('automv') + entry = extensions.wrapcommand(cmdtable, 'amend', automv.mvcheck) + entry[1].append( + ('', 'no-move-detection', None, + _('disable automatic file move detection'))) + extensions.afterloaded('automv', has_automv) + + def commit(orig, ui, repo, *pats, **opts): if opts.get("amend"): # commit --amend default behavior is to prompt for edit