Skip to content

Commit c7761dc

Browse files
committed
show: Add 'Merge: {parentIDs}' line to text output
For consistency with `git show`. Useful for identifying a commit as a merge commit; it's hard to notice otherwise
1 parent ea6ec69 commit c7761dc

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

kart/text_diff_writer.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,10 @@ def write_header(self):
4949
author_time_in_author_timezone = author_time_utc.astimezone(author_timezone)
5050

5151
click.secho(f"commit {self.commit.hex}", fg="yellow", **self.pecho)
52+
if len(self.commit.parent_ids) > 1:
53+
parents = self.commit.parents
54+
parent_ids_s = " ".join(str(x.short_id) for x in parents)
55+
click.secho(f"Merge: {parent_ids_s}", **self.pecho)
5256
click.secho(f"Author: {author.name} <{author.email}>", **self.pecho)
5357
click.secho(
5458
f'Date: {author_time_in_author_timezone.strftime("%c %z")}',

tests/point_cloud/test_conflicts.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ def test_resolve_conflict_with_workingcopy(cli_runner, data_archive, requires_pd
168168

169169
r = cli_runner.invoke(["show", "HEAD", "auckland:tile:auckland_0_0"])
170170
assert r.exit_code == 0, r.stderr
171-
assert r.stdout.splitlines()[4:] == [
171+
assert r.stdout.splitlines()[5:] == [
172172
' Merge with "theirs_branch"',
173173
"",
174174
"--- auckland:tile:auckland_0_0",
@@ -226,7 +226,7 @@ def test_resolve_conflict_with_file(cli_runner, data_archive, requires_pdal, tmp
226226

227227
r = cli_runner.invoke(["show", "HEAD", "auckland:tile:auckland_0_0"])
228228
assert r.exit_code == 0, r.stderr
229-
assert r.stdout.splitlines()[4:] == [
229+
assert r.stdout.splitlines()[5:] == [
230230
' Merge with "theirs_branch"',
231231
"",
232232
"--- auckland:tile:auckland_0_0",

tests/test_resolve.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -379,7 +379,7 @@ def test_resolve_schema_conflict(data_working_copy, cli_runner):
379379
["show", "HEAD", "--", "nz_waca_adjustments:feature:9999999"]
380380
)
381381
assert r.exit_code == 0, r.stderr
382-
assert r.stdout.splitlines()[4:] == [
382+
assert r.stdout.splitlines()[5:] == [
383383
" Merge with 'theirs_branch'",
384384
"",
385385
"--- nz_waca_adjustments:feature:9999999",

0 commit comments

Comments
 (0)