changeset 22850:b078e4dc9f9a

obsstore: add a flag for sha256 hashes We add flag to inform that the marker is using sha256 hashes. As format 0 is not able to handle sha256 hashes (32 bytes long), we plain crash if we even attempt to encode a sha256 with it.
author Pierre-Yves David <pierre-yves.david@fb.com>
date Fri, 10 Oct 2014 16:43:04 -0500
parents fd759142c6e5
children 974389427e5f
files mercurial/obsolete.py
diffstat 1 files changed, 3 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/obsolete.py	Thu Oct 09 00:15:04 2014 -0700
+++ b/mercurial/obsolete.py	Fri Oct 10 16:43:04 2014 -0500
@@ -112,6 +112,7 @@
 # bumped version and fix the situation, breaking the transitivity of
 # "bumped" here.
 bumpedfix = 1
+usingsha256 = 2
 
 ## Parsing and writing of version "0"
 #
@@ -193,6 +194,8 @@
 
 def _fm0encodeonemarker(marker):
     pre, sucs, flags, metadata, date, parents = marker
+    if flags & usingsha256:
+        raise util.Abort(_('cannot handle sha256 with old obsstore format'))
     metadata = dict(metadata)
     metadata['date'] = '%d %i' % date
     if parents is not None: