Supporting relative paths for hg diff and patch

Pierre-Yves David pierre-yves.david at ens-lyon.org
Thu Mar 5 13:33:44 CST 2015



On 03/03/2015 08:12 AM, Augie Fackler wrote:
> 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.

+1

-- 
Pierre-Yves David


More information about the Mercurial-devel mailing list