fixed issue 1295, more git issues, thanks Alan

This commit is contained in:
mdipierro committed 2013-01-20 14:50:20 -06:00
1 parent c214999e27
commit 6684754a47
2 files changed
+19 -34

No files matched your search

+1 -1
View File
@@ -1 +1 @@
Version 2.4.1-alpha.2+timestamp.2013.01.20.14.47.52 Version 2.4.1-alpha.2+timestamp.2013.01.20.14.49.37
+18 -33
View File
@@ -16,16 +16,12 @@ import shutil
import platform import platform
try: try:
import git import git
GIT_ERRORS = (git.GitCommandError, git.InvalidGitRepositoryError, if git.__version__ < '0.3.1':
git.NoSuchPathError) raise ImportError("Your version of git is %s. Upgrade to 0.3.1 or better." % git.__version__)
if git.__version__ >= '0.3.1':
GIT_ERRORS += (git.CacheError, git.CheckoutError,
git.ODBError, git.ParseError,
git.UnmergedEntriesError)
have_git = True have_git = True
except ImportError: except ImportError, e:
have_git = False have_git = False
GIT_MISSING = 'requires gitpython module, but not installed or incompatible version' GIT_MISSING = 'Requires gitpython module, but not installed or incompatible version: %s' % e
from gluon.languages import (read_possible_languages, read_dict, write_dict, from gluon.languages import (read_possible_languages, read_dict, write_dict,
read_plural_dict, write_plural_dict) read_plural_dict, write_plural_dict)
@@ -1738,22 +1734,17 @@ def git_pull():
origin.pull() origin.pull()
session.flash = T("Application updated via git pull") session.flash = T("Application updated via git pull")
redirect(URL('site')) redirect(URL('site'))
except GIT_ERRORS, e:
error_type = type(e) except git.CheckoutError:
if 'CheckoutError' in error_type: session.flash = T("Pull failed, certain files could not be checked out. Check logs for details.")
session.flash = T("Pull failed, certain files could not be checked out. Check logs for details.") redirect(URL('site'))
redirect(URL('site')) except git.UnmergedEntriesError:
elif 'UnmergedEntriesError' in error_type: session.flash = T("Pull is not possible because you have unmerged files. Fix them up in the work tree, and then try again.")
session.flash = T("Pull is not possible because you have unmerged files. Fix them up in the work tree, and then try again.") redirect(URL('site'))
redirect(URL('site')) except git.GitCommandError:
elif 'GitCommandError' in error_type: session.flash = T(
session.flash = T( "Pull failed, git exited abnormally. See logs for details.")
"Pull failed, git exited abnormally. See logs for details.") redirect(URL('site'))
redirect(URL('site'))
else:
session.flash = T(
"Git error: %s %s" % (error_type, str(e)))
redirect(URL('site'))
except AssertionError: except AssertionError:
session.flash = T("Pull is not possible because you have unmerged files. Fix them up in the work tree, and then try again.") session.flash = T("Pull is not possible because you have unmerged files. Fix them up in the work tree, and then try again.")
redirect(URL('site')) redirect(URL('site'))
@@ -1783,14 +1774,8 @@ def git_push():
session.flash = T( session.flash = T(
"Git repo updated with latest application changes.") "Git repo updated with latest application changes.")
redirect(URL('site')) redirect(URL('site'))
except GIT_ERRORS, e: except git.UnmergedEntriesError:
error_type = type(e) session.flash = T("Push failed, there are unmerged entries in the cache. Resolve merge issues manually and try again.")
if "UnmergedEntriesError" in error_type: redirect(URL('site'))
session.flash = T("Push failed, there are unmerged entries in the cache. Resolve merge issues manually and try again.")
redirect(URL('site'))
else:
session.flash = T(
"Git error: %s %s" % (error_type, str(e)))
redirect(URL('site'))
return dict(app=app, form=form) return dict(app=app, form=form)