Commit 320f0ac856b9a1f6862e8189dccfcb9bb0589628
1 parent
6e1ee1fe
Exists in
master
and in
4 other branches
Migrate notes.line_code format.
Since version 4.1, notes.line_code means: {SHA1 hash of file path}_{old line}_{new line} but the older version means: {file index of the commit}_{old line}_{new line} This rake task migrate the above differences.
Showing
1 changed file
with
13 additions
and
0 deletions
Show diff stats
... | ... | @@ -0,0 +1,13 @@ |
1 | +desc "GITLAB | Migrate Note LineCode" | |
2 | +task migrate_note_linecode: :environment do | |
3 | + Note.inline.each do |note| | |
4 | + index = note.diff_file_index | |
5 | + if index =~ /^\d{1,10}$/ # is number. not hash. | |
6 | + hash = Digest::SHA1.hexdigest(note.noteable.diffs[index.to_i].new_path) | |
7 | + new_line_code = note.line_code.sub(index, hash) | |
8 | + note.update_column :line_code, new_line_code | |
9 | + print '.' | |
10 | + end | |
11 | + end | |
12 | +end | |
13 | + | ... | ... |