zsquareplusc / mpy-repl-tool

Yet an other tool to transfer files, execute files and so on via the Python prompt, used for MicroPython
Other
19 stars 5 forks source link

feat(push): During push increase level of messages, except "already up to date" #13

Closed oliver-joos closed 5 years ago

oliver-joos commented 5 years ago

Currently it is not easy to see what files are updated during push, but to suppress messages for files that are "already up to date". With this patch messages about updated files during push will be shown even without option --verbose, but message "already up to date" will be hidden. During pull there are messages too even without option --verbose. This patch makes push behave more like pull.

oliver-joos commented 5 years ago

@zsquareplusc : would you accept this patch together with a new option "--quiet"? Or shall we shift all log messages one level, so that without -v only errors/warnings are shown, with -v notice is also shown, with -vv also info and with -vvv also debug?

oliver-joos commented 5 years ago

The solution in commit aa5d1d5 is better than my pull request, especially the new summery on the last line! So I close mine.

Minor improvement of the new last line: the summery of push/pull shows counters for "copied" and "skipped". IMO the latter should be renamed as "already up-to-date", because "skipped" sounds like "ignored".

oliver-joos commented 5 years ago

@zsquareplusc : Thank you for release 0.10! :1st_place_medal: I just upgraded and my feature request is completely solved.

I found a minor inconvenience with release 0.10: If the serial port is already open then the error message / traceback is not novice-compatible - see below.

We can discuss this at the next MPY-REPL Conference tomorrow ...

python3 -m there push --reset -v -r 'src/*' '/flash/'
Exception in thread Thread-1:
Traceback (most recent call last):
  File "/usr/lib/python3.6/threading.py", line 916, in _bootstrap_inner
    self.run()
  File "/usr/local/lib/python3.6/dist-packages/serial/threaded/__init__.py", line 211, in run
    self.protocol.connection_lost(error)
  File "/usr/local/lib/python3.6/dist-packages/there/repl_connection.py", line 65, in connection_lost
    traceback.print_exc(exc)
  File "/usr/lib/python3.6/traceback.py", line 163, in print_exc
    print_exception(*sys.exc_info(), limit=limit, file=file, chain=chain)
  File "/usr/lib/python3.6/traceback.py", line 104, in print_exception
    type(value), value, tb, limit=limit).format(chain=chain):
  File "/usr/lib/python3.6/traceback.py", line 509, in __init__
    capture_locals=capture_locals)
  File "/usr/lib/python3.6/traceback.py", line 338, in extract
    if limit >= 0:
TypeError: '>=' not supported between instances of 'SerialException' and 'int'

ERROR: action or command failed: timeout