Package: git-remote-hg
Version: 0.3-1
Severity: grave
Tags: patch
Justification: renders package unusable

When I pull from a mercurial origin I get the following error:

$ GIT_TRACE=1 git pull
16:56:41.648900 git.c:350               trace: built-in: git 'pull'
16:56:41.649394 run-command.c:336       trace: run_command: 'fetch' 
'--update-head-ok'
16:56:41.649575 exec_cmd.c:120          trace: exec: 'git' 'fetch' 
'--update-head-ok'
16:56:41.650293 git.c:350               trace: built-in: git 'fetch' 
'--update-head-ok'
16:56:41.650947 run-command.c:336       trace: run_command: 'git-remote-hg' 
'origin' 'ssh://hg@XXXXXXXXXXXXXXXXXX
16:56:41.722759 git.c:350               trace: built-in: git 'config' '--get' 
'remote-hg.hg-git-compat'
16:56:41.724205 git.c:350               trace: built-in: git 'config' '--get' 
'remote-hg.track-branches'
16:56:41.728526 git.c:350               trace: built-in: git 'config' '--get' 
'remote-hg.insecure'
remote: X11 forwarding request failed on channel 0
searching for changes
no changes found
ERROR: 'module' object has no attribute 'write'


The problem is related to the new version of mercurial and it seems to be 
solved by this patch:
https://github.com/felipec/git-remote-hg/commit/822c6e4b03d9e66df8261f323caded716e8d8b8d?diff=unified


-- System Information:
Debian Release: stretch/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (500, 'testing'), (500, 'stable'), (1, 
'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386, armhf

Kernel: Linux 4.6.4 (SMP w/8 CPU cores; PREEMPT)
Locale: LANG=it_IT.UTF-8, LC_CTYPE=it_IT.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages git-remote-hg depends on:
ii  git        1:2.9.3-1
ii  mercurial  3.9-1
ii  python     2.7.11-2

git-remote-hg recommends no packages.

Versions of packages git-remote-hg suggests:
ii  git-doc  1:2.9.3-1

-- no debconf information
diff --git a/git-remote-hg b/git-remote-hg
index 87dc8f3..1749d43 100755
--- a/git-remote-hg
+++ b/git-remote-hg
@@ -373,10 +373,23 @@ def updatebookmarks(repo, peer):
     for k, v in remotemarks.iteritems():
         localmarks[k] = hgbin(v)
 
-    if hasattr(localmarks, 'write'):
-        localmarks.write()
+    if check_version(3, 6):
+        lock = tr = None
+        try:
+            lock = repo.lock()
+            tr = repo.transaction('bookmark')
+            localmarks.recordchange(tr)
+            tr.close()
+        finally:
+            if tr is not None:
+                tr.release()
+            if lock is not None:
+                lock.release()
     else:
-        bookmarks.write(repo)
+        if hasattr(localmarks, 'write'):
+            localmarks.write()
+        else:
+            bookmarks.write(repo)
 
 def get_repo(url, alias):
     global peer

Reply via email to