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

login
register
mail settings
Submitter michaeljedgar@gmail.com
Date Sept. 11, 2014, 12:26 a.m.
Message ID <4bbfce796c8e21ba2c40.1410395170@adgar-macbookpro3.roam.corp.google.com>
Download mbox | patch
Permalink /patch/5784/
State Changes Requested
Headers show

Comments

michaeljedgar@gmail.com - Sept. 11, 2014, 12:26 a.m.
# HG changeset patch
# User Mike Edgar <adgar@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.

Patch

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]: