Patchwork [4,of,5] changegroup: reproduce correct changegroup for tombstoned initial revision

login
register
mail settings
Submitter adgar@google.com
Date Nov. 6, 2014, 7:03 p.m.
Message ID <f268f988ccb395bc2b69.1415300590@adgar.nyc.corp.google.com>
Download mbox | patch
Permalink /patch/6613/
State Changes Requested
Headers show

Comments

adgar@google.com - Nov. 6, 2014, 7:03 p.m.
# HG changeset patch
# User Mike Edgar <adgar@google.com>
# Date 1409575109 -7200
#      Mon Sep 01 14:38:29 2014 +0200
# Node ID f268f988ccb395bc2b693d624d2e6a41d9998aba
# Parent  deb363985dc862197fdc06bd2ed9d00f08a8e508
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 deb363985dc8 -r f268f988ccb3 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
@@ -429,7 +429,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)