Patchwork hgk: don't break on repositories with obsolete changesets

login
register
mail settings
Submitter Andrew Shadura
Date Sept. 28, 2014, 1:21 p.m.
Message ID <2905b2bd3977b4384881.1411910512@localhost.localdomain>
Download mbox | patch
Permalink /patch/5995/
State Superseded
Commit 271a1ddad1fb68bb158b32c5447eea37d482cf38
Headers show

Comments

Andrew Shadura - Sept. 28, 2014, 1:21 p.m.
# HG changeset patch
# User Andrew Shadura <andrew@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.

Patch

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)