view hgsubversion/layouts/base.py @ 1012:e8cd211684c4

layouts: refactor out svn path to mercurial branch logic This pulls the logic for mapping from svn path to mercurial branch name out of svnmeta.py and into the new layouts library. It also sets up the structure for that library. This diff does not modify any call to svnmeta.localname, rather leaving it in place as a simple proxy to the new layout object.
author David Schleimer <dschleimer@fb.com>
date Wed, 24 Apr 2013 15:07:11 -0700
parents
children d507c1a12dcb
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 __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.
        """
        self.__unimplemented('localname')