view tag_repo.py @ 284:f8f9a2993705

Implement parseurl support (#revision in repository urls) Note: Normally when using parseurl, hg clone will treat the revision after # as if it was passed in as --rev, treats that rev as a head and won't clone beyond that. This wasn't implemented here, hence all the TODO's in the comments. All we do is use the checkout parameter where appropriate to update the wc to the selected revision.
author Martijn Pieters <mj@zopatista.com>
date Mon, 27 Apr 2009 09:39:39 -0500
parents 91c818377703
children 33736e2e25f0
line wrap: on
line source

from mercurial import node

import hg_delta_editor


def tags_from_tag_info(repo):
    hg_editor = hg_delta_editor.HgChangeReceiver(repo=repo)
    for tag, source in hg_editor.tags.iteritems():
        source_ha = hg_editor.get_parent_revision(source[1]+1, source[0])
        yield 'tag/%s'%tag, node.hex(source_ha)


def generate_repo_class(ui, repo):

    class svntagrepo(repo.__class__):
        def tags(self):
            tags = dict((k, node.bin(v))
                        for k,v in tags_from_tag_info(self))
            hg_tags = super(svntagrepo, self).tags()
            tags.update(hg_tags)
            return tags

    return svntagrepo