changelog: fix handling of empty copy entries in changeset
Before this patch, when an empty value was found in the changeset, we
would get a ValueError, which would result in None being returned for
addedfiles/removedfiles and p1copies/p2copies. That made 278dcb24e535
(copies: write empty entries in changeset when also writing to
filelog, 2019-04-23) ineffective at helping the read path not look for
copies in the filelogs.
Differential Revision: https://phab.mercurial-scm.org/D6595
--- a/mercurial/changelog.py Sun Jun 30 17:52:57 2019 +0530
+++ b/mercurial/changelog.py Mon Jul 01 16:25:51 2019 -0700
@@ -92,6 +92,8 @@
def decodecopies(files, data):
try:
copies = {}
+ if not data:
+ return copies
for l in data.split('\n'):
strindex, src = l.split('\0')
i = int(strindex)
@@ -114,6 +116,8 @@
def decodefileindices(files, data):
try:
subset = []
+ if not data:
+ return subset
for strindex in data.split('\n'):
i = int(strindex)
if i < 0 or i >= len(files):