Tracking base revision for files distributed without a repo

Matt Mackall mpm at selenic.com
Thu Jan 23 21:36:59 UTC 2014


On Thu, 2014-01-23 at 15:11 -0600, Benjamin Fritz wrote:
> On Thu, Jan 23, 2014 at 2:19 PM, Matt Mackall <mpm at selenic.com> wrote:
> >
> > On Wed, 2014-01-22 at 23:47 -0600, Benjamin Fritz wrote:
> >> But when they occasionally email me back a modified copy of the script
> >> to fix a bug or expand the types of data it can handle, I'd really
> >> like to know where to start when merging in changes.
> >
> > Ideally, there'd be a way to ask Mercurial "which revision of file X is
> > closest to this copy here?"
> >
> 
> Yes, exactly! I don't really NEED the revision recorded somewhere if
> it easy to find the revision with the easiest merge.
> 
> > Here's one way to do that on the command line (using the file 'hg'):
> >
> > $ for x in `hg log hg --template "{rev}\n"`; do echo -n "$x "; hg diff
> > -r $x hg | wc -l ; done
> 
> So this will basically print each revision followed by the number of
> lines that differ from that revision to the file currently in the
> working copy, correct?

It measures the size of the diff in lines.

>  That could work. Of course I use Windows so
> I'll need to tweak that. Although, I'd definitely prefer to use a
> simpler command.

This could be done by a very simple extension which would make it about
10 times faster.

-- 
Mathematics is the supreme nostalgia of our time.





More information about the Mercurial mailing list