diff --git a/mercurial/formatter.py b/mercurial/formatter.py
index 7a7eed5176a4d753a64482e2bd9d40873eeea6ab_bWVyY3VyaWFsL2Zvcm1hdHRlci5weQ==..968247e8f4ac1ad90ae77ae067cf7db2c0fe4c4e_bWVyY3VyaWFsL2Zvcm1hdHRlci5weQ== 100644
--- a/mercurial/formatter.py
+++ b/mercurial/formatter.py
@@ -5,6 +5,7 @@
 # This software may be used and distributed according to the terms of the
 # GNU General Public License version 2 or any later version.
 
+import cPickle
 from i18n import _
 import encoding, util
 
@@ -77,6 +78,16 @@
         baseformatter.end(self)
         self._ui.write("]\n")
 
+class pickleformatter(baseformatter):
+    def __init__(self, ui, topic, opts):
+        baseformatter.__init__(self, ui, topic, opts)
+        self._data = []
+    def _showitem(self):
+        self._data.append(self._item)
+    def end(self):
+        baseformatter.end(self)
+        self._ui.write(cPickle.dumps(self._data))
+
 class jsonformatter(baseformatter):
     def __init__(self, ui, topic, opts):
         baseformatter.__init__(self, ui, topic, opts)
@@ -108,6 +119,8 @@
     template = opts.get("template", "")
     if template == "json":
         return jsonformatter(ui, topic, opts)
+    elif template == "pickle":
+        return pickleformatter(ui, topic, opts)
     elif template == "debug":
         return debugformatter(ui, topic, opts)
     elif template != "":
diff --git a/tests/test-locate.t b/tests/test-locate.t
index 7a7eed5176a4d753a64482e2bd9d40873eeea6ab_dGVzdHMvdGVzdC1sb2NhdGUudA==..968247e8f4ac1ad90ae77ae067cf7db2c0fe4c4e_dGVzdHMvdGVzdC1sb2NhdGUudA== 100644
--- a/tests/test-locate.t
+++ b/tests/test-locate.t
@@ -128,4 +128,14 @@
   ../t.h (glob)
   ../t/e.h (glob)
 
+  $ hg files
+  ../b
+  ../dir.h/foo
+  ../t.h
+  ../t/b
+  ../t/e.h
+  ../t/x
+  $ hg files .
+  [1]
+
   $ cd ../..
diff --git a/tests/test-status.t b/tests/test-status.t
index 7a7eed5176a4d753a64482e2bd9d40873eeea6ab_dGVzdHMvdGVzdC1zdGF0dXMudA==..968247e8f4ac1ad90ae77ae067cf7db2c0fe4c4e_dGVzdHMvdGVzdC1zdGF0dXMudA== 100644
--- a/tests/test-status.t
+++ b/tests/test-status.t
@@ -202,6 +202,12 @@
    }
   ]
 
+  $ hg status -A -Tpickle > pickle
+  >>> import pickle
+  >>> print sorted((x['status'], x['path']) for x in pickle.load(open("pickle")))
+  [('!', 'deleted'), ('?', 'pickle'), ('?', 'unknown'), ('A', 'added'), ('A', 'copied'), ('C', '.hgignore'), ('C', 'modified'), ('I', 'ignored'), ('R', 'removed')]
+  $ rm pickle
+
   $ echo "^ignoreddir$" > .hgignore
   $ mkdir ignoreddir
   $ touch ignoreddir/file