Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/python
- import sys
- from subprocess import call
- from django.core.validators import URLValidator
- from django.core.exceptions import ValidationError
- class MAINW:
- argm = ""
- def __init__(self):
- self.core_f()
- def core_f(self):
- try:
- subj = str(input('HASH or URL or CMD: '))
- except KeyboardInterrupt:
- print('\n', 'Exiting...')
- exit()
- else:
- self.wrapper(subj)
- def wrapper(self, subj):
- cycl = True
- while cycl == True:
- try:
- if len(subj) == '40' or len(subj) == '82':
- call(['git cherry-pick', '-S', subj])
- elif subj == "reset":
- call(['git reset --hard HEAD'])
- else:
- raise BaseException
- except BaseException:
- print("It isn't an commit hash")
- cycl = False
- else:
- try:
- URLValidator(verify_exists=False)('subj')
- except ValidationError:
- print("It isn't an URL")
- cycl = False
- finally:
- self.core_f()
- classcall = MAINW()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement