Performance: don't create trees and blobs, only update repos once

This commit is contained in:
blinry 2021-01-13 13:30:08 +01:00
parent cccaa75a48
commit fe97283ddb
5 changed files with 16 additions and 21 deletions

View File

@ -112,9 +112,6 @@ func construct():
continue
game.global_shell.run("git remote add %s '%s'" % [r2, repos[r2].path])
# Allow receiving a push of the checked-out branch.
game.global_shell.run("git config receive.denyCurrentBranch ignore")
for r in repos:
var repo = repos[r]
game.global_shell.cd(repo.path)

View File

@ -102,7 +102,7 @@ func load_level(level_id):
terminal.clear()
terminal.find_node("TextEditor").close()
update_repos()
#update_repos()
# Unmute the audio after a while, so that player can hear pop sounds for
# nodes they create.

View File

@ -179,11 +179,8 @@ size_flags_vertical = 3
margin_right = 633.0
margin_bottom = 60.0
rect_min_size = Vector2( 0, 60 )
size_flags_vertical = 3
size_flags_stretch_ratio = 0.0
custom_fonts/normal_font = ExtResource( 7 )
text = "Level name here!"
fit_content_height = true
__meta__ = {
"_edit_use_anchors_": false
}
@ -191,14 +188,12 @@ __meta__ = {
[node name="Text" type="Control" parent="Rows/Columns/RightSide/LevelInfo/LevelPanel"]
margin_top = 65.0
margin_right = 633.0
margin_bottom = 464.0
margin_bottom = 264.0
size_flags_vertical = 3
[node name="LevelDescription" type="RichTextLabel" parent="Rows/Columns/RightSide/LevelInfo/LevelPanel/Text"]
anchor_right = 1.0
anchor_bottom = 1.0
margin_left = 0.943848
margin_right = 0.943848
size_flags_vertical = 3
bbcode_enabled = true
bbcode_text = "Level description here!"
@ -220,11 +215,10 @@ __meta__ = {
}
[node name="Goals" type="VBoxContainer" parent="Rows/Columns/RightSide/LevelInfo/LevelPanel"]
margin_top = 469.0
margin_top = 269.0
margin_right = 633.0
margin_bottom = 469.0
size_flags_vertical = 3
size_flags_stretch_ratio = 0.0
[node name="FileBrowser" parent="Rows/Columns/RightSide" instance=ExtResource( 5 )]
anchor_right = 0.0

View File

@ -46,6 +46,7 @@ func there_is_a_git():
return shell.run("test -d .git && echo yes || echo no") == "yes\n"
func update_everything():
print("update_everything()")
if there_is_a_git():
update_head()
update_refs()
@ -65,8 +66,8 @@ func set_path(new_path):
for o in objects.values():
o.queue_free()
objects = {}
if is_inside_tree():
update_everything()
# if is_inside_tree():
# update_everything()
func get_path():
return path
@ -92,6 +93,10 @@ func update_objects():
var type = object_type(o)
if simplified_view:
if type == "tree" or type == "blob":
continue
var n = node.instance()
n.id = o
n.type = object_type(o)
@ -106,7 +111,7 @@ func update_objects():
n.content = n.content.replacen("\t", " ")
"commit":
var c = {}
c[commit_tree(o)] = ""
#c[commit_tree(o)] = ""
for p in commit_parents(o):
c[p] = ""
n.children = c
@ -121,10 +126,6 @@ func update_objects():
nodes.add_child(n)
objects[o] = n
if simplified_view:
if type == "tree" or type == "blob":
n.hide()
func update_node_positions():
if there_is_a_git():
var graph_text = shell.run("git log --graph --oneline --all --no-abbrev")
@ -226,7 +227,8 @@ func update_head():
n.children = {ref_target("HEAD"): ""}
func all_objects():
var obj = git("cat-file --batch-check='%(objectname)' --batch-all-objects", true)
#var obj = git("cat-file --batch-check='%(objectname)' --batch-all-objects", true)
var obj = git("cat-file --batch-check='%(objectname) %(objecttype)' --batch-all-objects | grep '\\(tag\\|commit\\)$' | cut -f1 -d' '", true)
var dict = {}
for o in obj:
dict[o] = ""

View File

@ -10,3 +10,5 @@
decorate = true
[advice]
detachedHead = false
[receive]
denyCurrentBranch = ignore