Compare commits
4 commits
6e6803fcff
...
740a2705ee
Author | SHA1 | Date | |
---|---|---|---|
740a2705ee | |||
c2f46ce802 | |||
fde269c0dd | |||
9f8c1c9387 |
2 changed files with 18 additions and 8 deletions
|
@ -5,11 +5,6 @@ Spot the difference on the web.
|
|||
Tired of clicking F5 waiting for a change on a web page? Define a list of pages to watch, and receive an email when something has changed.
|
||||
|
||||
|
||||
# Demo
|
||||
|
||||
See [https://ismito.it:3210/](https://ismito.it:3210/) (you can only add \*.wikipedia.org pages, there)
|
||||
|
||||
|
||||
## Install, run, develop and debug
|
||||
|
||||
## Docker
|
||||
|
|
17
diffido.py
17
diffido.py
|
@ -196,7 +196,17 @@ def run_job(id_=None, force=False, *args, **kwargs):
|
|||
req_path = urllib.parse.urlparse(req.url).path
|
||||
base_name = os.path.basename(req_path) or 'index.html'
|
||||
def _commit(id_, filename, content, queue):
|
||||
try:
|
||||
os.chdir('storage/%s' % id_)
|
||||
except Exception as e:
|
||||
logger.info('unable to move to storage/%s directory: %s; trying to create it...' % (id_, e))
|
||||
_created = False
|
||||
try:
|
||||
_created = git_create_repo(id_)
|
||||
except Exception as e:
|
||||
logger.info('unable to move to storage/%s directory: %s; unable to create it' % (id_, e))
|
||||
if not _created:
|
||||
return False
|
||||
current_lines = 0
|
||||
if os.path.isfile(filename):
|
||||
with open(filename, 'r') as fd:
|
||||
|
@ -328,7 +338,8 @@ def get_history(id_, limit=None, add_info=False):
|
|||
def _history(id_, limit, queue):
|
||||
try:
|
||||
os.chdir('storage/%s' % id_)
|
||||
except:
|
||||
except Exception as e:
|
||||
logger.info('unable to move to storage/%s directory: %s' % (id_, e))
|
||||
return queue.put(b'')
|
||||
cmd = [GIT_CMD, 'log', '--pretty=oneline', '--shortstat']
|
||||
if limit is not None:
|
||||
|
@ -383,7 +394,11 @@ def get_diff(id_, commit_id='HEAD', old_commit_id=None):
|
|||
:returns: information about the schedule and the diff between commits
|
||||
:rtype: dict"""
|
||||
def _history(id_, commit_id, old_commit_id, queue):
|
||||
try:
|
||||
os.chdir('storage/%s' % id_)
|
||||
except Exception as e:
|
||||
logger.info('unable to move to storage/%s directory: %s' % (id_, e))
|
||||
return queue.put(b'')
|
||||
p = subprocess.Popen([GIT_CMD, 'diff', old_commit_id or '%s~' % commit_id, commit_id],
|
||||
stdout=subprocess.PIPE)
|
||||
stdout, _ = p.communicate()
|
||||
|
|
Loading…
Reference in a new issue