comparison hgext3rd/topic/__init__.py @ 6701:f0cbc19e77ef

topic: drop compatibility for changelog.add() for hg 5.5 and older Core Mercurial kinda made a circle with first adding p{1,2}copies in 4.9, then adding files{added,removed} in 5.0 and then removing all these kwargs again in 5.6 (6c56277317c2). We are aiming to only be compatible with 5.6 and later, so this extra code can be removed.
author Anton Shestakov <av6@dwimlabs.net>
date Wed, 10 Jan 2024 15:28:20 -0300
parents a7d94f235488
children 691a9301b51e
comparison
equal deleted inserted replaced
6700:a7d94f235488 6701:f0cbc19e77ef
971 else: 971 else:
972 # Empty key will be dropped from extra by another hack at the changegroup level 972 # Empty key will be dropped from extra by another hack at the changegroup level
973 self._extra[constants.extrakey] = b'' 973 self._extra[constants.extrakey] = b''
974 974
975 def wrapadd(orig, cl, manifest, files, desc, transaction, p1, p2, user, 975 def wrapadd(orig, cl, manifest, files, desc, transaction, p1, p2, user,
976 date=None, extra=None, p1copies=None, p2copies=None, 976 date=None, extra=None):
977 filesadded=None, filesremoved=None):
978 if b'topic-namespace' in extra and extra[b'topic-namespace'] == b'none': 977 if b'topic-namespace' in extra and extra[b'topic-namespace'] == b'none':
979 extra = extra.copy() 978 extra = extra.copy()
980 del extra[b'topic-namespace'] 979 del extra[b'topic-namespace']
981 if constants.extrakey in extra and not extra[constants.extrakey]: 980 if constants.extrakey in extra and not extra[constants.extrakey]:
982 extra = extra.copy() 981 extra = extra.copy()
983 del extra[constants.extrakey] 982 del extra[constants.extrakey]
984 if constants.extrakey not in extra and b'topic-namespace' in extra: 983 if constants.extrakey not in extra and b'topic-namespace' in extra:
985 # if topic is not in extra, drop namespace as well 984 # if topic is not in extra, drop namespace as well
986 extra = extra.copy() 985 extra = extra.copy()
987 del extra[b'topic-namespace'] 986 del extra[b'topic-namespace']
988 # hg <= 4.9 (0e41f40b01cc)
989 kwargs = {}
990 if p1copies is not None:
991 kwargs['p1copies'] = p1copies
992 if p2copies is not None:
993 kwargs['p2copies'] = p2copies
994 # hg <= 5.0 (f385ba70e4af)
995 if filesadded is not None:
996 kwargs['filesadded'] = filesadded
997 if filesremoved is not None:
998 kwargs['filesremoved'] = filesremoved
999 return orig(cl, manifest, files, desc, transaction, p1, p2, user, 987 return orig(cl, manifest, files, desc, transaction, p1, p2, user,
1000 date=date, extra=extra, **kwargs) 988 date=date, extra=extra)
1001 989
1002 def applychangewrap(orig, self): 990 def applychangewrap(orig, self):
1003 orig(self) 991 orig(self)
1004 repo = self.repo 992 repo = self.repo
1005 rulectx = repo[self.node] 993 rulectx = repo[self.node]