MCPcopy
hub / github.com/initialcommit-com/git-sim / construct

Method construct

src/git_sim/merge.py:43–165  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

41 self.cmd += f"{type(self).__name__.lower()} {self.branch} {'--no-ff' if self.no_ff else ''}"
42
43 def construct(self):
44 if not settings.stdout and not settings.output_only_path and not settings.quiet:
45 print(f"{settings.INFO_STRING} {self.cmd}")
46
47 if self.repo.active_branch.name in self.repo.git.branch(
48 "--contains", self.branch
49 ):
50 print(
51 "git-sim error: Branch '"
52 + self.branch
53 + "' is already included in the history of active branch '"
54 + self.repo.active_branch.name
55 + "'."
56 )
57 sys.exit(1)
58
59 self.show_intro()
60 head_commit = self.get_commit()
61 branch_commit = self.get_commit(self.branch)
62
63 if self.branch not in self.get_remote_tracking_branches():
64 if self.branch in self.repo.git.branch("--contains", head_commit.hexsha):
65 self.ff = True
66 else:
67 if self.branch in self.repo.git.branch(
68 "-r", "--contains", head_commit.hexsha
69 ):
70 self.ff = True
71
72 if self.ff:
73 self.parse_commits(branch_commit)
74 self.parse_all()
75 reset_head_to = branch_commit.hexsha
76 shift = numpy.array([0.0, 0.6, 0.0])
77
78 if self.no_ff:
79 self.center_frame_on_commit(branch_commit)
80 commitId = self.setup_and_draw_parent(branch_commit, self.message)
81
82 # If pre-merge HEAD is on screen, drawn an arrow to it as 2nd parent
83 if head_commit.hexsha in self.drawnCommits:
84 start = self.drawnCommits["abcdef"].get_center()
85 end = self.drawnCommits[head_commit.hexsha].get_center()
86 arrow = m.CurvedArrow(
87 start,
88 end,
89 color=self.fontColor,
90 stroke_width=self.arrow_stroke_width,
91 tip_shape=self.arrow_tip_shape,
92 )
93 self.draw_arrow(True, arrow)
94
95 reset_head_to = "abcdef"
96 shift = numpy.array([0.0, 0.0, 0.0])
97
98 self.recenter_frame()
99 self.scale_frame()
100 if "HEAD" in self.drawnRefs and self.no_ff:

Callers

nothing calls this directly

Calls 15

check_merge_conflictMethod · 0.95
show_introMethod · 0.80
get_commitMethod · 0.80
parse_commitsMethod · 0.80
parse_allMethod · 0.80
draw_arrowMethod · 0.80
recenter_frameMethod · 0.80
scale_frameMethod · 0.80
reset_head_branchMethod · 0.80

Tested by

no test coverage detected