Fixing mixed line endings in multiple branches
Alexander Belchenko
bialix at ukr.net
Sat Feb 28 09:55:16 GMT 2009
Frits Jalvingh пишет:
> But my repositories have obtained a problem: lots of files have incorrect line
> endings (some files even have both crlf and lf-only endings in the same
> file). And I need to fix this to have everything use a single line ending
> (lf-only).
Too bad. Unfortunately fixing this will break annotation.
I know, because we did this at work in 2006, after then in some cases
it's hard to track down the annotation.
Once native support for line-endings will land to bzr core, I'd like to
find the way to replay history of all my branches and filter out wrong
line-endings. Unfortunately in your case it's maybe hard.
> However, fixing those files, starting at prod-1.0, means all files fixed are
> changed fully, i.e. every single line is changed. After committing this
> merges upward are of course very problematic: it causes conflicts on every
> changed file because they "overwrite" earlier delta's in the higher branches.
> Each "conflict" is the full "old" file from the higher branch against the
> full "new" file from the fixed lower branch. This makes the merge impossible.
>
> Is there any way that I can tell Bazaar to ignore line endings in some way?
The work on this still in progress, but you can use external diff tool
(e.g. GNU diff3) in the ignore line-endings mode for merge.
> Is there another way to fix the files without having all merges upwards blocked?
Nope. Only replay the history, but the tool for this is not available
yet. FastImport plugin may be can help there, but it lacks this feature.
> As an alternative I'm having the idea to do the following:
> - fix prod-1.0 and commit
> - do the merge upward, to prod-1.1
> - revert all FILE CHANGES (not the merge itself) by "bzr revert ."
> - Commit this on the prod-1.1. This only records the merge so it is not
> retried.
> - Now fix prod-1.1 manually like the 1.0 branch.
These two actions should be executed in different order:
- Now fix prod-1.1 manually like the 1.0 branch.
- Commit this on the prod-1.1. This only records the merge so it is not
retried.
This way you'll commit the merge of line-endings fix as real
line-endings fix. Otherwise you'll have big problems with merge in future.
> - Commit, merge upward to 1.2 enz (lather, rinse, repeat)
>
> Would this method work? Would merges upwards still be possible after this?
> Would I get problems when bazaar uses a "base revision" when it diffs
> subsequent changes?
I think it *could* work, although I don't try it. As I said we convert
one of our project at work to use LF-only, but we have only 1
development branch these days.
You can experiment with this freely: just branch prod-1.0 & prod-1.1 on
local disk, fix 1.0, merge and fix to 1.1, then make some trivial change
in 1.0 and try to merge it to 1.1. And you'll see how it'll work for you.
It will be nice if you post here is this scenario will work for you or not.
More information about the bazaar
mailing list