# HG changeset patch # User Pulkit Goyal <7895pulkit@gmail.com> # Date 2018-05-18 11:04:19 # Node ID 18c6d8b565bf25281243990b9614a61a4ced7f77 # Parent 36a5a1239a151cc91edd385f4da8c157f3326926 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 diff --git a/mercurial/state.py b/mercurial/state.py --- a/mercurial/state.py +++ b/mercurial/state.py @@ -57,7 +57,7 @@ class cmdstate(object): 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