'create a modified version of this path. A \'rev\' argument
indicates a new revision.
the following keyword arguments modify various path parts::
http://host.com/repo/path/file.ext
|-----------------------|          dirname
|------| basename
|--|     purebasename
|--| ext'

def new(self, **kw):

    obj = object.__new__(self.__class__)
    obj.rev = kw.get('rev', self.rev)
    obj.auth = kw.get('auth', self.auth)
    (dirname, basename, purebasename, ext) = self._getbyspec('dirname,basename,purebasename,ext')
    if ('basename' in kw):
        if (('purebasename' in kw) or ('ext' in kw)):
            raise ValueError(('invalid    specification    %r' % kw))
    else:
        pb = kw.setdefault('purebasename', purebasename)
        ext = kw.setdefault('ext', ext)
        if (ext and (not ext.startswith('.'))):
            ext = ('.' + ext)
        kw['basename'] = (pb + ext)
    kw.setdefault('dirname', dirname)
    kw.setdefault('sep', self.sep)
    if kw['basename']:
        obj.strpath = ('%(dirname)s%(sep)s%(basename)s' % kw)
    else:
        obj.strpath = ('%(dirname)s' % kw)
    return obj
