view hgsubversion/layouts/base.py @ 1026:66395f232b7c

layouts: pull tag location list management into layout module We keep a list of locations within subversion where we look for tags that persists across runs. This pulls the logic for constructiong that list from config on first clone, and for mainting the list afterwards out of svnmeta and into layouts.
author David Schleimer <dschleimer@fb.com>
date Tue, 21 May 2013 16:29:18 -0700
parents 8feff33e387d
children 16045f6f3fef
line wrap: on
line source

"""Module to hold the base API for layout classes.

This module should not contain any implementation, just a definition
of the API concrete layouts are expected to implement.

"""

from mercurial import util as hgutil

class BaseLayout(object):

    def __init__(self, ui):
        self.ui = ui

    def __unimplemented(self, method_name):
        raise NotImplementedError(
            "Incomplete layout implementation: %s.%s doesn't implement %s" %
            (self.__module__, self.__name__, method_name))

    def localname(self, path):
        """Compute the local name for a branch located at path.

        path should be relative to the repo url.

        """
        self.__unimplemented('localname')

    def remotename(self, branch):
        """Compute a subversion path for a mercurial branch name

        This should return a path relative to the repo url

        """
        self.__unimplemented('remotename')

    def remotepath(self, branch, subdir='/'):
        """Compute a  subversion path for a mercurial branch name.

        This should return an absolute path, assuming our repo root is at subdir
        A false subdir shall be taken to mean /.

        """
        self.__unimplemented('remotepath')

    def taglocations(self, meta_data_dir):
        """Return a list of locations within svn to search for tags

        Should be returned in reverse-sorted order.

        """
        self.__unimplemented('tagpaths')