Patchwork [17,of,21,RFC] changegroup: reproduce correct changegroup for tombstoned initial revision

login
register
mail settings
Submitter michaeljedgar@gmail.com
Date Sept. 11, 2014, 12:26 a.m.
Message ID <a6272d4ba78bbc579ef8.1410395178@adgar-macbookpro3.roam.corp.google.com>
Download mbox | patch
Permalink /patch/5792/
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 1409575109 -7200
#      Mon Sep 01 14:38:29 2014 +0200
# Node ID a6272d4ba78bbc579ef868ca188ee8e8f3e9e0c6
# Parent  8b22ce5c409431c8ec9fc0ac1b4d93e8816069cb
changegroup: reproduce correct changegroup for tombstoned initial revision

The first revision of a file in a revlog is special-cased in revchunk to
simply emit the full contents of that revision. This will fail when bundling a
file whose initial revision is a censor tombstone.

This change catches the error caused by the tombstone and allows revchunk to
emit the tombstone as an initial revision.

Patch

diff -r 8b22ce5c4094 -r a6272d4ba78b mercurial/changegroup.py
--- a/mercurial/changegroup.py	Mon Sep 01 13:49:30 2014 +0200
+++ b/mercurial/changegroup.py	Mon Sep 01 14:38:29 2014 +0200
@@ -417,7 +417,10 @@ 
 
         prefix = ''
         if base == nullrev:
-            delta = revlog.revision(node)
+            try:
+                delta = revlog.revision(node)
+            except error.CensoredNodeError, e:
+                delta = e.metadata
             prefix = mdiff.trivialdiffheader(len(delta))
         else:
             delta = revlog.revdiff(base, rev)