Did I find the right examples for you? yes no

All Samples(5)  |  Call(4)  |  Derive(0)  |  Import(1)
Converts a name and type (e.g., '1.0' and 'tags') into a git ref.

        def name_reftype_to_ref(name, reftype):
    '''Converts a name and type (e.g., '1.0' and 'tags') into a git ref.'''
    if reftype == BRANCH:
        if name == 'default':
            return 'refs/heads/master'
        else:
            return 'refs/heads/branches/%s' % name
    elif reftype == BOOKMARK:
        return 'refs/heads/%s' % name
    elif reftype == TAG:
        return 'refs/tags/%s' % name
    assert False, "unknown reftype: %s" % reftype
        


src/g/i/gitifyhg-0.8.4/gitifyhg/gitifyhg.py   gitifyhg(Download)
from mercurial.bookmarks import listbookmarks, readcurrent
 
from .util import (log, die, output, branch_head, GitMarks,
    HGMarks, hg_to_git_spaces, name_reftype_to_ref, BRANCH, BOOKMARK, TAG,
    version, deactivate_stdout)
        for reftype in (BRANCH, BOOKMARK, TAG):
            output(u"refspec %s:%s" %
                (name_reftype_to_ref('*', reftype),
                 self.make_gitify_ref('*', reftype)))
 
            output("%s %s" %
                    (self._change_hash(branch_head(self, branch)),
                     name_reftype_to_ref(hg_to_git_spaces(branch), BRANCH)))
 
        # list the bookmark references
        for bookmark, changectx in self.bookmarks.items():
            if bookmark != "master":
                output("%s %s" %
                        (self._change_hash(changectx),
                         name_reftype_to_ref(hg_to_git_spaces(bookmark), BOOKMARK)))
                output("%s %s" %
                        (self._change_hash(self.repo[node]),
                         name_reftype_to_ref(hg_to_git_spaces(tag), TAG)))
 
        output()