Bug (?) in hg diff output

Jonathan S. Shapiro shap at eros-os.com
Thu May 8 14:53:35 CDT 2008


On Thu, 2008-05-08 at 13:56 -0500, Matt Mackall wrote:
> On Thu, 2008-05-08 at 14:00 -0400, Jonathan S. Shapiro wrote:
> > I just noticed that "hg diff .", when run from within a workspace
> > subdirectory, generates paths relative to the workspace root. I found
> > this surprising. It would be very convenient if the sequence:
> > 
> >    hg diff relative-path > patches
> >    patch -R < patches
> >    patch < patches
> > 
> > would work without any "-p" options to the patch command.
> >
> > Should the current behavior be considered a misfeature?
> 
> No, Mercurial consistently does all diffs such that they can be applied
> at the repo root with -P1. This is in keeping with the idea of viewing
> the entire repository as a single entity.

Yes. I understood the theory of operation. I'm contending that in this
case it's the wrong thing to do.

Commands given with path arguments generally restrict their attention to
the paths specified. When diff is presented with paths but still insists
on issuing repo-relative output, I think that's an inconsistency.



More information about the Mercurial-devel mailing list