changeset 6544:44bc900ba5db

topic: compatibility for tr.changes[b'phases'] in hg 5.3 and older tr.changes[b'phases'] used to be a dict keyed with revnums, but now it's a list of tuples where the first element is a range() of revnums. In this patch, instead of properly converting the data (i.e. grouping revisions into ranges), we just wrap every individual revnum into a 1-tuple. This is not ideal, but good enough for the existing code below.
author Anton Shestakov <av6@dwimlabs.net>
date Thu, 03 Aug 2023 16:32:41 -0300
parents b0cbad4d841f
children 7b2bd0332b56
files hgext3rd/topic/__init__.py
diffstat 1 files changed, 5 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/hgext3rd/topic/__init__.py	Mon Jul 31 16:47:42 2023 -0300
+++ b/hgext3rd/topic/__init__.py	Thu Aug 03 16:32:41 2023 -0300
@@ -463,7 +463,11 @@
     # - forcefully making changesets draft again
     # - turning secret changesets draft and making them visible to peers
     tnsphases = (phases.secret, phases.draft)
-    for revs, (old, new) in tr.changes[b'phases']:
+    phasechanges = tr.changes[b'phases']
+    if isinstance(phasechanges, dict):
+        # hg <= 5.3 (fdc802f29b2c)
+        phasechanges = [((k,), v) for k, v in phasechanges.items()]
+    for revs, (old, new) in phasechanges:
         if old not in tnsphases and new not in tnsphases:
             # Skip phase movement if there is no phase (old or new) that has
             # visible topic namespace (i.e. draft and secret)