Skip to content

Commit

Permalink
Merge pull request #544 from Charcoal-SE/windows_git_warnings
Browse files Browse the repository at this point in the history
"Git not supported on Windows" Warnings (Fix #540)
  • Loading branch information
teward committed Feb 26, 2017
2 parents 982462d + 8105131 commit b24f40f
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 7 deletions.
12 changes: 11 additions & 1 deletion gitmanager.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
from sh import git
import platform
if 'windows' in str(platform.platform()).lower():
print "Git support not available in Windows."
else:
from sh import git
from requests.auth import HTTPBasicAuth
from globalvars import GlobalVars
import requests
Expand All @@ -10,6 +14,10 @@
class GitManager:
@staticmethod
def add_to_blacklist(**kwargs):
if 'windows' in str(platform.platform()).lower():
print "Git support not available in Windows."
return (False, "Git support not available in Windows.")

blacklist = kwargs.get("blacklist", "")
item_to_blacklist = kwargs.get("item_to_blacklist", "")
username = kwargs.get("username", "")
Expand Down Expand Up @@ -136,4 +144,6 @@ def add_to_blacklist(**kwargs):

@staticmethod
def current_git_status():
if 'windows' in str(platform.platform()).lower():
return "Git support not available in Windows."
return git.status()
22 changes: 16 additions & 6 deletions nocrash.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@

# This script replaces the original nocrash.sh functionality with a pure Python approach.

from sh import git
import platform
if 'windows' in str(platform.platform()).lower():
print "Git support not available in Windows."
else:
from sh import git
import os
import subprocess as sp
from time import sleep
Expand Down Expand Up @@ -65,9 +69,11 @@

if ecode == 3:
# print "[NoCrash] Pull in new updates."
git.checkout('deploy')
git.pull()
git.submodule('update')
if 'windows' not in str(platform.platform()).lower():
git.checkout('deploy')
git.pull()
git.submodule('update')

count = 0
crashcount = 0

Expand All @@ -78,7 +84,9 @@

if crashcount == 2:
# print "[NoCrash] Going to reverted state."
git.checkout('HEAD~1')
if 'windows' not in str(platform.platform()).lower():
git.checkout('HEAD~1')

count = 0
crashcount = 0

Expand All @@ -99,7 +107,9 @@

elif ecode == 8:
# print "[NoCrash] Checkout Deploy"
git.checkout('deploy')
if 'windows' not in str(platform.platform()).lower():
git.checkout('deploy')

count = 0
crashcount = 0

Expand Down

0 comments on commit b24f40f

Please sign in to comment.