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

'Object xxxx already has a mark' when pushing to hg repo #48

Closed
itronics opened this issue Oct 29, 2013 · 3 comments
Closed

'Object xxxx already has a mark' when pushing to hg repo #48

itronics opened this issue Oct 29, 2013 · 3 comments

Comments

@itronics
Copy link

I have used git-remote-hg for pushing changes to Hg based sourceforge project for a long time and all was working correct on old git-remote-hg versions (I've used the script version maintained in separate repo until it was included in your git fork).
Now cloning remote repo works fine, but any push local commits to hg repo ends with something like:

error: Object ��Á�§ê*Žœ\O,K|�ö>å=ÿ� already has a mark
error: Object c�ê��ÍÆa�{  é-Ù����2üÿ� already has a mark
error: Object �=· Û*šV?ÄÔÝ6Ý­æwÈ­£ÿ� already has a mark
error: Object º�}ª��®�

Steps to reproduce:

mkdir /tmp/t
cd /tmp/t
hg clone http://hg.code.sf.net/p/frontaccounting/mercurial h
git clone hg::h g
cd g
echo bb >> f
git add f
git commit -m 'add bb'
git push

The problems appears regardless I try to push to remote or local Hg repo.
Git version installed is 1.7.9.5, Hg 2.0.2 on ubuntu.
Let me know if you need more information.

@felipec
Copy link
Owner

felipec commented Oct 31, 2013

Take a closer look, it actually ends with:

To hg::/tmp/t/h
 * [new branch]      master -> master

So everything is working fine, it's just that Git is throwing those errors wrongly. If you use a newer version of Git no errors would pop up.

I'm tempted to close this right away, as I don't see what git-remote-hg could do to get rid of that message that is wrong anyway, but you say an older version worked fine. Which version is that?

@felipec
Copy link
Owner

felipec commented Oct 31, 2013

I found the commit, and I think we are doing the right thing, so I'm closing this.

However, if you want to fix this case for you, try this patch

--- a/contrib/remote-helpers/git-remote-hg
+++ b/contrib/remote-helpers/git-remote-hg
@@ -23,6 +23,7 @@ import subprocess
 import urllib
 import atexit
 import urlparse
+import hashlib

 #
 # If you want to switch to hg-git compatibility mode:
@@ -227,14 +228,14 @@ def export_files(files):

     final = []
     for f in files:
-        fid = node.hex(f.filenode())
+        d = f.data()
+        fid = hashlib.sha1(d).digest()

         if fid in filenodes:
             mark = filenodes[fid]
         else:
             mark = marks.next_mark()
             filenodes[fid] = mark
-            d = f.data()

             print "blob"
             print "mark :%u" % mark

AFAIK, this version would perform slower in most repositories, so that's why it's not enabled.

@felipec felipec closed this as completed Oct 31, 2013
@itronics
Copy link
Author

Yes, you are right, it is probably git version related issue. Now having the patch applied I can see there is another problem which was hidden by the error messages. I will describe it in another ticket.
FYI the working git-remote-hg version was installed on my box in January (I don't know the exact version).
Janusz

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