Vadim Zeitlin [off-list ref] writes:
Lawrence Mitchell <wence <at> gmx.li> writes:
quoted
Vadim Zeitlin wrote:
[...]
quoted
git filter-branch --msg-filter svnmsg2git --tag-name-filter cat -- --all
git rev-list lists by default in chronological order. Do you
want to pass --topo-order as one of the rev-list options?
Thanks, this looked like a good idea but reading git-filter-branch code it
seems to already do it, at
https://github.com/git/git/blob/master/git-filter-branch.sh#L269 you can see
that it does "git rev-list --reverse --topo-order ...".
Try overring that with --date-order (you may have to patch the source).
--topo-order doesn't order by dates. --date-order does somewhat
(respecting topology), which in the absence of clock skew should do what
you are looking for.
Note that you cannot *remove* --topo-order and use the default, which is
to only respect dates and not topology; that would break filter-branch.
--
Thomas Rast
trast@{inf,student}.ethz.ch
Thomas Rast <trast <at> student.ethz.ch> writes:
Vadim Zeitlin <vz-git <at> zeitlins.org> writes:
quoted
Lawrence Mitchell <wence <at> gmx.li> writes:
quoted
Vadim Zeitlin wrote:
[...]
quoted
git filter-branch --msg-filter svnmsg2git --tag-name-filter cat -- --all
git rev-list lists by default in chronological order. Do you
want to pass --topo-order as one of the rev-list options?
Thanks, this looked like a good idea but reading git-filter-branch code it
seems to already do it, at
https://github.com/git/git/blob/master/git-filter-branch.sh#L269 you can see
that it does "git rev-list --reverse --topo-order ...".
Try overring that with --date-order (you may have to patch the source).
Thanks for the hint, this was indeed the solution. And there is actually no
need to patch the source because, considering the way git-filter-branch.sh is
written, the user-specified parameters come after the hard-coded --topo-order
and it seems that --date-order overrides it if it comes after it. So I just had
to use
git filter-branch --msg-filter svnmsg2git --tag-name-filter cat -- --date-order
--all
instead of my original command. The only remaining question I have is why isn't
--date-order the default? At least when using message filter, it seems to me
that we always want to rewrite commits in chronological order to deal with
possible back references (even when not migrating from svn, commit messages can
still refer to previous commits, like e.g. the ones created by "git revert" do
and they need to be updated when rewriting history). So why not use it in
git-filter-branch.sh?
BTW, the explanation for the new errors I was getting with --date-order was
that I had some artificial commits generated by cvs2svn in the history of this
repository which had _exactly_ the same date as the previous commit and
--date-order sorted them in the wrong order for some reason. I got round this by
simply checking for the specific form of the message (which is "This commit was
generated by cvs2svn to compensate for changes in rNNNNN, which included commits
to RCS files with non-trunk default branches.") and replacing "rNNNNN" with "the
previous commit" in this particular case in order to avoid the problem.
Thanks again for your help!
VZ