D6595: changelog: fix handling of empty copy entries in changeset

martinvonz (Martin von Zweigbergk) phabricator at mercurial-scm.org
Thu Jul 4 15:00:02 UTC 2019


martinvonz created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.
pulkit accepted this revision.
This revision is now accepted and ready to land.

REVISION SUMMARY
  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 <https://phab.mercurial-scm.org/rHG278dcb24e53570e2d55bc9ac1079686ebbad83e0>
  (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.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D6595

AFFECTED FILES
  mercurial/changelog.py

CHANGE DETAILS

diff --git a/mercurial/changelog.py b/mercurial/changelog.py
--- a/mercurial/changelog.py
+++ b/mercurial/changelog.py
@@ -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):



To: martinvonz, #hg-reviewers
Cc: mercurial-devel


More information about the Mercurial-devel mailing list