comparison mercurial/bookmarks.py @ 37239:bfb4494f846d

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
author Gregory Szorc <gregory.szorc@gmail.com>
date Mon, 26 Feb 2018 13:34:35 -0800
parents cd2342302928
children a5eefc9cccc5
comparison
equal deleted inserted replaced
37238:ab81e5a8fba5 37239:bfb4494f846d
177 else: 177 else:
178 self._repo.vfs.tryunlink('bookmarks.current') 178 self._repo.vfs.tryunlink('bookmarks.current')
179 self._aclean = True 179 self._aclean = True
180 180
181 def _write(self, fp): 181 def _write(self, fp):
182 for name, node in self.iteritems(): 182 for name, node in sorted(self.iteritems()):
183 fp.write("%s %s\n" % (hex(node), encoding.fromlocal(name))) 183 fp.write("%s %s\n" % (hex(node), encoding.fromlocal(name)))
184 self._clean = True 184 self._clean = True
185 self._repo.invalidatevolatilesets() 185 self._repo.invalidatevolatilesets()
186 186
187 def expandname(self, bname): 187 def expandname(self, bname):