Skip to content

Commit 9bbed4f

Browse files
committed
Added amending status message
1 parent 3a51ab8 commit 9bbed4f

1 file changed

Lines changed: 23 additions & 0 deletions

File tree

gitgud/skills/user_messages.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,3 +177,26 @@ def display_entry(index, human_name, code_name, indent):
177177
code_name=item.name,
178178
indent=indent
179179
)
180+
181+
182+
def amending_message(before_ref, after_ref, show_hashes=True, show_files=True, show_refs=True): # noqa: E501
183+
file_operator = operations.get_operator()
184+
display_data = [
185+
{"_name": "Before", "_commit": file_operator.repo.commit(before_ref)},
186+
{"_name": "After", "_commit": file_operator.repo.commit(after_ref)}
187+
]
188+
189+
for snapshot in display_data:
190+
commit = snapshot["_commit"]
191+
snapshot["Message"] = commit.message
192+
if show_hashes:
193+
snapshot["Hash"] = commit.hexsha[:7]
194+
if show_files:
195+
files = file_operator.get_commit_content(commit)
196+
snapshot["File"] = "Present" if files else "Missing"
197+
198+
for snapshot in display_data:
199+
print(snapshot["_name"] + ":")
200+
for feature in ["Hash", "Message", "File"]:
201+
print(feature, ": ", str(snapshot[feature]).strip())
202+
print()

0 commit comments

Comments
 (0)