view hgsubversion/layouts/standard.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



import base


class StandardLayout(base.BaseLayout):
    """The standard trunk, branches, tags layout"""

    def localname(self, path):
        if path == 'trunk':
            return None
        elif path.startswith('branches/'):
            return path[len('branches/'):]
        return  '../%s' % path