keyword: sort demo output to ensure deterministic output stable
authorMartin Geisler <mg@lazybytes.net>
Thu, 26 Nov 2009 20:50:16 +0100
branchstable
changeset 9942 b6d484168350
parent 9941 11d7ee94b56a
child 9943 f8d779791161
keyword: sort demo output to ensure deterministic output
hgext/keyword.py
tests/test-keyword.out
--- a/hgext/keyword.py	Thu Nov 26 20:06:45 2009 +0100
+++ b/hgext/keyword.py	Thu Nov 26 20:50:16 2009 +0100
@@ -288,7 +288,7 @@
     '''
     def demoitems(section, items):
         ui.write('[%s]\n' % section)
-        for k, v in items:
+        for k, v in sorted(items):
             ui.write('%s = %s\n' % (k, v))
 
     msg = 'hg keyword config and expansion example'
@@ -336,7 +336,7 @@
     ui.write('[extensions]\n%s\n' % extension)
     demoitems('keyword', ui.configitems('keyword'))
     demoitems('keywordmaps', kwmaps.iteritems())
-    keywords = '$' + '$\n$'.join(kwmaps.keys()) + '$\n'
+    keywords = '$' + '$\n$'.join(sorted(kwmaps.keys())) + '$\n'
     repo.wopener(fn, 'w').write(keywords)
     repo.add([fn])
     path = repo.wjoin(fn)
--- a/tests/test-keyword.out	Thu Nov 26 20:06:45 2009 +0100
+++ b/tests/test-keyword.out	Thu Nov 26 20:50:16 2009 +0100
@@ -4,20 +4,20 @@
 [keyword]
 demo.txt = 
 [keywordmaps]
-RCSFile = {file|basename},v
 Author = {author|user}
+Date = {date|utcdate}
 Header = {root}/{file},v {node|short} {date|utcdate} {author|user}
-Source = {root}/{file},v
-Date = {date|utcdate}
 Id = {file|basename},v {node|short} {date|utcdate} {author|user}
+RCSFile = {file|basename},v
 Revision = {node|short}
-$RCSFile: demo.txt,v $
+Source = {root}/{file},v
 $Author: test $
+$Date: 2000/00/00 00:00:00 $
 $Header: /TMP/demo.txt,v xxxxxxxxxxxx 2000/00/00 00:00:00 test $
+$Id: demo.txt,v xxxxxxxxxxxx 2000/00/00 00:00:00 test $
+$RCSFile: demo.txt,v $
+$Revision: xxxxxxxxxxxx $
 $Source: /TMP/demo.txt,v $
-$Date: 2000/00/00 00:00:00 $
-$Id: demo.txt,v xxxxxxxxxxxx 2000/00/00 00:00:00 test $
-$Revision: xxxxxxxxxxxx $
 [extensions]
 hgext.keyword = 
 [keyword]