Proper tracking of file-level operations: rename, directories, merges

Ben Finney ben+bazaar at benfinney.id.au
Sun Oct 23 02:11:18 UTC 2011


Martin Geisler <mg at aragost.com> writes:

> Yes, that is true -- directory renames are *defined* to mean "all
> files in foo/ was moved to bar/".

Defined by whom? That's not the operation I performed, and it's not the
result I want to see in the VCS.

> >> I'll keep protesting until you demonstrate a bug in the handling of
> >> renames and merges in Mercurial.
> >
> > Mercurial:
> >
> > =====
> >
> > $ hg status
> > A bar/beans
> > A bar/eggs
> > A bar/spam
> > R foo/beans
> > R foo/eggs
> > R foo/spam
> > =====
>
> What Mercurial is telling you here is that "bar/beans" was added and
> "foo/beans" was removed.

Yes. That's what is wrong.

> If you use "hg status --copies", you'll see that Mercurial is well
> aware that the addition of "bar/beans" is a copy from "foo/beans".

A copy? That's still not what has happened on the filesystem, though.

> > Bazaar:
> >
> > =====
> >
> > $ bzr mv foo bar
> > foo => bar
> >
> > $ printf 'Lorem morit ipsum\n' > bar/eggs
> >
> > $ bzr status
> > renamed:
> >   foo/ => bar/
> > modified:
> >   bar/eggs
>
> Yes, that is much nicer *output*.

Yes. It shows that Bazaar is correctly representing the change
operations I performed and told it.

> There is not pretending going on here. It's really not honest to call it
> that. Mercurial tracks the copy+delete carefully and uses this when
> making future merges.

Right. That's the bug: that Mercurial's representation loses the
important distinction between “renamed a filesystem entry (that happens
to be a directory)” versus “renamed a lot of other filesystem entries”.
The former is what I told the VCS about, and it's what I expect to see
when I ask the VCS what has changed.

> It's purely a matter of output.

If that's true, how is it any less of a bug?

I think from what you're telling me, though, the bug is in Mercurial's
representation of the change: it doesn't track the directory as a
filesystem entry which can be changed.

The filesystem doesn't infer directories; they are entries with their
own attributes. The project structure doesn't infer directories; they
are part of the project (even empty directories). The VCS representation
should at least support that in its dialogue with the user.

-- 
 \                 “What's another word for Thesaurus?” —Steven Wright |
  `\                                                                   |
_o__)                                                                  |
Ben Finney




More information about the bazaar mailing list