Mercurial > hgsubversion
comparison hgsubversion/compathacks.py @ 1549:8410a978c650
compathacks: be compatible with upstream 8a0cac20a1ad memfilectx change
See hg change 8a0cac20a1ad. Since the interface has changed
more than one time, switch to explicit keywords arguments to avoid
surprises.
Since hgsubversion targets hg >= 3.2.4, drop support for hg 3.0 and 3.1
here.
author | Jun Wu <quark@fb.com> |
---|---|
date | Tue, 19 Dec 2017 14:29:55 -0800 |
parents | c5b7fb8911c0 |
children | 51e105c7f0c6 |
comparison
equal
deleted
inserted
replaced
1548:7f83be82d03f | 1549:8410a978c650 |
---|---|
18 def pickle_load(f): | 18 def pickle_load(f): |
19 import cPickle as pickle | 19 import cPickle as pickle |
20 f.seek(0) | 20 f.seek(0) |
21 return pickle.load(f) | 21 return pickle.load(f) |
22 | 22 |
23 def makememfilectx(repo, path, data, islink, isexec, copied): | 23 def makememfilectx(repo, memctx, path, data, islink, isexec, copied): |
24 """Return a memfilectx | 24 """Return a memfilectx |
25 | 25 |
26 Works around memfilectx() adding a repo argument between 3.0 and 3.1. | 26 Works around API change by 8a0cac20a1ad (first in 4.5). |
27 """ | 27 """ |
28 from mercurial import context | 28 from mercurial import context |
29 try: | 29 try: |
30 return context.memfilectx(repo, path, data, islink, isexec, copied) | 30 return context.memfilectx(repo=repo, path=path, data=data, |
31 islink=islink, isexec=isexec, copied=copied, | |
32 changectx=memctx) | |
31 except TypeError: | 33 except TypeError: |
32 return context.memfilectx(path, data, islink, isexec, copied) | 34 return context.memfilectx(repo=repo, path=path, data=data, |
35 islink=islink, isexec=isexec, copied=copied) | |
33 | 36 |
34 def filectxfn_deleted(memctx, path): | 37 def filectxfn_deleted(memctx, path): |
35 """ | 38 """ |
36 Return None or raise an IOError as necessary if path is deleted. | 39 Return None or raise an IOError as necessary if path is deleted. |
37 | 40 |