comparison mercurial/changelog.py @ 42861:57ea0a81a65c

copies: remove existing copy info from the changeset on amend (BC) When amending a changeset with copy information in the changeset and the new changeset doesn't have any copy information (or similar for "filesadded" and "filesremoved"), we shouldn't keep it. A drawback of this is that we now unconditionally remove these four entries from the extras, breaking any extensions that happened to write entries with the same names (which seems very unlikely). I think I'd heard that there was list of blacklisted keys that would be removed from the extras when a commit is rewritten, but I couldn't find that. It would make sense to add the keys mentioned above there instead of the custom filtering I've added in this patch. Differential Revision: https://phab.mercurial-scm.org/D6752
author Martin von Zweigbergk <martinvonz@google.com>
date Tue, 16 Jul 2019 21:15:39 -0700
parents e3df1e15bee9
children 0b87eb2fba67
comparison
equal deleted inserted replaced
42860:6f0273558c4b 42861:57ea0a81a65c
635 % branch) 635 % branch)
636 extrasentries = p1copies, p2copies, filesadded, filesremoved 636 extrasentries = p1copies, p2copies, filesadded, filesremoved
637 if extra is None and any(x is not None for x in extrasentries): 637 if extra is None and any(x is not None for x in extrasentries):
638 extra = {} 638 extra = {}
639 sortedfiles = sorted(files) 639 sortedfiles = sorted(files)
640 if extra is not None:
641 for name in ('p1copies', 'p2copies', 'filesadded', 'filesremoved'):
642 extra.pop(name, None)
640 if p1copies is not None: 643 if p1copies is not None:
641 extra['p1copies'] = encodecopies(sortedfiles, p1copies) 644 extra['p1copies'] = encodecopies(sortedfiles, p1copies)
642 if p2copies is not None: 645 if p2copies is not None:
643 extra['p2copies'] = encodecopies(sortedfiles, p2copies) 646 extra['p2copies'] = encodecopies(sortedfiles, p2copies)
644 if filesadded is not None: 647 if filesadded is not None: