Changeset - 98d235e28078
[Not reviewed]
default
0 3 0
Sean Farley - 11 years ago 2014-11-17 00:03:07
sean.michael.farley@gmail.com
hg: adapt for changes in 3.2 and 3.3

Mercurial 3.2:

- moved localrepo.pull to exchange.pull
- removed __getitem__ from lazysets
3 files changed with 24 insertions and 6 deletions:
0 comments (0 inline, 0 general)
kallithea/controllers/compare.py
Show inline comments
 
@@ -95,7 +95,11 @@ class CompareController(BaseRepoControll
 
                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)
kallithea/lib/vcs/backends/hg/inmemory.py
Show inline comments
 
@@ -47,8 +47,12 @@ class MercurialInMemoryChangeset(BaseInM
 

	
 
            # 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:
kallithea/lib/vcs/backends/hg/repository.py
Show inline comments
 
@@ -454,7 +454,11 @@ class MercurialRepository(BaseRepository
 
            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 @@ class MercurialRepository(BaseRepository
 
        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 @@ class MercurialRepository(BaseRepository
 
        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
0 comments (0 inline, 0 general)