[PATCH 09 of 21 RFC] cmdutil: abort when checking out censored file data using revert

michaeljedgar at gmail.com michaeljedgar at gmail.com
Wed Sep 10 19:26:10 CDT 2014


# HG changeset patch
# User Mike Edgar <adgar at google.com>
# Date 1409585495 -7200
#      Mon Sep 01 17:31:35 2014 +0200
# Node ID 4bbfce796c8e21ba2c40abb93f30bb49cb04b7a6
# Parent  f773537e5d12817f3523d86920c0df62062dd108
cmdutil: abort when checking out censored file data using revert

Users who wish to check out file data from a previous revision into their
working copy must receive an error if they request censored data: the data no
longer exists. The -X option can be used when --all fails due to censored data.

diff -r f773537e5d12 -r 4bbfce796c8e mercurial/cmdutil.py
--- a/mercurial/cmdutil.py	Mon Sep 01 01:40:34 2014 +0200
+++ b/mercurial/cmdutil.py	Mon Sep 01 17:31:35 2014 +0200
@@ -2623,7 +2623,11 @@
     node = ctx.node()
     def checkout(f):
         fc = ctx[f]
-        repo.wwrite(f, fc.data(), fc.flags())
+        try:
+            repo.wwrite(f, fc.data(), fc.flags())
+        except error.CensoredNodeError:
+            raise util.Abort(_('file %s is censored at %s, cannot checkout') %
+                (f, short(node)))
 
     audit_path = pathutil.pathauditor(repo.root)
     for f in actions['remove'][0]:


More information about the Mercurial-devel mailing list