bookmarks: write bookmarks file deterministically
authorGregory Szorc <gregory.szorc@gmail.com>
Mon, 26 Feb 2018 13:34:35 -0800
changeset 36453 bfb4494f846d
parent 36452 ab81e5a8fba5
child 36454 698fe0f6eb5c
bookmarks: write bookmarks file deterministically Bookmarks are internally stored as an unsorted dictionary. Let's at least write out the bookmarks file in a deterministic order so it is easier to test, diff, etc. Differential Revision: https://phab.mercurial-scm.org/D2469
mercurial/bookmarks.py
--- a/mercurial/bookmarks.py	Mon Feb 26 13:32:03 2018 -0800
+++ b/mercurial/bookmarks.py	Mon Feb 26 13:34:35 2018 -0800
@@ -179,7 +179,7 @@
         self._aclean = True
 
     def _write(self, fp):
-        for name, node in self.iteritems():
+        for name, node in sorted(self.iteritems()):
             fp.write("%s %s\n" % (hex(node), encoding.fromlocal(name)))
         self._clean = True
         self._repo.invalidatevolatilesets()