Skip to content
This repository has been archived by the owner on Mar 29, 2021. It is now read-only.

Commit

Permalink
Made the branch command not use -q
Browse files Browse the repository at this point in the history
  • Loading branch information
zerok committed Mar 11, 2010
1 parent f001d46 commit 5c8aa56
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions zerokspot/recipe/git/__init__.py
Expand Up @@ -24,13 +24,17 @@
import shutil


def git(operation, args, message, ignore_errnos=None):
def git(operation, args, message, ignore_errnos=None, verbose=False):
"""
Execute a git operation with the given arguments. If it fails, raise an
exception with the given message. If ignore_errnos is a list of status
codes, they will be not handled as errors if returned by git.
"""
real_args = ['-q'] + list(args)
if verbose:
real_args = list(args)
else:
real_args = ['-q'] + list(args)

command = r'git %s ' + ' '.join(('"%s"', ) * len(real_args))
command = command % ((operation, ) + tuple(real_args))
status = subprocess.call(command, shell=True)
Expand Down Expand Up @@ -179,7 +183,7 @@ def _clone(self, from_, to):
if self.branch != 'master':
if not '[branch "%s"]' % self.branch in open(os.path.join('.git', 'CONFIG')).read():
git('branch', ('--track', self.branch, 'origin/%s' % self.branch),

This comment has been minimized.

Copy link
@crucialfelix

crucialfelix Aug 21, 2010

should be 'config' lower case

This comment has been minimized.

Copy link
@zerok

zerok Aug 21, 2010

Author Owner

Fixing your own fix, I see :-) Checked in.

"Failed to set up to track remote branch")
"Failed to set up to track remote branch", verbose=True)
if not "ref: refs/heads/%s" % self.branch in open(os.path.join('.git', 'HEAD')).read():
git('checkout', (self.branch,), "Failed to switch to branch '%s'" % self.branch,
ignore_errnos=[128])
Expand Down

3 comments on commit 5c8aa56

@crucialfelix
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried today to get a diff for you of some other change related to checking out a branch. I can't get 0.5.2 to do a branch correctly. I have a working hack of this recipe that I use and want to get that working aspect of it to you. but today I had 3 or 4 annoyances in a row and just gave up and slapped my hack into the server's eggs so I could finish the day ;0

I was using python 2.5 on one server and this branch fix is not in the python 2.5 egg

@zerok
Copy link
Owner Author

@zerok zerok commented on 5c8aa56 Aug 21, 2010

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What part of the branch checkout doesn't work for you? I just tried it with a rather simple documentation repository and there the branch looks correct to me.

@crucialfelix
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It appears you haven't actually done a new pypi release with these changes, so using this with buildout still fails.

I am now using zerokspot.recipe.git-0.5.2-py2.6.egg

But, in true git fashion, its failing with a new and yet more incomprehensible error message.

[nsgeo]
recipe = zerokspot.recipe.git
repository = ssh://xxx.yyy.zzz.øøø/home/crucial/gits/gitpo.git
paths =
    djapps
    pluggables
    shared
install-from-cache = false
branch=nsgeo
as_egg=true

Installing nsgeo.
*fatal: git checkout: updating paths is incompatible with switching branches.*
*Did you intend to checkout 'origin/nsgeo' which can not be resolved as commit?*

that has to be one of the most incomprehensible git error messages I've seen.

read:
http://stackoverflow.com/questions/945654/git-checkout-on-a-remote-branch-does-not-work

if you are bored. in which someone suggests using fetch to get ALL branches, everyone is happy that it makes the incomprehensible git error messages go away and declares it to be the correct answer.

but tracking and checking out the branch with the changes I submitted before solves the actual issue and doesn't fetch all branches.

I am currently just dropping a hacked egg into the eggs cache on top of zerokspot.recipe.git-0.5.2-py2.6.egg

It then appears to keep going despite a git failure:

there is no djapps/setup.py in master
there is one in branch nsgeo

Traceback (most recent call last):
  File "/tmp/tmp9QGcap", line 11, in <module>
    execfile('/home/crucial/crucial/parts/nsgeo/djapps/setup.py')
IOError: [Errno 2] No such file or directory: '/home/crucial/crucial/parts/nsgeo/djapps/setup.py'
While:
  Installing nsgeo.

An internal error occurred due to a bug in either zc.buildout or in a
recipe being used:
Traceback (most recent call last):
  File "/home/crucial/crucial/eggs/zc.buildout-1.5.1-py2.6.egg/zc/buildout/buildout.py", line 1784, in main
    getattr(buildout, command)(args)
  File "/home/crucial/crucial/eggs/zc.buildout-1.5.1-py2.6.egg/zc/buildout/buildout.py", line 569, in install
    installed_files = self[part]._call(recipe.install)
  File "/home/crucial/crucial/eggs/zc.buildout-1.5.1-py2.6.egg/zc/buildout/buildout.py", line 1276, in _call
    return f()
  File "/home/crucial/crucial/eggs/zerokspot.recipe.git-0.5.2-py2.6.egg/zerokspot/recipe/git/__init__.py", line 146, in install
    self._install_as_egg()
  File "/home/crucial/crucial/eggs/zerokspot.recipe.git-0.5.2-py2.6.egg/zerokspot/recipe/git/__init__.py", line 242, in _install_as_egg
    _install(path, target)
  File "/home/crucial/crucial/eggs/zerokspot.recipe.git-0.5.2-py2.6.egg/zerokspot/recipe/git/__init__.py", line 236, in _install
    zc.buildout.easy_install.develop(path, target)
  File "/home/crucial/crucial/eggs/zc.buildout-1.5.1-py2.6.egg/zc/buildout/easy_install.py", line 1189, in develop
    *args) == 0
AssertionError

Please sign in to comment.