commit:     97c95795e04fb46fbe527e9846780e52c9aa59ef
Author:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Fri Feb  9 19:39:47 2018 +0000
Commit:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Fri Feb  9 19:40:28 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=97c95795

dev-vcs/hg-git: add patches from upstream for hg 4.5

Package-Manager: Portage-2.3.19, Repoman-2.3.6

 .../hg-git/files/hg-git-0.8.10-hg45-memctx.patch   | 43 +++++++++++++
 .../files/hg-git-0.8.10-hg45-memfilectx.patch      | 73 ++++++++++++++++++++++
 dev-vcs/hg-git/hg-git-0.8.10-r1.ebuild             | 29 +++++++++
 3 files changed, 145 insertions(+)

diff --git a/dev-vcs/hg-git/files/hg-git-0.8.10-hg45-memctx.patch 
b/dev-vcs/hg-git/files/hg-git-0.8.10-hg45-memctx.patch
new file mode 100644
index 00000000000..ff9d4d66d15
--- /dev/null
+++ b/dev-vcs/hg-git/files/hg-git-0.8.10-hg45-memctx.patch
@@ -0,0 +1,43 @@
+# HG changeset patch
+# User Tony Tung <tonyt...@merly.org>
+# Date 1517901695 28800
+# Node ID 843f409526fbea3ffde674922b730075d5cfd4d3
+# Parent  6dc827703bfb995b89b0da5b2e9eaffe3479ea45
+compat: pass memctx to memfilectx constructor on hg 4.5+
+
+diff --git a/hggit/git_handler.py b/hggit/git_handler.py
+--- a/hggit/git_handler.py
++++ b/hggit/git_handler.py
+@@ -985,16 +985,22 @@
+                 if copied:
+                     copied_path = copied[0]
+ 
+-            try:
+-                return context.memfilectx(self.repo, f, data,
+-                                          islink='l' in e,
+-                                          isexec='x' in e,
+-                                          copied=copied_path)
+-            except TypeError:
+-                return context.memfilectx(f, data,
+-                                          islink='l' in e,
+-                                          isexec='x' in e,
+-                                          copied=copied_path)
++            # Different versions of mercurial have different parameters to
++            # memfilectx.  Try them from newest to oldest.
++            args_to_try = (
++                (self.repo, memctx, f, data),   # hg 4.5+
++                (self.repo, f, data),           # hg 3.1 - 4.5
++                (f, data),                      # hg < 3.1
++            )
++            for args in args_to_try:
++                try:
++                    return context.memfilectx(*args,
++                                              islink='l' in e,
++                                              isexec='x' in e,
++                                              copied=copied_path)
++                except TypeError as ex:
++                    last_ex = ex
++            raise last_ex
+ 
+         p1, p2 = (nullid, nullid)
+         octopus = False

diff --git a/dev-vcs/hg-git/files/hg-git-0.8.10-hg45-memfilectx.patch 
b/dev-vcs/hg-git/files/hg-git-0.8.10-hg45-memfilectx.patch
new file mode 100644
index 00000000000..5c94617f881
--- /dev/null
+++ b/dev-vcs/hg-git/files/hg-git-0.8.10-hg45-memfilectx.patch
@@ -0,0 +1,73 @@
+# HG changeset patch
+# User Kevin Bullock <kbull...@ringworld.org>
+# Date 1517928348 21600
+# Node ID e326b349eba6b6ee57ac8df221727f79c313d04a
+# Parent  89303af1c4aa76b37e6d16f99f6279012eda7100
+compat: extract function for memfilectx signature variants
+
+diff --git a/hggit/compat.py b/hggit/compat.py
+--- a/hggit/compat.py
++++ b/hggit/compat.py
+@@ -1,4 +1,5 @@
+ from mercurial import (
++    context,
+     url,
+     util as hgutil,
+ )
+@@ -96,6 +97,26 @@
+         return refs, set(server_capabilities)
+ 
+ 
++def memfilectx(repo, changectx, path, data, islink=False,
++               isexec=False, copied=None):
++    # Different versions of mercurial have different parameters to
++    # memfilectx.  Try them from newest to oldest.
++    args_to_try = (
++        (repo, changectx, path, data),  # hg 4.5+
++        (repo, path, data),             # hg 3.1 - 4.5
++        (path, data),                   # hg < 3.1
++    )
++    for args in args_to_try:
++        try:
++            return context.memfilectx(*args,
++                                      islink=islink,
++                                      isexec=isexec,
++                                      copied=copied)
++        except TypeError as ex:
++            last_ex = ex
++    raise last_ex
++
++
+ CONFIG_DEFAULTS = {
+     'git': {
+         'authors': None,
+diff --git a/hggit/git_handler.py b/hggit/git_handler.py
+--- a/hggit/git_handler.py
++++ b/hggit/git_handler.py
+@@ -985,22 +985,10 @@
+                 if copied:
+                     copied_path = copied[0]
+ 
+-            # Different versions of mercurial have different parameters to
+-            # memfilectx.  Try them from newest to oldest.
+-            args_to_try = (
+-                (self.repo, memctx, f, data),   # hg 4.5+
+-                (self.repo, f, data),           # hg 3.1 - 4.5
+-                (f, data),                      # hg < 3.1
+-            )
+-            for args in args_to_try:
+-                try:
+-                    return context.memfilectx(*args,
+-                                              islink='l' in e,
+-                                              isexec='x' in e,
+-                                              copied=copied_path)
+-                except TypeError as ex:
+-                    last_ex = ex
+-            raise last_ex
++            return compat.memfilectx(self.repo, memctx, f, data,
++                                     islink='l' in e,
++                                     isexec='x' in e,
++                                     copied=copied_path)
+ 
+         p1, p2 = (nullid, nullid)
+         octopus = False

diff --git a/dev-vcs/hg-git/hg-git-0.8.10-r1.ebuild 
b/dev-vcs/hg-git/hg-git-0.8.10-r1.ebuild
new file mode 100644
index 00000000000..265c2109913
--- /dev/null
+++ b/dev-vcs/hg-git/hg-git-0.8.10-r1.ebuild
@@ -0,0 +1,29 @@
+# Copyright 1999-2018 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI="6"
+PYTHON_COMPAT=( python2_7 )
+
+inherit distutils-r1
+
+DESCRIPTION="push to and pull from a Git repository using Mercurial"
+HOMEPAGE="http://hg-git.github.io https://pypi.python.org/pypi/hg-git";
+SRC_URI="mirror://pypi/${PN:0:1}/${PN}/${P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~ppc ~ppc64 ~x86 ~amd64-linux ~x86-linux ~ppc-macos 
~x64-macos ~x86-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
+IUSE=""
+
+RDEPEND="
+       >=dev-vcs/mercurial-2.8.2[${PYTHON_USEDEP}]
+       >=dev-python/dulwich-0.9.7[${PYTHON_USEDEP}]
+"
+DEPEND="${RDEPEND}
+       dev-python/setuptools[${PYTHON_USEDEP}]
+"
+
+PATCHES=(
+       "${FILESDIR}"/${P}-hg45-memctx.patch
+       "${FILESDIR}"/${P}-hg45-memfilectx.patch
+)

Reply via email to