Changeset - 5f1af779bddf
[Not reviewed]
default
0 2 0
Mads Kiilerich - 8 years ago 2017-09-14 02:08:06
mads@kiilerich.com
hg: prepare for Mercurial 4.2 or later where tagging moved from localrepo to the tags module
2 files changed with 12 insertions and 4 deletions:
0 comments (0 inline, 0 general)
kallithea/lib/vcs/backends/hg/repository.py
Show inline comments
 
@@ -31,7 +31,7 @@ from kallithea.lib.vcs.utils.paths impor
 
from kallithea.lib.vcs.utils.hgcompat import (
 
    ui, nullid, match, patch, diffopts, clone, get_contact,
 
    localrepository, RepoLookupError, Abort, RepoError, hex, scmutil, hg_url,
 
    httpbasicauthhandler, httpdigestauthhandler, peer, httppeer, sshpeer
 
    httpbasicauthhandler, httpdigestauthhandler, peer, httppeer, sshpeer, tag
 
)
 

	
 
from .changeset import MercurialChangeset
 
@@ -175,8 +175,7 @@ class MercurialRepository(BaseRepository
 
            date = datetime.datetime.now().strftime('%a, %d %b %Y %H:%M:%S')
 

	
 
        try:
 
            self._repo.tag(name, changeset._ctx.node(), message, local, user,
 
                date)
 
            tag(self._repo, name, changeset._ctx.node(), message, local, user, date)
 
        except Abort as e:
 
            raise RepositoryError(e.message)
 

	
 
@@ -206,7 +205,7 @@ class MercurialRepository(BaseRepository
 
        local = False
 

	
 
        try:
 
            self._repo.tag(name, nullid, message, local, user, date)
 
            tag(self._repo, name, nullid, message, local, user, date)
 
            self.tags = self._get_tags()
 
        except Abort as e:
 
            raise RepositoryError(e.message)
kallithea/lib/vcs/utils/hgcompat.py
Show inline comments
 
@@ -12,6 +12,7 @@ from mercurial import localrepo
 
from mercurial import unionrepo
 
from mercurial import scmutil
 
from mercurial import config
 
from mercurial import tags as tagsmod
 
from mercurial.commands import clone, nullid, pull
 
from mercurial.context import memctx, memfilectx
 
from mercurial.error import RepoError, RepoLookupError, Abort
 
@@ -47,3 +48,11 @@ if inspect.getargspec(memfilectx.__init_
 
localrepository._lfstatuswriters = [lambda *msg, **opts: None]
 
# 3.5 7699d3212994 added the invariant that repo.lfstatus must exist before hitting overridearchive
 
localrepository.lfstatus = False
 

	
 
# Mercurial 4.2 moved tag from localrepo to the tags module
 
def tag(repo, *args):
 
    try:
 
        tag_f  = tagsmod.tag
 
    except AttributeError:
 
        return repo.tag(*args)
 
    tag_f(repo, *args)
0 comments (0 inline, 0 general)