# [PATCH] remote-hg: fix commit messages

3 messages from 2013-04-18 to 2013-04-18. Participants: Felipe Contreras, Junio C Hamano.
Thread: https://gitlist.dev/t/33532

## Felipe Contreras, 2013-04-18 06:06

Subject: [PATCH] remote-hg: fix commit messages
Message-ID: <1366265191-20815-1-git-send-email-felipe.contreras@gmail.com>
URL: https://gitlist.dev/e/1366265191-20815-1-git-send-email-felipe.contreras%40gmail.com

```
git fast-import expects an extra newline after the commit message data,
but we are adding it only on hg-git compat mode, which is why the
bidirectionality tests pass.

We should add it unconditionally.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
 contrib/remote-helpers/git-remote-hg | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/contrib/remote-helpers/git-remote-hg b/contrib/remote-helpers/git-remote-hg
index a5f0013..5481331 100755
--- a/contrib/remote-helpers/git-remote-hg
+++ b/contrib/remote-helpers/git-remote-hg
@@ -362,6 +362,8 @@ def export_ref(repo, name, kind, head):
         else:
             modified, removed = get_filechanges(repo, c, parents[0])
 
+        desc += '\n'
+
         if mode == 'hg':
             extra_msg = ''
 
@@ -385,7 +387,6 @@ def export_ref(repo, name, kind, head):
                 else:
                     extra_msg += "extra : %s : %s\n" % (key, urllib.quote(value))
 
-            desc += '\n'
             if extra_msg:
                 desc += '\n--HG--\n' + extra_msg
 
-- 
1.8.2.1.679.g509521a

```

## Felipe Contreras, 2013-04-18 06:15

Subject: Re: [PATCH] remote-hg: fix commit messages
Message-ID: <CAMP44s1MRYnJ8cQGk03Y8qg-7yMZcC=umetv=RaEDE+i=g0ZEA@mail.gmail.com>
URL: https://gitlist.dev/e/CAMP44s1MRYnJ8cQGk03Y8qg-7yMZcC%3Dumetv%3DRaEDE%2Bi%3Dg0ZEA%40mail.gmail.com
In-Reply-To: <1366265191-20815-1-git-send-email-felipe.contreras@gmail.com>

```
On Thu, Apr 18, 2013 at 1:06 AM, Felipe Contreras
<felipe.contreras@gmail.com> wrote:
> git fast-import expects an extra newline after the commit message data,
> but we are adding it only on hg-git compat mode, which is why the
> bidirectionality tests pass.
>
> We should add it unconditionally.

This doesn't depend on any other patches, and I think it might be
worth to put it in 'maint', it's not like a *huge* deal, but it would
be nice if a mercurial repo cloned with v1.8.2.2 and one cloned with
v1.8.3 end up with the same commit ids. It would have been nicer if
v1.8.1 had this already, but hey, it's new, and it's in contrib.

Cheers.

-- 
Felipe Contreras

```

## Junio C Hamano, 2013-04-18 17:43

Subject: Re: [PATCH] remote-hg: fix commit messages
Message-ID: <7vhaj368g9.fsf@alter.siamese.dyndns.org>
URL: https://gitlist.dev/e/7vhaj368g9.fsf%40alter.siamese.dyndns.org
In-Reply-To: <1366265191-20815-1-git-send-email-felipe.contreras@gmail.com>

```
Felipe Contreras <felipe.contreras@gmail.com> writes:

> git fast-import expects an extra newline after the commit message data,
> but we are adding it only on hg-git compat mode, which is why the
> bidirectionality tests pass.
>
> We should add it unconditionally.
>
> Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
> ---

Without knowing that hg-git compat mode is what is used in bidi test
(the only mode that supports bidi), "which is why" was ungrokkable.

This is a trivial change without downside risk so I do not mind
applying it to 'maint', as you say it is an appropriate there.

>  contrib/remote-helpers/git-remote-hg | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/contrib/remote-helpers/git-remote-hg b/contrib/remote-helpers/git-remote-hg
> index a5f0013..5481331 100755
> --- a/contrib/remote-helpers/git-remote-hg
> +++ b/contrib/remote-helpers/git-remote-hg
> @@ -362,6 +362,8 @@ def export_ref(repo, name, kind, head):
>          else:
>              modified, removed = get_filechanges(repo, c, parents[0])
>  
> +        desc += '\n'
> +
>          if mode == 'hg':
>              extra_msg = ''
>  
> @@ -385,7 +387,6 @@ def export_ref(repo, name, kind, head):
>                  else:
>                      extra_msg += "extra : %s : %s\n" % (key, urllib.quote(value))
>  
> -            desc += '\n'
>              if extra_msg:
>                  desc += '\n--HG--\n' + extra_msg

```
