[PATCH] hgk: don't break on repositories with obsolete changesets

Andrew Shadura andrew at shadura.me
Sun Sep 28 08:21:52 CDT 2014


# HG changeset patch
# User Andrew Shadura <andrew at shadura.me>
# Date 1411910489 -7200
#      Sun Sep 28 15:21:29 2014 +0200
# Node ID 2905b2bd3977b438488126bd38734bb64fad1063
# Parent  dd7041b135cfd4bc1f090a2ee98e30735d738fc5
hgk: don't break on repositories with obsolete changesets

Check the existence of a changeset before adding it to the list
returned by debug-rev-list command.

diff --git a/hgext/hgk.py b/hgext/hgk.py
--- a/hgext/hgk.py
+++ b/hgext/hgk.py
@@ -204,10 +204,12 @@ def revtree(ui, args, repo, full="tree",
                     l[chunk - x:] = [0] * (chunk - x)
                     break
                 if full is not None:
-                    l[x] = repo[i + x]
-                    l[x].changeset() # force reading
+                    if (i + x) in repo:
+                        l[x] = repo[i + x]
+                        l[x].changeset() # force reading
                 else:
-                    l[x] = 1
+                    if (i + x) in repo:
+                        l[x] = 1
             for x in xrange(chunk - 1, -1, -1):
                 if l[x] != 0:
                     yield (i + x, full is not None and l[x] or None)


More information about the Mercurial-devel mailing list