comparison mercurial/changelog.py @ 42300:278dcb24e535

copies: write empty entries in changeset when also writing to filelog When writing to both changeset and filelog (during transition), we don't want the reader to waste time by falling back to reading from the filelog when there is no copy metadata. Let's write out empty copy metadata instead (the read path is already prepared for this case). Thanks to Greg for pointing this out. Differential Revision: https://phab.mercurial-scm.org/D6306
author Martin von Zweigbergk <martinvonz@google.com>
date Tue, 23 Apr 2019 13:29:13 -0700
parents 5382d8f8530b
children 2a7109cc5a28
comparison
equal deleted inserted replaced
42299:80a213f9ed87 42300:278dcb24e535
589 if branch in ("default", ""): 589 if branch in ("default", ""):
590 del extra["branch"] 590 del extra["branch"]
591 elif branch in (".", "null", "tip"): 591 elif branch in (".", "null", "tip"):
592 raise error.StorageError(_('the name \'%s\' is reserved') 592 raise error.StorageError(_('the name \'%s\' is reserved')
593 % branch) 593 % branch)
594 if (p1copies or p2copies) and extra is None: 594 if (p1copies is not None or p2copies is not None) and extra is None:
595 extra = {} 595 extra = {}
596 if p1copies: 596 if p1copies is not None:
597 extra['p1copies'] = encodecopies(p1copies) 597 extra['p1copies'] = encodecopies(p1copies)
598 if p2copies: 598 if p2copies is not None:
599 extra['p2copies'] = encodecopies(p2copies) 599 extra['p2copies'] = encodecopies(p2copies)
600 600
601 if extra: 601 if extra:
602 extra = encodeextra(extra) 602 extra = encodeextra(extra)
603 parseddate = "%s %s" % (parseddate, extra) 603 parseddate = "%s %s" % (parseddate, extra)