hgsubversion-queue / assert-rebuildmeta.diff

# HG changeset patch
# User Dan Villiom Podlaski Christiansen <>
# Date 1323817677 -3600
# Node ID 84bf8ace2e417a61dd0efbb6b1a374bab31a6ac9
# Parent  c987b32c6c6627ace7f169120844bf9bfd6807fd
rebuildmeta: assert that .hgtags is append-only

The code followed by the assertion assumes that tags are always
appended to .hgtags, and never deleted. This has always been the case
for hgsubversion, but I once had a patch in my queue that broke the

diff --git a/hgsubversion/ b/hgsubversion/
--- a/hgsubversion/
+++ b/hgsubversion/
@@ -208,6 +208,7 @@ def rebuildmeta(ui, repo, args, **opts):
             if '.hgtags' in parent:
                 parentdata = parent.filectx('.hgtags').data()
             newdata = ctx.filectx('.hgtags').data()
+            assert newdata.startswith(parentdata), '.hgtags is append-only'
             for newtag in newdata[len(parentdata):-1].split('\n'):
                 ha, tag = newtag.split(' ', 1)
                 tagged = repo[ha].extra().get('convert_revision', None)