mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-07 18:24:30 -04:00
DRYer
This commit is contained in:
parent
27f483dce4
commit
59dc40a22b
@ -81,15 +81,12 @@ def require_git_master(branch='master'):
|
|||||||
def require_clean_git():
|
def require_clean_git():
|
||||||
c = subprocess.check_call
|
c = subprocess.check_call
|
||||||
p = subprocess.Popen
|
p = subprocess.Popen
|
||||||
with open(os.devnull, 'wb') as null:
|
c('git rev-parse --verify HEAD'.split(), stdout=subprocess.DEVNULL)
|
||||||
c('git rev-parse --verify HEAD'.split(), stdout=null)
|
c('git update-index -q --ignore-submodules --refresh'.split())
|
||||||
c('git update-index -q --ignore-submodules --refresh'.split())
|
if p('git diff-files --quiet --ignore-submodules'.split()).wait() != 0:
|
||||||
if p('git diff-files --quiet --ignore-submodules'.split()).wait() != 0:
|
raise SystemExit('You have unstaged changes in your working tree')
|
||||||
print('You have unstaged changes in your working tree', file=sys.stderr)
|
if p('git diff-index --cached --quiet --ignore-submodules HEAD --'.split()).wait() != 0:
|
||||||
raise SystemExit(1)
|
raise SystemExit('Your git index contains uncommitted changes')
|
||||||
if p('git diff-index --cached --quiet --ignore-submodules HEAD --'.split()).wait() != 0:
|
|
||||||
print('Your git index contains uncommitted changes', file=sys.stderr)
|
|
||||||
raise SystemExit(1)
|
|
||||||
|
|
||||||
|
|
||||||
def initialize_constants():
|
def initialize_constants():
|
||||||
|
Loading…
x
Reference in New Issue
Block a user