changeset 7394:9ca238e56396

hg: update diff between repositories to support Mercurial 4.8 by using the makeunionrepository factory
author Mads Kiilerich <mads@kiilerich.com>
date Mon, 29 Oct 2018 01:20:21 +0100
parents 6834e1265415
children 475d54df23f5
files kallithea/controllers/compare.py
diffstat 1 files changed, 8 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/kallithea/controllers/compare.py	Mon Oct 29 01:20:21 2018 +0100
+++ b/kallithea/controllers/compare.py	Mon Oct 29 01:20:21 2018 +0100
@@ -95,9 +95,14 @@
         elif alias == 'hg':
             # case two independent repos
             if org_repo != other_repo:
-                hgrepo = unionrepo.unionrepository(other_repo.baseui,
-                                                   other_repo.path,
-                                                   org_repo.path)
+                try:
+                    hgrepo = unionrepo.makeunionrepository(other_repo.baseui,
+                                                           other_repo.path,
+                                                           org_repo.path)
+                except AttributeError: # makeunionrepository was introduced in Mercurial 4.8 23f2299e9e53
+                    hgrepo = unionrepo.unionrepository(other_repo.baseui,
+                                                       other_repo.path,
+                                                       org_repo.path)
                 # all ancestors of other_rev will be in other_repo and
                 # rev numbers from hgrepo can be used in other_repo - org_rev ancestors cannot