[PATCH stable] pure: fix index parsing on empty repositories

Wagner Bruna wagner.bruna+thg at gmail.com
Thu Feb 17 09:51:17 CST 2011


# HG changeset patch
# User Wagner Bruna <wbruna at softwareexpress.com.br>
# Date 1297957072 7200
# Branch stable
# Node ID e71af93f6d630c952dd8eb9519c76333b520f12a
# Parent  ed720c7cc97d329b943d299075e898cb40c29ab2
pure: fix index parsing on empty repositories

diff --git a/mercurial/pure/parsers.py b/mercurial/pure/parsers.py
--- a/mercurial/pure/parsers.py
+++ b/mercurial/pure/parsers.py
@@ -56,10 +56,11 @@ def parse_index2(data, inline):
             n += 1
             off += s
 
-    e = list(index[0])
-    type = gettype(e[0])
-    e[0] = offset_type(0, type)
-    index[0] = tuple(e)
+    if index:
+        e = list(index[0])
+        type = gettype(e[0])
+        e[0] = offset_type(0, type)
+        index[0] = tuple(e)
 
     # add the magic null revision at -1
     index.append((0, 0, 0, -1, -1, -1, -1, nullid))


More information about the Mercurial-devel mailing list