summaryrefslogtreecommitdiff
path: root/hgsubversion/compathacks.py
diff options
context:
space:
mode:
Diffstat (limited to 'hgsubversion/compathacks.py')
-rw-r--r--hgsubversion/compathacks.py36
1 files changed, 23 insertions, 13 deletions
diff --git a/hgsubversion/compathacks.py b/hgsubversion/compathacks.py
index 5b515b1..ad47a1f 100644
--- a/hgsubversion/compathacks.py
+++ b/hgsubversion/compathacks.py
@@ -3,17 +3,19 @@
import errno
import sys
-from mercurial import util
-
-def branchset(repo):
- """Return the set of branches present in a repo.
-
- Works around branchtags() vanishing between 2.8 and 2.9.
- """
- try:
- return set(repo.branchmap())
- except AttributeError:
- return set(repo.branchtags())
+from mercurial import ui as uimod, util
+
+# ui.makeprogress will be dropped after hg-5.1
+if util.safehasattr(uimod.ui, 'makeprogress'):
+ def progress(ui, topic, pos, item="", unit="", total=None):
+ progress = ui.makeprogress(topic, unit, total)
+ if pos is not None:
+ progress.update(pos, item=item)
+ else:
+ progress.complete()
+else:
+ def progress(ui, topic, pos, item="", unit="", total=None):
+ ui.progress(topic, pos, item="", unit="", total=None)
def pickle_load(f):
import cPickle as pickle
@@ -24,6 +26,7 @@ def makememfilectx(repo, memctx, path, data, islink, isexec, copied):
"""Return a memfilectx
Works around API change by 8a0cac20a1ad (first in 4.5).
+ and also API change by 550a172a603b9e (first in 5.0)
"""
from mercurial import context
try:
@@ -31,8 +34,15 @@ def makememfilectx(repo, memctx, path, data, islink, isexec, copied):
islink=islink, isexec=isexec, copied=copied,
changectx=memctx)
except TypeError:
- return context.memfilectx(repo=repo, path=path, data=data,
- islink=islink, isexec=isexec, copied=copied)
+ try:
+ return context.memfilectx(repo=repo, path=path, data=data,
+ islink=islink, isexec=isexec,
+ copied=copied)
+ except TypeError:
+ return context.memfilectx(repo=repo, changectx=memctx,
+ path=path, data=data,
+ islink=islink, isexec=isexec,
+ copysource=copied)
def filectxfn_deleted(memctx, path):
"""