comparison hgext3rd/topic/__init__.py @ 4522:001eb0f11bcd stable

topic: add compatibility for writing copy metadata in changelog.add() As seen in hg 0e41f40b01cc.
author Anton Shestakov <av6@dwimlabs.net>
date Wed, 17 Apr 2019 18:46:41 +0800
parents e23f85bc43ed
children f6099a171a9d
comparison
equal deleted inserted replaced
4521:5303b9128714 4522:001eb0f11bcd
565 else: 565 else:
566 # Empty key will be dropped from extra by another hack at the changegroup level 566 # Empty key will be dropped from extra by another hack at the changegroup level
567 self._extra[constants.extrakey] = '' 567 self._extra[constants.extrakey] = ''
568 568
569 def wrapadd(orig, cl, manifest, files, desc, transaction, p1, p2, user, 569 def wrapadd(orig, cl, manifest, files, desc, transaction, p1, p2, user,
570 date=None, extra=None): 570 date=None, extra=None, p1copies=None, p2copies=None):
571 if constants.extrakey in extra and not extra[constants.extrakey]: 571 if constants.extrakey in extra and not extra[constants.extrakey]:
572 extra = extra.copy() 572 extra = extra.copy()
573 del extra[constants.extrakey] 573 del extra[constants.extrakey]
574 # hg <= 4.9 (0e41f40b01cc)
575 kwargs = {}
576 if p1copies is not None:
577 kwargs['p1copies'] = p1copies
578 if p2copies is not None:
579 kwargs['p2copies'] = p2copies
574 return orig(cl, manifest, files, desc, transaction, p1, p2, user, 580 return orig(cl, manifest, files, desc, transaction, p1, p2, user,
575 date=date, extra=extra) 581 date=date, extra=extra, **kwargs)
576 582
577 # revset predicates are automatically registered at loading via this symbol 583 # revset predicates are automatically registered at loading via this symbol
578 revsetpredicate = topicrevset.revsetpredicate 584 revsetpredicate = topicrevset.revsetpredicate
579 585
580 @command('topics', [ 586 @command('topics', [