[PATCH] Fix backwards compatibility with extrainmessage

8 views
Skip to first unread message

Felipe Contreras

unread,
Aug 10, 2022, 11:52:50 PM8/10/22
to hg-...@googlegroups.com, Felipe Contreras
When hg-git-rename-source was introduced it was added unconditionally in
order to not break bidirectionality, however, that only applies if
debugextrainmessage is not set, if it's set 'HG:rename-source' is not
added.

The hg-git-rename-source change broke bidirectionality tests with
git-remote-hg, the following patch restores it back.

Signed-off-by: Felipe Contreras <felipe.c...@gmail.com>
---

Can you please take a lookg? I've been having to patch hggit every time
I want to run tests for many years.

hggit/git_handler.py | 3 ++-
tests/test-extra.t | 9 +++++++++
2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/hggit/git_handler.py b/hggit/git_handler.py
index fabb9e8..de609d2 100644
--- a/hggit/git_handler.py
+++ b/hggit/git_handler.py
@@ -1085,7 +1085,8 @@ class GitHandler(object):
hg_branch,
extra,
) = git2hg.extract_hg_metadata(commit.message, commit.extra)
- if hg_renames is None:
+ extra_in_message = self.ui.configbool(b'git', b'debugextrainmessage', False)
+ if hg_renames is None and not extra_in_message:
detect_renames = True
# We have to store this unconditionally, even if there are no
# renames detected from Git. This is because we export an extra
diff --git a/tests/test-extra.t b/tests/test-extra.t
index 0f0ac65..ffba02c 100644
--- a/tests/test-extra.t
+++ b/tests/test-extra.t
@@ -200,3 +200,12 @@ lets you do that, though.
o 0 aa9eb6424386df2b0638fe6f480c3767fdd0e6fd a
branch=default hg-git-rename-source=git

+Make sure legacy extra is bidirectionally compatible
+ $ cd ../gitrepo
+ $ git commit -q --allow-empty -m 'empty'
+ $ cd ../hgrepo
+ $ hg pull -q --config git.debugextrainmessage=1
+ $ hg log -G -l 1 -T "{rev} {node} {desc|firstline}\n{join(extras, ' ')}\n\n"
+ o 8 9bfa18f45f66420461d0ea202ded51c00dac2bf8 empty
+ | branch=default
+ ~
--
2.37.1

Reply all
Reply to author
Forward
0 new messages