[PATCH] hgweb: follow renames and copies in file log (issue1576)

Robert O'Callahan robert at ocallahan.org
Thu Apr 7 02:33:27 CDT 2011


On Thu, Apr 7, 2011 at 10:20 AM, Matt Mackall <mpm at selenic.com> wrote:

> On Thu, 2011-04-07 at 09:21 +1200, Robert O'Callahan wrote:
> > Matt Mackall wrote:
> >
> > > Consider this: if I ask "what did the President of the United States do
> > > on Aug 21, 1959?", you can either say "he wasn't born yet" or "he was
> > > admitting Hawaii into the union". Both of these answers are correct
> from
> > > their perspective, but one is a hell of a lot more relevant. Also note
> > > that one of these answers is constant, and the other changes wildly
> > > based on when you ask the question.
> > >
> > > These two perspectives can be called 'identity' and 'position'.
> > > Mercurial generally takes the 'position' perspective, because it's _the
> > > only perspective available_ to tools like compilers, which see things
> > > through the window of the filesystem. So if I ask "what were the
> > > contents of Makefile on Dec 8, 2008?", I will not be impressed if you
> > > tell me it didn't exist yet. I'm obviously interested in what make(1)
> > > would have seen on that date, and any deletions and renames aren't
> > > relevant.
> > >
> >
> > Your analogy doesn't map well onto how files are used, at least in
> projects
> > like Mozilla.
>
> Sure it does.
>
> There are two ways to interpret the question "what is the history of
> foo.c?". One is "what changes were made to the file that is currently
> known as foo.c?" (the identity perspective) and the other is "what
> changes were made to the file known as foo.c?" (the position
> perspective). Which interpretation is the right one depends on context.
>
> One answer is time-dependent, the other is not.
>

I understand that. But the analogy doesn't map well because the behavior you
describe in your analogy is incredibly unusual when you translate it into
the domain of a file repository, at least in our project.

Let's think about the implications of that for a moment. What is 'now'
> on hgweb? The tip? What if the tip doesn't even contain the file you're
> interested in? What if there are multiple branches with different
> identities of foo.c? The possibility of multiple heads means there is in
> fact no consistent definition of 'now' on hgweb.
>

The hgweb log starts at a particular revision, e.g.
http://hg.mozilla.org/mozilla-central/log/1feb4a7c7ca6/gfx/src/thebes/nsThebesRenderingContext.h
So that revision could define "now".

What's been proposed here is that we switch from the position
> perspective to the identity perspective when we hit the first revision
> of a file. And when you consider that -that's not the only place- that
> the identity perspective can diverge from the position perspective, it's
> clear that this hybrid is -not consistent-. It can mislead people into
> thinking that renames didn't appear elsewhere. Fails DWIM.
>
> The other possible hybrid is 'merge both perspectives'. So if foo.c is
> deleted and replaced by a rename from bar.c, then we show the history of
> foo.c and bar.c. In this perspective, we hear that in 2003, the
> president of the US invaded Iraq AND voted against invading Iraq. Also
> fails DWIM.
>

I'm proposing a third alternative, which is to offer a log using the
identity perspective, given a path name and a revision.

But I can see that's not likely to happen :-). I'll go and try to convince
our developers to be happy with what they've got.

Rob
-- 
"Now the Bereans were of more noble character than the Thessalonians, for
they received the message with great eagerness and examined the Scriptures
every day to see if what Paul said was true." [Acts 17:11]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://selenic.com/pipermail/mercurial-devel/attachments/20110407/d313d7f2/attachment.htm>


More information about the Mercurial-devel mailing list