Mercurial > hgsubversion
comparison hgsubversion/compathacks.py @ 1602:6a6ce9d9da35 default tip
compathacks: make memfilectx construction compatible with hg5.0
'copied' in memfilectx was renamed to 'copysource' in 550a172a603b9ed in core
mercurial.
author | Pulkit Goyal <pulkit@yandex-team.ru> |
---|---|
date | Fri, 19 Apr 2019 16:28:39 +0300 |
parents | 5d8603f080c5 |
children |
comparison
equal
deleted
inserted
replaced
1601:5d8603f080c5 | 1602:6a6ce9d9da35 |
---|---|
24 | 24 |
25 def makememfilectx(repo, memctx, path, data, islink, isexec, copied): | 25 def makememfilectx(repo, memctx, path, data, islink, isexec, copied): |
26 """Return a memfilectx | 26 """Return a memfilectx |
27 | 27 |
28 Works around API change by 8a0cac20a1ad (first in 4.5). | 28 Works around API change by 8a0cac20a1ad (first in 4.5). |
29 and also API change by 550a172a603b9e (first in 5.0) | |
29 """ | 30 """ |
30 from mercurial import context | 31 from mercurial import context |
31 try: | 32 try: |
32 return context.memfilectx(repo=repo, path=path, data=data, | 33 return context.memfilectx(repo=repo, path=path, data=data, |
33 islink=islink, isexec=isexec, copied=copied, | 34 islink=islink, isexec=isexec, copied=copied, |
34 changectx=memctx) | 35 changectx=memctx) |
35 except TypeError: | 36 except TypeError: |
36 return context.memfilectx(repo=repo, path=path, data=data, | 37 try: |
37 islink=islink, isexec=isexec, copied=copied) | 38 return context.memfilectx(repo=repo, path=path, data=data, |
39 islink=islink, isexec=isexec, | |
40 copied=copied) | |
41 except TypeError: | |
42 return context.memfilectx(repo=repo, changectx=memctx, | |
43 path=path, data=data, | |
44 islink=islink, isexec=isexec, | |
45 copysource=copied) | |
38 | 46 |
39 def filectxfn_deleted(memctx, path): | 47 def filectxfn_deleted(memctx, path): |
40 """ | 48 """ |
41 Return None or raise an IOError as necessary if path is deleted. | 49 Return None or raise an IOError as necessary if path is deleted. |
42 | 50 |