D3946: obsolete: resolved ValueError for var containing 2 ':' chars(issue-5783)
abhyudaypratap (ABHYUDAY PRATAP SINGH)
phabricator at mercurial-scm.org
Sat Jul 14 18:43:54 UTC 2018
abhyudaypratap created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.
REVISION SUMMARY
feature Note accepts ':' chars
So metadata of obsmarker consists of more then 1 ':' char,
The content of the variable 'data' in this function is:
'date:1518013344.878793 -3600\x00ef1:0\x00note:6c95ca::a1e17f\x00p1:ed7673f73387b36521da58a87f08e02e4a795ded\x00user:Denis Laxalde <xxx at yyy.zz>'
resulting in giving a error ValueError (too many values to unpack) because we are trying to store multiple values into two variables key and value
Resolving this error by splitting the variable 'l' from the first occurence of ':'
key, value = l.split("", 1)
REPOSITORY
rHG Mercurial
REVISION DETAIL
https://phab.mercurial-scm.org/D3946
AFFECTED FILES
mercurial/obsolete.py
CHANGE DETAILS
diff --git a/mercurial/obsolete.py b/mercurial/obsolete.py
--- a/mercurial/obsolete.py
+++ b/mercurial/obsolete.py
@@ -275,7 +275,7 @@
d = {}
for l in data.split('\0'):
if l:
- key, value = l.split(':')
+ key, value = l.split(':', 1)
d[key] = value
return d
To: abhyudaypratap, #hg-reviewers
Cc: mercurial-devel
More information about the Mercurial-devel
mailing list