changeset 5479:da039e9be459 stable

rewind: compatibility with cmdutil.revert() without parents argument
author Anton Shestakov <av6@dwimlabs.net>
date Fri, 21 Aug 2020 21:37:37 +0800
parents b0d309f64b6b
children 9242d0b5f74d
files hgext3rd/evolve/rewind.py
diffstat 1 files changed, 8 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/hgext3rd/evolve/rewind.py	Sun Aug 02 12:02:09 2020 +0800
+++ b/hgext3rd/evolve/rewind.py	Fri Aug 21 21:37:37 2020 +0800
@@ -151,8 +151,14 @@
                     revertopts = {'no_backup': True, 'all': True,
                                   'rev': oldctx.node()}
                     with ui.configoverride({(b'ui', b'quiet'): True}):
-                        cmdutil.revert(repo.ui, repo, oldctx,
-                                       repo.dirstate.parents(), **revertopts)
+                        code = cmdutil.revert.__code__
+                        # hg <= 5.5 (8c466bcb0879)
+                        if r'parents' in code.co_varnames[:code.co_argcount]:
+                            cmdutil.revert(repo.ui, repo, oldctx,
+                                           repo.dirstate.parents(),
+                                           **revertopts)
+                        else:
+                            cmdutil.revert(repo.ui, repo, oldctx, **revertopts)
                 else:
                     hg.updaterepo(repo, update_target, False)