Page MenuHomePhabricator

commit: move sorting of added and removed files list to lower level
ClosedPublic

Authored by martinvonz on May 16 2019, 1:13 PM.

Details

Summary

localrepo.commitctx() has lists of all changed files, as well as lists
of added and removed files. The list of all files is unsorted and
changelog.add() will sort it. Let's also sort the lists of added and
removed files at a lower level (manifestrevlog.add()) for
consistency. It also seems safer to do it there, just before we write
them to the store. That way other callers won't be able to create
invalid commits (or whatever the consequence is) by passing in
unsorted lists. Also, alternative storages may not care that the lists
are sorted. I don't think this will be a performance problem (someone
should have fixed the sorting in changelog.add() if it were).

Diff Detail

Repository
rHG Mercurial
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

martinvonz created this revision.May 16 2019, 1:13 PM
pulkit added a subscriber: pulkit.May 16 2019, 1:41 PM

The changes looks okay but I can't think why you want to do that. Can you add some details about the motivation for this change to commit message?

In D6390#92963, @pulkit wrote:

The changes looks okay but I can't think why you want to do that. Can you add some details about the motivation for this change to commit message?

It was mostly just consistency, but I'll add a bit more

martinvonz edited the summary of this revision. (Show Details)May 16 2019, 1:45 PM
This revision was automatically updated to reflect the committed changes.