threads / bug / 30665

bug? Python traceback on git push

Subject: bug? Python traceback on git push

## tl;dr

2 messages between May 30, 2012 and May 31, 2012.

replies: 1people: 2as markdown or json

Pedro Werneck· May 30, 2012, 22:11 UTC · lore
git 1.7.9.5
I was pushing to a repository
push actually seems to have worked, but popped this weird python traceback
(tcf-env)werneck@werneck:~/devel/tcf-api/src/tcf$ git push
Warning: Permanently added 'bitbucket.org,207.223.240.181' (RSA) to
the list of known hosts.
Counting objects: 15, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (8/8), done.
Writing objects: 100% (8/8), 860 bytes, done.
Total 8 (delta 7), reused 0 (delta 0)
remote: Traceback (most recent call last):
remote:   File "/opt/python/domains/bitbucket.org/current/bitbucket/scripts/git/hooks/pre-receive",
line 9, in <module>
remote:     from bitbucket.apps.repo2.hooks import prehooks
remote:   File "/data/vol1/www/venvs/deployed/bitbucket/apps/repo2/hooks.py",
line 4, in <module>
remote:     from orochi.hooks import failonerror, HookError, HookManager
remote:   File "/opt/python/domains/bitbucket.org/current/bitbucket/local/env/lib/python2.7/site-packages/orochi/hooks.py",
line 9, in <module>
remote:     from orochi.git import githook
remote:   File "/opt/python/domains/bitbucket.org/current/bitbucket/local/env/lib/python2.7/site-packages/orochi/git.py",
line 23, in <module>
remote:     from orochi.lock import lock
remote:   File "/opt/python/domains/bitbucket.org/current/bitbucket/local/env/lib/python2.7/site-packages/orochi/lock.py",
line 9, in <module>
remote:     from mercurial.lock import lock as mlock
remote: ImportError: No module named mercurial.lock
To git@bitbucket.org:titansgroup/tcf-api.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'git@bitbucket.org:titansgroup/tcf-api.git'
(tcf-env)werneck@werneck:~/devel/tcf-api/src/tcf$ git pull
Warning: Permanently added 'bitbucket.org,207.223.240.181' (RSA) to
the list of known hosts.
Already up-to-date.
(tcf-env)werneck@werneck:~/devel/tcf-api/src/tcf$ git push
Warning: Permanently added 'bitbucket.org,207.223.240.181' (RSA) to
the list of known hosts.
Counting objects: 15, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (8/8), done.
Writing objects: 100% (8/8), 860 bytes, done.
Total 8 (delta 7), reused 0 (delta 0)
remote: bb/acl: pjwerneck is allowed. accepted payload.
To git@bitbucket.org:titansgroup/tcf-api.git
   16b3b54..a50f671  master -> master
-- 
---
Pedro Werneck
Jeff King· May 31, 2012, 01:08 UTC · re: Pedro Werneck · lore

Re: bug? Python traceback on git push

On Wed, May 30, 2012 at 07:11:38PM -0300, Pedro Werneck wrote:
Show 5 quoted lines
> git 1.7.9.5
> 
> I was pushing to a repository
> 
> push actually seems to have worked, but popped this weird python traceback

Not a bug in git. There is no python code at all in the push code path (the only python in git these days is in the experimental svn remote-helper). However, the remote side may have a hook that is written in python...

Show 9 quoted lines
> remote: Traceback (most recent call last):
> remote:   File "/opt/python/domains/bitbucket.org/current/bitbucket/scripts/git/hooks/pre-receive",
> line 9, in <module>
> remote:     from bitbucket.apps.repo2.hooks import prehooks
> [...]
> remote: ImportError: No module named mercurial.lock
> To git@bitbucket.org:titansgroup/tcf-api.git
>  ! [remote rejected] master -> master (pre-receive hook declined)
> error: failed to push some refs to 'git@bitbucket.org:titansgroup/tcf-api.git'

...and that is exactly what happened. Bitbucket's custom python hook failed, and git did not allow the push to go through.

> (tcf-env)werneck@werneck:~/devel/tcf-api/src/tcf$ git pull
> Warning: Permanently added 'bitbucket.org,207.223.240.181' (RSA) to
> the list of known hosts.
> Already up-to-date.

I don't know that this shows anything conclusive; depending on your configuration, you may or may not be pulling from the same ref you were trying to push to a moment ago.

Show 11 quoted lines
> (tcf-env)werneck@werneck:~/devel/tcf-api/src/tcf$ git push
> Warning: Permanently added 'bitbucket.org,207.223.240.181' (RSA) to
> the list of known hosts.
> Counting objects: 15, done.
> Delta compression using up to 4 threads.
> Compressing objects: 100% (8/8), done.
> Writing objects: 100% (8/8), 860 bytes, done.
> Total 8 (delta 7), reused 0 (delta 0)
> remote: bb/acl: pjwerneck is allowed. accepted payload.
> To git@bitbucket.org:titansgroup/tcf-api.git
>    16b3b54..a50f671  master -> master

And here you repeat the push, and you see that we had to send the data again (because the push did not go through last time). No clue why their hook failed the first time but not the second.

So as far as I can tell, git is operating as advertised. You might want to file a report with bitbucket about their hook failing.

-Peff

← back to recent threads