Show More
@@ -5,6 +5,7 | |||
|
5 | 5 | # This software may be used and distributed according to the terms of the |
|
6 | 6 | # GNU General Public License version 2 or any later version. |
|
7 | 7 | |
|
8 | import cPickle | |
|
8 | 9 | from i18n import _ |
|
9 | 10 | import encoding, util |
|
10 | 11 | |
@@ -77,6 +78,16 class debugformatter(baseformatter): | |||
|
77 | 78 | baseformatter.end(self) |
|
78 | 79 | self._ui.write("]\n") |
|
79 | 80 | |
|
81 | class pickleformatter(baseformatter): | |
|
82 | def __init__(self, ui, topic, opts): | |
|
83 | baseformatter.__init__(self, ui, topic, opts) | |
|
84 | self._data = [] | |
|
85 | def _showitem(self): | |
|
86 | self._data.append(self._item) | |
|
87 | def end(self): | |
|
88 | baseformatter.end(self) | |
|
89 | self._ui.write(cPickle.dumps(self._data)) | |
|
90 | ||
|
80 | 91 | class jsonformatter(baseformatter): |
|
81 | 92 | def __init__(self, ui, topic, opts): |
|
82 | 93 | baseformatter.__init__(self, ui, topic, opts) |
@@ -108,6 +119,8 def formatter(ui, topic, opts): | |||
|
108 | 119 | template = opts.get("template", "") |
|
109 | 120 | if template == "json": |
|
110 | 121 | return jsonformatter(ui, topic, opts) |
|
122 | elif template == "pickle": | |
|
123 | return pickleformatter(ui, topic, opts) | |
|
111 | 124 | elif template == "debug": |
|
112 | 125 | return debugformatter(ui, topic, opts) |
|
113 | 126 | elif template != "": |
@@ -128,4 +128,14 Issue294: hg remove --after dir fails wh | |||
|
128 | 128 | ../t.h (glob) |
|
129 | 129 | ../t/e.h (glob) |
|
130 | 130 | |
|
131 | $ hg files | |
|
132 | ../b | |
|
133 | ../dir.h/foo | |
|
134 | ../t.h | |
|
135 | ../t/b | |
|
136 | ../t/e.h | |
|
137 | ../t/x | |
|
138 | $ hg files . | |
|
139 | [1] | |
|
140 | ||
|
131 | 141 |
$ |
@@ -202,6 +202,12 hg status -A: | |||
|
202 | 202 | } |
|
203 | 203 | ] |
|
204 | 204 | |
|
205 | $ hg status -A -Tpickle > pickle | |
|
206 | >>> import pickle | |
|
207 | >>> print sorted((x['status'], x['path']) for x in pickle.load(open("pickle"))) | |
|
208 | [('!', 'deleted'), ('?', 'pickle'), ('?', 'unknown'), ('A', 'added'), ('A', 'copied'), ('C', '.hgignore'), ('C', 'modified'), ('I', 'ignored'), ('R', 'removed')] | |
|
209 | $ rm pickle | |
|
210 | ||
|
205 | 211 |
$ |
|
206 | 212 |
$ |
|
207 | 213 | $ touch ignoreddir/file |
General Comments 0
You need to be logged in to leave comments.
Login now