changeset 5480:9242d0b5f74d stable

split: compatibility with cmdutil.revert() without parents argument `assert` is here because I'm not sure if this is enough, and we might not have tests that fail this specific assert.
author Anton Shestakov <av6@dwimlabs.net>
date Fri, 21 Aug 2020 23:04:03 +0800
parents da039e9be459
children 565194775c41 1896d6bc574b
files hgext3rd/evolve/cmdrewrite.py
diffstat 1 files changed, 10 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/hgext3rd/evolve/cmdrewrite.py	Fri Aug 21 21:37:37 2020 +0800
+++ b/hgext3rd/evolve/cmdrewrite.py	Fri Aug 21 23:04:03 2020 +0800
@@ -1308,6 +1308,13 @@
                         # prompting for confirmation
                         ui.status(_(b'discarding remaining changes\n'))
                         target = newcommits[0]
+                        args = []
+                        kwargs = {}
+                        code = cmdutil.revert.__code__
+                        # hg <= 5.5 (8c466bcb0879)
+                        if r'parents' in code.co_varnames[:code.co_argcount]:
+                            args.append((target, node.nullid))
+                        assert target.node() == repo.dirstate.p1()
                         if pats:
                             status = repo.status(match=matcher)
                             dirty = set()
@@ -1315,12 +1322,10 @@
                             dirty.update(status.added)
                             dirty.update(status.removed)
                             dirty.update(status.deleted)
-                            dirty = sorted(dirty)
-                            cmdutil.revert(ui, repo, repo[target],
-                                           (target, node.nullid), *dirty)
+                            args += sorted(dirty)
                         else:
-                            cmdutil.revert(ui, repo, repo[target],
-                                           (target, node.nullid), all=True)
+                            kwargs[r'all'] = True
+                        cmdutil.revert(ui, repo, repo[target], *args, **kwargs)
                     elif nextaction == b'?':
                         nextaction = None
                         ui.write(_(b"y - yes, continue selection\n"))