Remove scripts used in merging the refactoring (#23669)

Release Notes:

- N/A
This commit is contained in:
Michael Sloan
2025-01-26 06:33:11 +00:00
committed by GitHub
parent 84b945e89d
commit 0f8e2e3811
2 changed files with 0 additions and 179 deletions
-111
View File
@@ -1,111 +0,0 @@
#!/bin/bash
# Merge process:
#
# * Use mergiraf for merge, with `git merge main -X theirs`
#
# - Need to use it with a patched tree-sitter-rust. I (Michael)
# haven't yet uploaded a fork for this, can do if helpful.
# https://github.com/tree-sitter/tree-sitter-rust/pull/245
#
# - Watch for newlines between top level decls sometimes disappearing
#
# * Run this script.
dry=true
if [ "$1" = "apply" ]; then
dry=false
fi
re() {
echo "$1" " --> " "$2"
if [ "$dry" = true ]; then
ruplacer "$1" "$2" crates/ --type *.rs
else
ruplacer "$1" "$2" crates/ --type *.rs --go
fi
}
re '\.new_view\(' '.new_model('
re 'cx.view\(' 'cx.model('
re '\.observe_new_views\(' '.observe_new_models('
re 'View<' 'Model<'
re 'FocusableView' 'Focusable'
# closure parameters
re ', &mut WindowContext\)' ', &mut Window, &mut AppContext)'
re ', &mut ViewContext<([^>]+)>\)' ', &mut Window, &mut ModelContext<$1>)'
re '\(&mut WindowContext\)' '(&mut Window, &mut AppContext)'
re '\(&mut ViewContext<([^>]+)>\)' '(&mut Window, &mut ModelContext<$1>)'
# function parameters
re '_: &mut WindowContext\)' '_window: &mut Window, _cx: &mut AppContext)'
re '_: &mut ViewContext<([^>]+)>\)' '_window: &mut Window, _cx: &mut ModelContext<$1>)'
re '_: &mut WindowContext,' '_window: &mut Window, _cx: &mut AppContext,'
re '_: &mut ViewContext<([^>]+)>,' '_window: &mut Window, _cx: &mut ModelContext<$1>,'
re '_cx: &mut WindowContext\)' '_window: &mut Window, _cx: &mut AppContext)'
re '_cx: &mut ViewContext<([^>]+)>\)' '_window: &mut Window, _cx: &mut ModelContext<$1>)'
re '_cx: &mut WindowContext,' '_window: &mut Window, _cx: &mut AppContext,'
re '_cx: &mut ViewContext<([^>]+)>,' '_window: &mut Window, _cx: &mut ModelContext<$1>,'
re 'cx: &mut WindowContext\)' 'window: &mut Window, cx: &mut AppContext)'
re 'cx: &mut ViewContext<([^>]+)>\)' 'window: &mut Window, cx: &mut ModelContext<$1>)'
re 'cx: &mut WindowContext,' 'window: &mut Window, cx: &mut AppContext,'
re 'cx: &mut ViewContext<([^>]+)>,' 'window: &mut Window, cx: &mut ModelContext<$1>,'
re '_: &WindowContext\)' '_window: &Window, _cx: &AppContext)'
re '_: &ViewContext<([^>]+)>\)' '_window: &Window, _cx: &ModelContext<$1>)'
re '_: &WindowContext,' '_window: &Window, _cx: &AppContext,'
re '_: &ViewContext<([^>]+)>,' '_window: &Window, _cx: &ModelContext<$1>,'
re '_cx: &WindowContext\)' '_window: &Window, _cx: &AppContext)'
re '_cx: &ViewContext<([^>]+)>\)' '_window: &Window, _cx: &ModelContext<$1>)'
re '_cx: &WindowContext,' '_window: &Window, _cx: &AppContext,'
re '_cx: &ViewContext<([^>]+)>,' '_window: &Window, _cx: &ModelContext<$1>,'
re 'cx: &WindowContext\)' 'window: &Window, cx: &AppContext)'
re 'cx: &ViewContext<([^>]+)>\)' 'window: &Window, cx: &ModelContext<$1>)'
re 'cx: &WindowContext,' 'window: &Window, cx: &AppContext,'
re 'cx: &ViewContext<([^>]+)>,' 'window: &Window, cx: &ModelContext<$1>,'
# VisualContext methods moved to window, that take context
re 'cx.dismiss_view\(' 'window.dismiss_view(cx, '
re 'cx.focus_view\(' 'window.focus_view(cx, '
re 'cx.new_view\(' 'window.new_view(cx, '
re 'cx.replace_root_view\(' 'window.replace_root_view(cx, '
# AppContext methods moved to window, that take context
re 'cx.appearance_changed\(\)' 'window.appearance_changed(cx)'
re 'cx.available_actions\(\)' 'window.available_actions(cx)'
re 'cx.dispatch_keystroke_observers\(' 'window.dispatch_keystroke_observers(cx, '
re 'cx.display\(\)' 'window.display(cx)'
re 'cx.focused\(\)' 'window.focused(cx)'
re 'cx.handle_input\(' 'window.handle_input(cx, '
re 'cx.paint_svg\(' 'window.paint_svg(cx, '
re 'cx.request_layout\(' 'window.request_layout(cx, '
re 'cx.use_asset\(' 'window.use_asset(cx, '
# Subset of AppContext methods moved to window that don't take context
re 'cx\.set_cursor_style\(' 'window.set_cursor_style('
re 'cx\.modifiers\(' 'window.modifiers('
re 'cx\.mouse_position\(' 'window.mouse_position('
re 'cx\.text_style\(' 'window.text_style('
re 'cx\.line_height\(' 'window.line_height('
# common closure patterns
re 'cx.listener\(move \|this, _, cx\|' 'cx.listener(move |this, _, window, cx|'
re 'cx.listener\(\|this, _, cx\|' 'cx.listener(|this, _, window, cx|'
re 'cx.listener\(move \|_, _, cx\|' 'cx.listener(move |_, _, window, cx|'
re 'cx.listener\(\|_, _, cx\|' 'cx.listener(|_, _, window, cx|'
re '\.on_click\(move \|_, cx\|' '.on_click(move |_, window, cx|'
re '\.on_mouse_move\(\|_, cx\|' '.on_mouse_move(|_, window, cx|'
# cleanup imports
re ' ViewContext,' ''
re ' WindowContext,' ''
re ' WeakView,' ''
re ' View,' ''
re ', ViewContext\}' '}'
re ', WindowContext\}' '}'
re ', WeakView\}' '}'
re ', View\}' '}'
# other patterns
re '\.detach_and_notify_err\(cx' '.detach_and_notify_err(window, cx'
-68
View File
@@ -1,68 +0,0 @@
#!/bin/env python3
import os
from pathlib import Path
def process_file(filepath):
with open(filepath, 'r', encoding='utf-8') as f:
lines = f.readlines()
modified_lines = []
in_conflict = False
after_equals = False
keep_lines = []
for line in lines:
if line.startswith('<<<<<<<'):
in_conflict = True
after_equals = False
keep_lines = []
continue
elif line.startswith('======='):
after_equals = True
continue
elif line.startswith('>>>>>>>'):
in_conflict = False
after_equals = False
modified_lines.extend(keep_lines)
continue
if in_conflict:
if after_equals:
keep_lines.append(line)
else:
modified_lines.append(line)
# Only write if changes were made
if lines != modified_lines:
with open(filepath, 'w', encoding='utf-8') as f:
f.writelines(modified_lines)
print(f"Processed: {filepath}")
return True
return False
def main():
# Get current directory
current_dir = Path('.')
# Find all .rs files recursively
rust_files = list(current_dir.rglob('*.rs'))
files_processed = 0
files_modified = 0
# Process each file
for filepath in rust_files:
try:
files_processed += 1
if process_file(filepath):
files_modified += 1
except Exception as e:
print(f"Error processing {filepath}: {str(e)}")
print(f"\nSummary:")
print(f"Files processed: {files_processed}")
print(f"Files modified: {files_modified}")
if __name__ == "__main__":
main()