Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incompatibility with hg-git tip version due to rename detection #35

Open
fingolfin opened this issue Jan 13, 2015 · 1 comment
Open

Comments

@fingolfin
Copy link
Contributor

hg-git recently added file rename detection. In particular, they add a mercurial "extra" field where they record the "source" of renames, and this new field ("hg-git-rename-source=git") break things.

Note that Mercurial 3.3 is incompatible with hg-git 0.7.0, and so once hg 3.3 is out, one will have to use it with hg-git newer than 0.7.0, which in turn means git-remote-hg users may run into this issue.

Relevant hg-git commit:
https://bitbucket.org/durin42/hg-git/commits/fffe8883960b7c45e0dfe597f3b79bd1f4824cbe

Typical diff (from first hg-git test, "executable bit")

--- output-hg   2015-01-13 15:46:17.000000000 +0000
+++ output-git  2015-01-13 15:46:18.000000000 +0000
@@ -1,8 +1,8 @@
-@  changeset:   2:04585efb2d7e9262381ab791282b68ceb33398d0
+@  changeset:   2:1efb93106a36bf71352ab04e769a3422522cf946
 |  bookmark:    master
 |  tag:         tip
 |  phase:       draft
-|  parent:      1:9d3aaf34d914c50354fbcca3a0c309351f159546
+|  parent:      1:d7cae8b1fdab97568ba5eca44ca2bf5a44d7c394
 |  parent:      -1:0000000000000000000000000000000000000000
 |  manifest:    2:51e6255d794f794a8c4e0f03edf264444e3c5ce7
 |  user:        A U Thor <[email protected]>
@@ -10,14 +10,13 @@
 |  files:       alpha
 |  extra:       branch=default
 |  extra:       committer=C O Mitter <[email protected]> 1167600600 -9000
-|  extra:       hg-git-rename-source=git
 |  description:
 |  clear executable bit
 |
 |
-o  changeset:   1:9d3aaf34d914c50354fbcca3a0c309351f159546
+o  changeset:   1:d7cae8b1fdab97568ba5eca44ca2bf5a44d7c394
 |  phase:       draft
-|  parent:      0:97e0f86af84c927e56ac1e6159b5b2386ac3e110
+|  parent:      0:362b656574c3c9e89fa7f2d7a943091dc93bce4d
 |  parent:      -1:0000000000000000000000000000000000000000
 |  manifest:    1:e4bf4ef5e9aea7a6a57573e533a5519bd062f144
 |  user:        A U Thor <[email protected]>
@@ -25,12 +24,11 @@
 |  files:       alpha
 |  extra:       branch=default
 |  extra:       committer=C O Mitter <[email protected]> 1167600600 -9000
-|  extra:       hg-git-rename-source=git
 |  description:
 |  set executable bit
 |
 |
-o  changeset:   0:97e0f86af84c927e56ac1e6159b5b2386ac3e110
+o  changeset:   0:362b656574c3c9e89fa7f2d7a943091dc93bce4d
    phase:       draft
    parent:      -1:0000000000000000000000000000000000000000
    parent:      -1:0000000000000000000000000000000000000000
@@ -40,7 +38,6 @@
    files+:      alpha
    extra:       branch=default
    extra:       committer=C O Mitter <[email protected]> 1167600600 -9000
-   extra:       hg-git-rename-source=git
    description:
    add alpha

In case it helps (probably not): The following naive and brainless patch (i.e. made without actually thinking about the issue) is, not surprisingly, not helping much. It causes some tests to pass, but causes issues in others.

diff --git a/git-remote-hg b/git-remote-hg
index 0d903e3..6900499 100755
--- a/git-remote-hg
+++ b/git-remote-hg
@@ -538,7 +538,8 @@ def export_ref(repo, name, kind, head):
                 extra_msg += "rename : %s => %s\n" % e

             for key, value in extra.iteritems():
-                if key in ('author', 'committer', 'encoding', 'message', 'branch', 'hg-git'):
+                if key in ('author', 'committer', 'encoding', 'message', 'branch',
+                           'hg-git', 'hg-git-rename-source'):
                     continue
                 else:
                     extra_msg += "extra : %s : %s\n" % (key, urllib.quote(value))
@@ -870,6 +871,9 @@ def parse_commit(parser):
                     extra[ek] = urllib.unquote(ev)
             data = data[:i]

+    if 'hg-git-rename-source' not in extra:
+        extra['hg-git-rename-source'] = 'git'   # HACK
+
     ctx = context.memctx(repo, (p1, p2), data,
             files.keys(), getfilectx,
             user, (date, tz), extra)
fingolfin added a commit to fingolfin/git-remote-hg that referenced this issue Jan 13, 2015
hg 3.3 is incompatible with hg-git 0.7.0; unfortunately, we are in turn
incompatible with dev version of hg-git. See felipec#35
@felipec
Copy link
Owner

felipec commented May 17, 2016

In order to properly fix this the new git extra metadata should be used first. That's a non-trivial port of the new hg-git functionality.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants