Skip to content

Commit cb21b13

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

1 file changed

Lines changed: 25 additions & 0 deletions

File tree

gitgud/skills/user_messages.py

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

0 commit comments

Comments
 (0)