# HG changeset patch # User Pierre-Yves David # Date 1542594044 0 # Node ID 47f569581ad28fe9cd5115fa6efcf0a7205178fb # Parent cd0c331c430a727afa05b2cf58121f799b23e327 compat: drop 4.3 "new troubles" report code This is supported natively for Mercurial 4.4 and above. diff -r cd0c331c430a -r 47f569581ad2 hgext3rd/evolve/__init__.py --- a/hgext3rd/evolve/__init__.py Mon Nov 19 02:18:58 2018 +0000 +++ b/hgext3rd/evolve/__init__.py Mon Nov 19 02:20:44 2018 +0000 @@ -285,7 +285,6 @@ context, dirstate, error, - extensions, help, hg, lock as lockmod, @@ -781,45 +780,6 @@ _warnobsoletewc(ui, repo) return res -# XXX this could wrap transaction code -# XXX (but this is a bit a layer violation) -@eh.wrapcommand("commit") -@eh.wrapcommand("import") -@eh.wrapcommand("push") -@eh.wrapcommand("pull") -@eh.wrapcommand("graft") -@eh.wrapcommand("phase") -@eh.wrapcommand("unbundle") -def warnobserrors(orig, ui, repo, *args, **kwargs): - """display warning is the command resulted in more instable changeset""" - # hg < 4.4 does not have the feature built in. bail out otherwise. - if util.safehasattr(scmutil, '_reportstroubledchangesets'): - return orig(ui, repo, *args, **kwargs) - - # part of the troubled stuff may be filtered (stash ?) - # This needs a better implementation but will probably wait for core. - filtered = repo.changelog.filteredrevs - priorunstables = len(set(getrevs(repo, 'orphan')) - filtered) - priorbumpeds = len(set(getrevs(repo, 'phasedivergent')) - filtered) - priordivergents = len(set(getrevs(repo, 'contentdivergent')) - filtered) - ret = orig(ui, repo, *args, **kwargs) - filtered = repo.changelog.filteredrevs - newunstables = \ - len(set(getrevs(repo, 'orphan')) - filtered) - priorunstables - newbumpeds = \ - len(set(getrevs(repo, 'phasedivergent')) - filtered) - priorbumpeds - newdivergents = \ - len(set(getrevs(repo, 'contentdivergent')) - filtered) - priordivergents - - base_msg = _('%i new %s changesets\n') - if newunstables > 0: - ui.warn(base_msg % (newunstables, compat.TROUBLES['ORPHAN'])) - if newbumpeds > 0: - ui.warn(base_msg % (newbumpeds, compat.TROUBLES['PHASEDIVERGENT'])) - if newdivergents > 0: - ui.warn(base_msg % (newdivergents, compat.TROUBLES['CONTENTDIVERGENT'])) - return ret - @eh.wrapfunction(mercurial.exchange, 'push') def push(orig, repo, *args, **opts): """Add a hint for "hg evolve" when troubles make push fails @@ -845,28 +805,6 @@ def obssummarysetup(ui): cmdutil.summaryhooks.add('evolve', summaryhook) - -##################################################################### -### Core Other extension compat ### -##################################################################### - - -@eh.extsetup -def _rebasewrapping(ui): - # warning about more obsolete - try: - rebase = extensions.find('rebase') - if rebase: - extensions.wrapcommand(rebase.cmdtable, 'rebase', warnobserrors) - except KeyError: - pass # rebase not found - try: - histedit = extensions.find('histedit') - if histedit: - extensions.wrapcommand(histedit.cmdtable, 'histedit', warnobserrors) - except KeyError: - pass # histedit not found - ##################################################################### ### Old Evolve extension content ### ##################################################################### @@ -1335,14 +1273,6 @@ @eh.extsetup def oldevolveextsetup(ui): - for cmd in ['prune', 'uncommit', 'touch', 'fold']: - try: - entry = extensions.wrapcommand(cmdtable, cmd, - warnobserrors) - except error.UnknownCommand: - # Commands may be disabled - continue - entry = cmdutil.findcmd('commit', commands.table)[1] entry[1].append(('o', 'obsolete', [], _("make commit obsolete this revision (DEPRECATED)")))