Patchwork [7,of,7,RFC,v2] merge: linear updates to censored data revisions produce empty files

login
register
mail settings
Submitter michaeljedgar@gmail.com
Date Sept. 15, 2014, 12:01 p.m.
Message ID <36724b851222bd5c1166.1410782488@adgar-macbookpro3.roam.corp.google.com>
Download mbox | patch
Permalink /patch/5825/
State Accepted
Headers show

Comments

michaeljedgar@gmail.com - Sept. 15, 2014, 12:01 p.m.
# HG changeset patch
# User Mike Edgar <adgar@google.com>
# Date 1410727292 14400
#      Sun Sep 14 16:41:32 2014 -0400
# Node ID 36724b851222bd5c11667c0f00f2b099f177eee8
# Parent  03684b2891165ba0f6626216a1a6eaed4c502547
merge: linear updates to censored data revisions produce empty files

The same configuration check done in verify is done in update to determine if
the update should be rejected or should substitute the empty file.

Patch

diff -r 03684b289116 -r 36724b851222 mercurial/merge.py
--- a/mercurial/merge.py	Sun Sep 14 20:32:34 2014 -0400
+++ b/mercurial/merge.py	Sun Sep 14 16:41:32 2014 -0400
@@ -597,7 +597,15 @@ 
         repo.ui.debug(" %s: %s -> g\n" % (f, msg))
         if verbose:
             repo.ui.note(_("getting %s\n") % f)
-        wwrite(f, fctx(f).data(), args[0])
+        fc = fctx(f)
+        try:
+            data = fc.data()
+        except errormod.CensoredNodeError, e:
+            if not fc.censorallowed():
+                raise
+            repo.ui.warn(_('warning: censored file is empty: %s\n') % f)
+            data = ''
+        wwrite(f, data, args[0])
         if i == 100:
             yield i, f
             i = 0