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
--- 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