Mercurial > public > mercurial-scm > hg
comparison mercurial/changelog.py @ 18378:404feac78b8a
tests: stabilize doctest output
Avoid dependencies to dict iteration order.
author | Mads Kiilerich <mads@kiilerich.com> |
---|---|
date | Tue, 15 Jan 2013 02:59:14 +0100 |
parents | 4e27b06a0fd9 |
children | e0c4f4ba624c |
comparison
equal
deleted
inserted
replaced
18377:56b805306955 | 18378:404feac78b8a |
---|---|
25 text = text.replace('\\', '\\\\').replace('\n', '\\n').replace('\r', '\\r') | 25 text = text.replace('\\', '\\\\').replace('\n', '\\n').replace('\r', '\\r') |
26 return text.replace('\0', '\\0') | 26 return text.replace('\0', '\\0') |
27 | 27 |
28 def decodeextra(text): | 28 def decodeextra(text): |
29 """ | 29 """ |
30 >>> decodeextra(encodeextra({'foo': 'bar', 'baz': chr(0) + '2'})) | 30 >>> from pprint import pprint as pp |
31 {'foo': 'bar', 'baz': '\\x002', 'branch': 'default'} | 31 >>> pp(decodeextra(encodeextra({'foo': 'bar', 'baz': chr(0) + '2'}))) |
32 >>> decodeextra(encodeextra({'foo': 'bar', 'baz': chr(92) + chr(0) + '2'})) | 32 {'baz': '\\x002', 'branch': 'default', 'foo': 'bar'} |
33 {'foo': 'bar', 'baz': '\\\\\\x002', 'branch': 'default'} | 33 >>> pp(decodeextra(encodeextra({'foo': 'bar', |
34 ... 'baz': chr(92) + chr(0) + '2'}))) | |
35 {'baz': '\\\\\\x002', 'branch': 'default', 'foo': 'bar'} | |
34 """ | 36 """ |
35 extra = _defaultextra.copy() | 37 extra = _defaultextra.copy() |
36 for l in text.split('\0'): | 38 for l in text.split('\0'): |
37 if l: | 39 if l: |
38 if '\\0' in l: | 40 if '\\0' in l: |