changeset 38138:18c6d8b565bf

state: set canonical=True to write deterministically Passing canonical=True to cbor.dump() will help in writing the data deterministically. This will sort all the sets and dicts before writing to the file. Thanks indygreg for recommending to use it. Differential Revision: https://phab.mercurial-scm.org/D3578
author Pulkit Goyal <7895pulkit@gmail.com>
date Fri, 18 May 2018 16:34:19 +0530
parents 36a5a1239a15
children a0e4d654bceb
files mercurial/state.py
diffstat 1 files changed, 1 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/state.py	Wed Mar 28 16:31:16 2018 +0530
+++ b/mercurial/state.py	Fri May 18 16:34:19 2018 +0530
@@ -57,7 +57,7 @@
         we use third-party library cbor to serialize data to write in the file.
         """
         with self._repo.vfs(self.fname, 'wb', atomictemp=True) as fp:
-            cbor.dump(self.opts, fp)
+            cbor.dump(self.opts, fp, canonical=True)
 
     def _read(self):
         """reads the state file and returns a dictionary which contain