devel/hg-git: unbreak with mercurial 4.5

https://bitbucket.org/durin42/hg-git/issues/235/incompatible-with-mercurial-45

Obtained from:	upstream
Approved by:	portmgr blanket (after r460748)
This commit is contained in:
Jan Beich 2018-02-22 22:59:37 +00:00
parent 8a7cfdac1c
commit b2df79a202
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=462649
2 changed files with 84 additions and 0 deletions

View file

@ -3,6 +3,7 @@
PORTNAME= hg-git
DISTVERSION= 0.8.10
PORTREVISION= 1
CATEGORIES= devel python
MASTER_SITES= http://bitbucket.org/durin42/${PORTNAME}/get/
PKGNAMEPREFIX= ${PYTHON_PKGNAMEPREFIX}

View file

@ -0,0 +1,83 @@
https://bitbucket.org/durin42/hg-git/commits/843f409526fb
https://bitbucket.org/durin42/hg-git/commits/89303af1c4aa
https://bitbucket.org/durin42/hg-git/commits/bb255eaf3d14
--- Makefile.orig 2017-11-02 01:23:50 UTC
+++ Makefile
@@ -33,6 +33,7 @@ tests-%:
all-version-tests: tests-2.8.2 tests-2.9.2 tests-3.0.2 tests-3.1.2 tests-3.2.4 \
tests-3.3.3 tests-3.4.2 tests-3.5.2 tests-3.6.3 tests-3.7.3 tests-3.8.4 \
- tests-3.9.2 tests-4.0.2 tests-4.1.3 tests-4.2.3 tests-4.3.3 tests-4.4 tests-@
+ tests-3.9.2 tests-4.0.2 tests-4.1.3 tests-4.2.3 tests-4.3.3 tests-4.4.2 \
+ tests-4.5 tests-@
.PHONY: tests all-version-tests
--- hggit/__init__.py.orig 2017-11-02 01:23:50 UTC
+++ hggit/__init__.py
@@ -81,7 +81,7 @@ demandimport.ignore.extend([
__version__ = '0.8.10'
testedwith = ('2.8.2 2.9.2 3.0.2 3.1.2 3.2.4 3.3.3 3.4.2 3.5.2 3.6.3 3.7.3'
- '3.8.4 3.9.2 4.0.2 4.1.3 4.2.3 4.3.3 4.4')
+ '3.8.4 3.9.2 4.0.2 4.1.3 4.2.3 4.3.3 4.4.2 4.5')
buglink = 'https://bitbucket.org/durin42/hg-git/issues'
cmdtable = {}
--- hggit/git_handler.py.orig 2017-11-02 01:23:50 UTC
+++ hggit/git_handler.py
@@ -954,16 +954,22 @@ class GitHandler(object):
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
--- tests/test-conflict-1.t.orig 2017-11-02 01:23:50 UTC
+++ tests/test-conflict-1.t
@@ -19,7 +19,7 @@ Load commonly used test logic
$ hg merge -r1 2>&1 | sed 's/-C ./-C/' | egrep -v '^merging afile' | sed 's/incomplete.*/failed!/'
warning: conflicts.* (re)
0 files updated, 0 files merged, 0 files removed, 1 files unresolved
- use 'hg resolve' to retry unresolved file merges or 'hg update -C' to abandon
+ use 'hg resolve' to retry unresolved file merges or 'hg *' to abandon (glob)
resolve using first parent
$ echo C > afile
$ hg resolve -m afile | egrep -v 'no more unresolved files' || true
--- tests/test-conflict-2.t.orig 2017-11-02 01:23:50 UTC
+++ tests/test-conflict-2.t
@@ -19,7 +19,7 @@ Load commonly used test logic
$ hg merge -r1 2>&1 | sed 's/-C ./-C/' | egrep -v '^merging afile' | sed 's/incomplete.*/failed!/'
warning: conflicts.* (re)
0 files updated, 0 files merged, 0 files removed, 1 files unresolved
- use 'hg resolve' to retry unresolved file merges or 'hg update -C' to abandon
+ use 'hg resolve' to retry unresolved file merges or 'hg *' to abandon (glob)
resolve using second parent
$ echo B > afile
$ hg resolve -m afile | egrep -v 'no more unresolved files' || true