remove: pass around uipathfn and use instead of m.rel() (API)

Authored by martinvonz.

Description

remove: pass around uipathfn and use instead of m.rel() (API)

Same as previous commit, but now for remove.

Differential Revision: https://phab.mercurial-scm.org/D5902