changeset 42553:e3df1e15bee9

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
author Martin von Zweigbergk <martinvonz@google.com>
date Mon, 01 Jul 2019 16:25:51 -0700
parents 4cafbd3b50c6
children d26e4a434fe5
files mercurial/changelog.py
diffstat 1 files changed, 4 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- 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):