Supporting relative paths for hg diff and patch

Augie Fackler raf at durin42.com
Tue Mar 3 10:12:52 CST 2015


On Mon, Mar 02, 2015 at 11:29:29PM -0800, Siddharth Agarwal wrote:
> As we're merging repos, something that would be incredibly useful for
> both automated tools and humans at Facebook would be the ability to
> produce and apply patches relative to a subdirectory.
>
> So (tentative UI):
>
> hg diff --relative prefix/
>
> would produce diffs only from files within prefix/, where all the paths
> are relative to prefix/. (Moves into and out of prefix/ would be
> presented as adds and deletes respectively.)
>
> Similarly,
>
> hg import --relative prefix/
>
> would apply a patch assuming paths in it are relative to prefix.
>
> While we could do this at a higher level by munging paths in the patch
> data, it's really much easier to do within Mercurial. (Moves make things
> particularly tricky.)
>
> Does that sound like a reasonable feature request? I'd be happy to
> implement it.

Looks reasonable to me.

>
> - Siddharth
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel


More information about the Mercurial-devel mailing list