[PATCH] add rename information handling to annotate

Matt Mackall mpm at selenic.com
Wed Dec 28 17:27:42 UTC 2005


On Wed, Dec 28, 2005 at 05:53:05PM +0100, Robin Farine wrote:
> 
> Tla also record a textual representation of these changes in the 
> changelog in rfc-822 format associated with a changeset. But this 
> information is only available for a given changeset, not for a file 
> or file subset.
> 
> With Mercurial, it would be nice to see this kind of information 
> with say "hg log --full [PATH ...]". Recursing in the history of 
> files between two revisions to follow renames is needed anyway so 
> that update -m can take renames into account.

Rename information is only recorded at the file level. So it's too
expensive to look at each file when doing a project-wide log.

The presence of renames can be guessed from looking at manifests. This
is moderately expensive.

But hg log normally only needs to look at the changelog, which is
really fast.

We've got a similar performance problem for deletes which needs
solving, possibly by extending the changeset format. But it wouldn't
be backward-compatible, so I've been holding off on it in hopes that a
better solution will appear.

> I am afraid to not be familiar enough with Mercurial internals to 
> figure out the cost of such a thing and how to handle corner cases 
> like a revision with a combined rename and copy such as "hg rename 
> a b; hg copy c a". This makes me wonder whether it is worth 
> recording copies rather than just renames since a copy can be seen 
> as a fork in the history of file...

I'm not sure what people have against copies. They're a useful,
general concept, and a proper superset of renames.

Consider the example I started with - a few months back, I split the
file hg.py into half a dozen pieces. Now I could have just created a
bunch of new files and cut and pasted code into them. But with hg
copy, I've actually recorded where that code came from and annotate
will eventually be able to give me the history of each line in each
"fork" in a meaningful way.

-- 
Mathematics is the supreme nostalgia of our time.



More information about the Mercurial mailing list