changeset 1557:dd409375c261

wrappers: adapt to introduction of logcmdutil package in hg
author Augie Fackler <raf@durin42.com>
date Sat, 24 Mar 2018 16:57:49 -0400
parents 53d170a6c3c8
children ae572c9be4e6
files hgsubversion/wrappers.py
diffstat 1 files changed, 12 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/hgsubversion/wrappers.py
+++ b/hgsubversion/wrappers.py
@@ -18,6 +18,13 @@ from mercurial import util as hgutil
 from mercurial import node
 from mercurial import i18n
 from mercurial import extensions
+try:
+    # hg 4.6 and later
+    from mercurial import logcmdutil
+    logcmdutil.changesetdisplayer
+except ImportError:
+    # hg 4.5 and earlier
+    logcmdutil = None
 from mercurial import repair
 from mercurial import revset
 from mercurial import scmutil
@@ -70,7 +77,11 @@ def parents(orig, ui, repo, *args, **opt
     ha = util.parentrev(ui, repo, meta, hashes)
     if ha.node() == node.nullid:
         raise hgerror.Abort('No parent svn revision!')
-    displayer = cmdutil.show_changeset(ui, repo, opts, buffered=False)
+    if logcmdutil is not None:
+        displayer = logcmdutil.changesetdisplayer(
+            ui, repo, opts, buffered=False)
+    else:
+        displayer = cmdutil.show_changeset(ui, repo, opts, buffered=False)
     displayer.show(ha)
     return 0