Mercurial > kallithea
changeset 4828:98d235e28078
hg: adapt for changes in 3.2 and 3.3
Mercurial 3.2:
- moved localrepo.pull to exchange.pull
- removed __getitem__ from lazysets
author | Sean Farley <sean.michael.farley@gmail.com> |
---|---|
date | Sun, 16 Nov 2014 15:03:07 -0800 |
parents | 8d76245daefa |
children | 4aa02271dc13 |
files | kallithea/controllers/compare.py kallithea/lib/vcs/backends/hg/inmemory.py kallithea/lib/vcs/backends/hg/repository.py |
diffstat | 3 files changed, 24 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/kallithea/controllers/compare.py Wed Feb 11 20:38:12 2015 +0100 +++ b/kallithea/controllers/compare.py Sun Nov 16 15:03:07 2014 -0800 @@ -95,7 +95,11 @@ ancestors = hgrepo.revs("ancestor(id(%s), id(%s))", org_rev, other_rev) if ancestors: # FIXME: picks arbitrary ancestor - but there is usually only one - ancestor = hgrepo[ancestors[0]].hex() + try: + ancestor = hgrepo[ancestors.first()].hex() + except AttributeError: + # removed in hg 3.2 + ancestor = hgrepo[ancestors[0]].hex() other_revs = hgrepo.revs("ancestors(id(%s)) and not ancestors(id(%s)) and not id(%s)", other_rev, org_rev, org_rev)
--- a/kallithea/lib/vcs/backends/hg/inmemory.py Wed Feb 11 20:38:12 2015 +0100 +++ b/kallithea/lib/vcs/backends/hg/inmemory.py Sun Nov 16 15:03:07 2014 -0800 @@ -47,8 +47,12 @@ # check if this path is removed if path in (node.path for node in self.removed): - # Raising exception is a way to mark node for removal - raise IOError(errno.ENOENT, '%s is deleted' % path) + if getattr(memctx, '_returnnoneformissingfiles', False): + return None + else: + # (hg < 3.2) Raising exception is the way to mark node for + # removal + raise IOError(errno.ENOENT, '%s is deleted' % path) # check if this path is added for node in self.added:
--- a/kallithea/lib/vcs/backends/hg/repository.py Wed Feb 11 20:38:12 2015 +0100 +++ b/kallithea/lib/vcs/backends/hg/repository.py Sun Nov 16 15:03:07 2014 -0800 @@ -454,7 +454,11 @@ msg = ("Revision %s:%s does not exist for %s" % (ref_type, ref_name, self.name)) raise ChangesetDoesNotExistError(msg) if revs: - revision = revs[-1] + try: + revision = revs.last() + except AttributeError: + # removed in hg 3.2 + revision = revs[-1] else: # TODO: just report 'not found'? revision = ref_name @@ -540,7 +544,9 @@ else: revisions = self.revisions - revs = revisions[start_pos:end_pos] + # this is very much a hack to turn this into a list; a better solution + # would be to get rid of this function entirely and use revsets + revs = list(revisions)[start_pos:end_pos] if reverse: revs = reversed(revs) @@ -551,8 +557,12 @@ Tries to pull changes from external location. """ url = self._get_url(url) + other = peer(self._repo, {}, url) try: - other = peer(self._repo, {}, url) + # hg 3.2 moved push / pull to exchange module + from mercurial import exchange + exchange.pull(self._repo, other, heads=None, force=None) + except ImportError: self._repo.pull(other, heads=None, force=None) except Abort, err: # Propagate error but with vcs's type