Gentoo Archives: gentoo-commits

From: Fabian Groffen <grobian@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-vcs/hg-git/, dev-vcs/hg-git/files/
Date: Fri, 09 Feb 2018 19:40:41
Message-Id: 1518205228.97c95795e04fb46fbe527e9846780e52c9aa59ef.grobian@gentoo
1 commit: 97c95795e04fb46fbe527e9846780e52c9aa59ef
2 Author: Fabian Groffen <grobian <AT> gentoo <DOT> org>
3 AuthorDate: Fri Feb 9 19:39:47 2018 +0000
4 Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org>
5 CommitDate: Fri Feb 9 19:40:28 2018 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=97c95795
7
8 dev-vcs/hg-git: add patches from upstream for hg 4.5
9
10 Package-Manager: Portage-2.3.19, Repoman-2.3.6
11
12 .../hg-git/files/hg-git-0.8.10-hg45-memctx.patch | 43 +++++++++++++
13 .../files/hg-git-0.8.10-hg45-memfilectx.patch | 73 ++++++++++++++++++++++
14 dev-vcs/hg-git/hg-git-0.8.10-r1.ebuild | 29 +++++++++
15 3 files changed, 145 insertions(+)
16
17 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
18 new file mode 100644
19 index 00000000000..ff9d4d66d15
20 --- /dev/null
21 +++ b/dev-vcs/hg-git/files/hg-git-0.8.10-hg45-memctx.patch
22 @@ -0,0 +1,43 @@
23 +# HG changeset patch
24 +# User Tony Tung <tonytung@×××××.org>
25 +# Date 1517901695 28800
26 +# Node ID 843f409526fbea3ffde674922b730075d5cfd4d3
27 +# Parent 6dc827703bfb995b89b0da5b2e9eaffe3479ea45
28 +compat: pass memctx to memfilectx constructor on hg 4.5+
29 +
30 +diff --git a/hggit/git_handler.py b/hggit/git_handler.py
31 +--- a/hggit/git_handler.py
32 ++++ b/hggit/git_handler.py
33 +@@ -985,16 +985,22 @@
34 + if copied:
35 + copied_path = copied[0]
36 +
37 +- try:
38 +- return context.memfilectx(self.repo, f, data,
39 +- islink='l' in e,
40 +- isexec='x' in e,
41 +- copied=copied_path)
42 +- except TypeError:
43 +- return context.memfilectx(f, data,
44 +- islink='l' in e,
45 +- isexec='x' in e,
46 +- copied=copied_path)
47 ++ # Different versions of mercurial have different parameters to
48 ++ # memfilectx. Try them from newest to oldest.
49 ++ args_to_try = (
50 ++ (self.repo, memctx, f, data), # hg 4.5+
51 ++ (self.repo, f, data), # hg 3.1 - 4.5
52 ++ (f, data), # hg < 3.1
53 ++ )
54 ++ for args in args_to_try:
55 ++ try:
56 ++ return context.memfilectx(*args,
57 ++ islink='l' in e,
58 ++ isexec='x' in e,
59 ++ copied=copied_path)
60 ++ except TypeError as ex:
61 ++ last_ex = ex
62 ++ raise last_ex
63 +
64 + p1, p2 = (nullid, nullid)
65 + octopus = False
66
67 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
68 new file mode 100644
69 index 00000000000..5c94617f881
70 --- /dev/null
71 +++ b/dev-vcs/hg-git/files/hg-git-0.8.10-hg45-memfilectx.patch
72 @@ -0,0 +1,73 @@
73 +# HG changeset patch
74 +# User Kevin Bullock <kbullock@×××××××××.org>
75 +# Date 1517928348 21600
76 +# Node ID e326b349eba6b6ee57ac8df221727f79c313d04a
77 +# Parent 89303af1c4aa76b37e6d16f99f6279012eda7100
78 +compat: extract function for memfilectx signature variants
79 +
80 +diff --git a/hggit/compat.py b/hggit/compat.py
81 +--- a/hggit/compat.py
82 ++++ b/hggit/compat.py
83 +@@ -1,4 +1,5 @@
84 + from mercurial import (
85 ++ context,
86 + url,
87 + util as hgutil,
88 + )
89 +@@ -96,6 +97,26 @@
90 + return refs, set(server_capabilities)
91 +
92 +
93 ++def memfilectx(repo, changectx, path, data, islink=False,
94 ++ isexec=False, copied=None):
95 ++ # Different versions of mercurial have different parameters to
96 ++ # memfilectx. Try them from newest to oldest.
97 ++ args_to_try = (
98 ++ (repo, changectx, path, data), # hg 4.5+
99 ++ (repo, path, data), # hg 3.1 - 4.5
100 ++ (path, data), # hg < 3.1
101 ++ )
102 ++ for args in args_to_try:
103 ++ try:
104 ++ return context.memfilectx(*args,
105 ++ islink=islink,
106 ++ isexec=isexec,
107 ++ copied=copied)
108 ++ except TypeError as ex:
109 ++ last_ex = ex
110 ++ raise last_ex
111 ++
112 ++
113 + CONFIG_DEFAULTS = {
114 + 'git': {
115 + 'authors': None,
116 +diff --git a/hggit/git_handler.py b/hggit/git_handler.py
117 +--- a/hggit/git_handler.py
118 ++++ b/hggit/git_handler.py
119 +@@ -985,22 +985,10 @@
120 + if copied:
121 + copied_path = copied[0]
122 +
123 +- # Different versions of mercurial have different parameters to
124 +- # memfilectx. Try them from newest to oldest.
125 +- args_to_try = (
126 +- (self.repo, memctx, f, data), # hg 4.5+
127 +- (self.repo, f, data), # hg 3.1 - 4.5
128 +- (f, data), # hg < 3.1
129 +- )
130 +- for args in args_to_try:
131 +- try:
132 +- return context.memfilectx(*args,
133 +- islink='l' in e,
134 +- isexec='x' in e,
135 +- copied=copied_path)
136 +- except TypeError as ex:
137 +- last_ex = ex
138 +- raise last_ex
139 ++ return compat.memfilectx(self.repo, memctx, f, data,
140 ++ islink='l' in e,
141 ++ isexec='x' in e,
142 ++ copied=copied_path)
143 +
144 + p1, p2 = (nullid, nullid)
145 + octopus = False
146
147 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
148 new file mode 100644
149 index 00000000000..265c2109913
150 --- /dev/null
151 +++ b/dev-vcs/hg-git/hg-git-0.8.10-r1.ebuild
152 @@ -0,0 +1,29 @@
153 +# Copyright 1999-2018 Gentoo Foundation
154 +# Distributed under the terms of the GNU General Public License v2
155 +
156 +EAPI="6"
157 +PYTHON_COMPAT=( python2_7 )
158 +
159 +inherit distutils-r1
160 +
161 +DESCRIPTION="push to and pull from a Git repository using Mercurial"
162 +HOMEPAGE="http://hg-git.github.io https://pypi.python.org/pypi/hg-git"
163 +SRC_URI="mirror://pypi/${PN:0:1}/${PN}/${P}.tar.gz"
164 +
165 +LICENSE="GPL-2"
166 +SLOT="0"
167 +KEYWORDS="~amd64 ~ppc ~ppc64 ~x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
168 +IUSE=""
169 +
170 +RDEPEND="
171 + >=dev-vcs/mercurial-2.8.2[${PYTHON_USEDEP}]
172 + >=dev-python/dulwich-0.9.7[${PYTHON_USEDEP}]
173 +"
174 +DEPEND="${RDEPEND}
175 + dev-python/setuptools[${PYTHON_USEDEP}]
176 +"
177 +
178 +PATCHES=(
179 + "${FILESDIR}"/${P}-hg45-memctx.patch
180 + "${FILESDIR}"/${P}-hg45-memfilectx.patch
181 +)