filter-repo: pass more canonical ordering of files to fast-import

Although fast-import can take file changes in any order, trying to debug
by comparing the original fast-export stream to the filtered version is
difficult if the files are randomly reordered.  Sometimes we aren't
comparing the filtered version to the original but just looking at the
stream passed to fast-import, in which case having the files in sorted
order may help.

Our accumulation of file_changes into a dict() in order to check for
collisions when renaming had the unfortunate side effect of sorting
files by internals of dictionary ordering.  Although the files started
in sorted order, we don't in general want to use the original order
because renames can cause filenames to become out-of-order.  Just apply
a simple sort at the end.

Signed-off-by: Elijah Newren <newren@gmail.com>
pull/13/head
Elijah Newren 5 years ago
parent 41c91150ec
commit c73c0304b0

@ -2967,7 +2967,7 @@ class RepoFilter(object):
_(" Commit: {}\n").format(commit.original_id) +
_(" Filename: {}").format(change.filename))
new_file_changes[change.filename] = change
commit.file_changes = new_file_changes.values()
commit.file_changes = [v for k,v in sorted(new_file_changes.items())]
# Find out which files were modified by the callbacks. Such paths could
# lead to sebsequent commits being empty (e.g. if removed a line containing

Loading…
Cancel
Save