From 4b14b2350f27b540039bb1d20ce2516095734802 Mon Sep 17 00:00:00 2001 From: facelessuser Date: Fri, 30 Nov 2018 18:40:46 -0700 Subject: [PATCH 1/4] Quicker VC check Use a "which" command to check binary location instead of calling the VC command for reduced lag on context menu. --- easy_diff_version_control.py | 27 ++++++++++--------- lib/git.py | 42 ++++++++++++++++++++---------- lib/hg.py | 42 ++++++++++++++++++++---------- lib/svn.py | 50 ++++++++++++++++++++++++------------ 4 files changed, 106 insertions(+), 55 deletions(-) diff --git a/easy_diff_version_control.py b/easy_diff_version_control.py index 4f1fc70..87d1d59 100644 --- a/easy_diff_version_control.py +++ b/easy_diff_version_control.py @@ -246,12 +246,13 @@ def check_vc(self): """Check if version control is available.""" global SVN_ENABLED - try: - log("svn %s" % svn.version()) + location = svn.which() + log("svn %s" % location) + if location is not None: SVN_ENABLED = True - except Exception: + else: SVN_ENABLED = False - log("svn not found or is not working!") + log("svn not found!") def revert_file(self, name): """Revert file.""" @@ -318,12 +319,13 @@ def check_vc(self): """Check if version control is available.""" global GIT_ENABLED - try: - log("git %s" % git.version()) + location = git.which() + log("git %s" % location) + if location is not None: GIT_ENABLED = True - except Exception: + else: GIT_ENABLED = False - log("git not found or is not working!") + log("git not found!") def revert_file(self, name): """Revert the file.""" @@ -403,12 +405,13 @@ def check_vc(self): """Check if version control is available.""" global HG_ENABLED - try: - log("hg %s" % hg.version()) + location = hg.which() + log("hg %s" % location) + if location is not None: HG_ENABLED = True - except Exception: + else: HG_ENABLED = False - log("hg not found or is not working!") + log("hg not found!") def revert_file(self, name): """Revert file.""" diff --git a/lib/git.py b/lib/git.py index e92dac6..8c32e34 100644 --- a/lib/git.py +++ b/lib/git.py @@ -5,11 +5,10 @@ License: MIT """ # import xml.etree.ElementTree as ET -from os import environ +import os import re import subprocess import sys -from os.path import exists, isfile, dirname, join if sys.platform.startswith('win'): _PLATFORM = "windows" @@ -25,6 +24,23 @@ # ALL_DIFF = 2 +def which(): + """See if executable exists.""" + + location = None + if os.path.basename(_git_path) != _git_path: + if os.path.isfile(_git_path): + location = _git_path + else: + paths = [x for x in os.environ["PATH"].split(os.pathsep) if not x.isspace()] + for path in paths: + exe = os.path.join(path, _git_path) + if os.path.isfile(exe): + location = exe + break + return location + + def is_system_root(target): """Check if target is the root folder.""" @@ -42,21 +58,21 @@ def get_git_tree(target): """Recursively get Git tree.""" root = is_system_root(target) - is_file = isfile(target) - folder = dirname(target) if is_file else target - if exists(join(folder, ".git")): + is_file = os.path.isfile(target) + folder = os.path.dirname(target) if is_file else target + if os.path.exists(os.path.join(folder, ".git")): return folder else: if root: return None else: - return get_git_tree(dirname(folder)) + return get_git_tree(os.path.dirname(folder)) def get_git_dir(tree): """Get Git directory from tree.""" - return join(tree, ".git") + return os.path.join(tree, ".git") def gitopen(args, git_tree=None): @@ -70,7 +86,7 @@ def gitopen(args, git_tree=None): else: cmd = [_git_path] + args - env = environ.copy() + env = os.environ.copy() env['LC_ALL'] = 'en_US' if _PLATFORM == "windows": @@ -105,7 +121,7 @@ def gitopen(args, git_tree=None): def show(target, rev): """Show file at revision.""" - assert exists(target), "%s does not exist!" % target + assert os.path.exists(target), "%s does not exist!" % target git_tree = get_git_tree(target) bfr = None target = target.replace(git_tree, "", 1).lstrip("\\" if _PLATFORM == "windows" else "/") @@ -120,7 +136,7 @@ def show(target, rev): def getrevision(target, count=1): """Get revision(s).""" - assert exists(target), "%s does not exist!" % target + assert os.path.exists(target), "%s does not exist!" % target git_tree = get_git_tree(target) revs = None @@ -135,7 +151,7 @@ def getrevision(target, count=1): def checkout(target, rev=None): """Checkout file.""" - assert exists(target), "%s does not exist!" % target + assert os.path.exists(target), "%s does not exist!" % target git_tree = get_git_tree(target) if git_tree is not None: @@ -150,7 +166,7 @@ def checkout(target, rev=None): def diff(target, last=False): """Diff current file against last revision.""" - assert exists(target), "%s does not exist!" % target + assert os.path.exists(target), "%s does not exist!" % target # assert diff_type in [ALL_DIFF, STAGED_DIFF, UNSTAGED_DIFF], "diff_type is bad!" git_tree = get_git_tree(target) results = b"" @@ -180,7 +196,7 @@ def diff(target, last=False): def is_versioned(target): """Check if file/folder is versioned.""" - assert exists(target), "%s does not exist!" % target + assert os.path.exists(target), "%s does not exist!" % target git_tree = get_git_tree(target) versioned = False diff --git a/lib/hg.py b/lib/hg.py index 9dcb6ac..7170f41 100644 --- a/lib/hg.py +++ b/lib/hg.py @@ -5,11 +5,10 @@ License: MIT """ import xml.etree.ElementTree as ET -from os import environ +import os import re import subprocess import sys -from os.path import exists, dirname if sys.platform.startswith('win'): _PLATFORM = "windows" @@ -21,6 +20,23 @@ _hg_path = "hg.exe" if _PLATFORM == "windows" else "hg" +def which(): + """See if executable exists.""" + + location = None + if os.path.basename(_hg_path) != _hg_path: + if os.path.isfile(_hg_path): + location = _hg_path + else: + paths = [x for x in os.environ["PATH"].split(os.pathsep) if not x.isspace()] + for path in paths: + exe = os.path.join(path, _hg_path) + if os.path.isfile(exe): + location = exe + break + return location + + def hgopen(args, cwd=None): """Call Git with arguments.""" @@ -29,7 +45,7 @@ def hgopen(args, cwd=None): cmd = [_hg_path] + args - env = environ.copy() + env = os.environ.copy() env['LC_ALL'] = 'en_US' if _PLATFORM == "windows": @@ -66,24 +82,24 @@ def hgopen(args, cwd=None): def cat(target, rev=None): """Show file at revision.""" - assert exists(target), "%s does not exist!" % target + assert os.path.exists(target), "%s does not exist!" % target args = ["cat", target] if rev is not None: args += ["-r", str(rev)] - return hgopen(args, dirname(target)) + return hgopen(args, os.path.dirname(target)) def revert(target): """Revert file.""" - assert exists(target), "%s does not exist!" % target - hgopen(["revert", "--no-backup", target], dirname(target)) + assert os.path.exists(target), "%s does not exist!" % target + hgopen(["revert", "--no-backup", target], os.path.dirname(target)) def getrevision(target, count=1): """Get revision(s).""" - assert exists(target), "%s does not exist!" % target + assert os.path.exists(target), "%s does not exist!" % target results = log(target, count) assert results is not None, "Failed to acquire log info!" revs = [] @@ -97,7 +113,7 @@ def diff(target, last=False): args = None - assert exists(target), "%s does not exist!" % target + assert os.path.exists(target), "%s does not exist!" % target if last: revs = getrevision(target, 2) if len(revs) == 2: @@ -105,13 +121,13 @@ def diff(target, last=False): else: args = ["diff", "-p"] - return hgopen(args + [target], dirname(target)) if args is not None else b"" + return hgopen(args + [target], os.path.dirname(target)) if args is not None else b"" def log(target=None, limit=0): """Get hg log.""" - assert exists(target), "%s does not exist!" % target + assert os.path.exists(target), "%s does not exist!" % target args = ["log", "--style=xml"] if limit != 0: @@ -119,7 +135,7 @@ def log(target=None, limit=0): args.append(str(limit)) if target is not None: args.append(target) - output = hgopen(args, dirname(target)) + output = hgopen(args, os.path.dirname(target)) if output != "": results = ET.fromstring(output) @@ -132,7 +148,7 @@ def log(target=None, limit=0): def is_versioned(target): """Check if file/folder is versioned.""" - assert exists(target), "%s does not exist!" % target + assert os.path.exists(target), "%s does not exist!" % target versioned = False try: results = log(target, 1) diff --git a/lib/svn.py b/lib/svn.py index cfe31ad..17e88c4 100644 --- a/lib/svn.py +++ b/lib/svn.py @@ -5,11 +5,10 @@ License: MIT """ import xml.etree.ElementTree as ET -from os import environ +import os import re import subprocess import sys -from os.path import exists, isfile NO_LOCK = 0 LOCAL_LOCK = 1 @@ -26,6 +25,23 @@ _svn_path = "svn.exe" if _PLATFORM == "windows" else "svn" +def which(): + """See if executable exists.""" + + location = None + if os.path.basename(_svn_path) != _svn_path: + if os.path.isfile(_svn_path): + location = _svn_path + else: + paths = [x for x in os.environ["PATH"].split(os.pathsep) if not x.isspace()] + for path in paths: + exe = os.path.join(path, _svn_path) + if os.path.isfile(exe): + location = exe + break + return location + + def svnopen(args): """Call SVN with arguments.""" @@ -33,7 +49,7 @@ def svnopen(args): output = None cmd = [_svn_path, "--non-interactive"] + args - env = environ.copy() + env = os.environ.copy() env['LC_ALL'] = 'en_US' if _PLATFORM == "windows": @@ -68,7 +84,7 @@ def svnopen(args): def revert(target): """Revert file.""" - assert exists(target), "%s does not exist!" % target + assert os.path.exists(target), "%s does not exist!" % target svnopen(["revert", target]) @@ -77,7 +93,7 @@ def info(target): assert ( (target.startswith("http://") or target.startswith("https://")) or - exists(target) + os.path.exists(target) ), "%s does not exist!" % target output = svnopen(['info', "--xml", target]) return ET.fromstring(output) @@ -138,15 +154,15 @@ def getrevision(pth): def diff(target, last=False): """Get SVN diff of last version.""" - assert exists(target), "%s does not exist!" % target - assert isfile(target), "%s is not a file!" % target + assert os.path.exists(target), "%s does not exist!" % target + assert os.path.isfile(target), "%s is not a file!" % target return svnopen(['diff', '-rPREV', target]) if last else svnopen(['diff', target]) def commit(pth, msg=""): """Commit changes.""" - assert exists(pth), "%s does not exist!" % pth + assert os.path.exists(pth), "%s does not exist!" % pth svnopen(["commit", pth, "-m", msg]) @@ -188,14 +204,14 @@ def checklock(pth): def lock(pth): """Lock file.""" - assert exists(pth), "%s does not exist!" % pth + assert os.path.exists(pth), "%s does not exist!" % pth svnopen(['lock', pth]) def breaklock(pth, force=False): """Breack file lock.""" - assert exists(pth), "%s does not exist!" % pth + assert os.path.exists(pth), "%s does not exist!" % pth args = ['unlock'] if force: @@ -210,13 +226,13 @@ def checkout(url, pth): """Checkout SVN url.""" svnopen(['checkout', url, pth]) - assert exists(pth) + assert os.path.exists(pth) def update(pth): """Update SVN directory.""" - assert exists(pth), "%s does not exist!" % pth + assert os.path.exists(pth), "%s does not exist!" % pth svnopen(['update', pth]) @@ -229,27 +245,27 @@ def export(url, name, rev=None): args += [url, name] svnopen(args) - assert exists(name), "%s appears to not have been exported!" % name + assert os.path.exists(name), "%s appears to not have been exported!" % name def add(pth): """Add a file.""" - assert exists(pth), "%s does not exist!" % pth + assert os.path.exists(pth), "%s does not exist!" % pth svnopen(['add', pth]) def cleanup(pth): """Clean up a folder.""" - assert exists(pth), "%s does not exist!" % pth + assert os.path.exists(pth), "%s does not exist!" % pth svnopen(['cleanup', pth]) def status(pth, ignore_externals=False, ignore_unversioned=False, depth="infinity"): """Get the SVN status for the folder.""" - assert exists(pth), "%s does not exist!" % pth + assert os.path.exists(pth), "%s does not exist!" % pth attributes = { "added": [], @@ -301,7 +317,7 @@ def status(pth, ignore_externals=False, ignore_unversioned=False, depth="infinit def is_versioned(target): """Check if file/folder is versioned.""" - assert exists(target), "%s does not exist!" % target + assert os.path.exists(target), "%s does not exist!" % target versioned = False try: From 13872ea7af7f32211b9602b82731b6e0f300923f Mon Sep 17 00:00:00 2001 From: facelessuser Date: Fri, 30 Nov 2018 18:48:01 -0700 Subject: [PATCH 2/4] Update tests to use Python 3.6 and update lint exclusions --- .travis.yml | 2 +- setup.cfg | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 985923f..481f52e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,7 +4,7 @@ language: python matrix: include: - - python: 3.3 + - python: 3.6 env: TESTENV=unittest - python: 3.6 env: TESTENV=documents diff --git a/setup.cfg b/setup.cfg index 6a6bf62..89be1e8 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,3 +1,3 @@ [flake8] -ignore=D202,D203,D401 +ignore=D202,D203,D401,W504 max-line-length=120 From bd6896e05f030cc288b2ae373f7084cce59546ec Mon Sep 17 00:00:00 2001 From: facelessuser Date: Fri, 30 Nov 2018 19:29:38 -0700 Subject: [PATCH 3/4] Documentation and spelling updates --- .pyspelling.yml | 120 ++++++++++ .travis.yml | 3 +- LICENSE | 2 +- README.md | 2 +- .../src/dictionary/en-custom.txt | 1 + .../markdown/_snippets/{abbr.md => abbr.txt} | 0 .../_snippets/{links.md => links.txt} | 0 docs/src/markdown/_snippets/refs.md | 4 - docs/src/markdown/_snippets/refs.txt | 4 + docs/src/markdown/contributing.md | 2 +- docs/src/markdown/index.md | 2 +- docs/src/markdown/installation.md | 2 +- docs/src/markdown/license.md | 2 +- docs/theme/extra-0b9b22dd13.js | 1 + docs/theme/extra-83f68d2c59.css | 1 + docs/theme/extra-d8800ea088.js | 1 - docs/theme/extra-f8303dea60.css | 1 - mkdocs.yml | 32 ++- tests/spellcheck.py | 210 ------------------ 19 files changed, 161 insertions(+), 229 deletions(-) create mode 100644 .pyspelling.yml rename .dictionary => docs/src/dictionary/en-custom.txt (97%) rename docs/src/markdown/_snippets/{abbr.md => abbr.txt} (100%) rename docs/src/markdown/_snippets/{links.md => links.txt} (100%) delete mode 100644 docs/src/markdown/_snippets/refs.md create mode 100644 docs/src/markdown/_snippets/refs.txt create mode 100644 docs/theme/extra-0b9b22dd13.js create mode 100644 docs/theme/extra-83f68d2c59.css delete mode 100644 docs/theme/extra-d8800ea088.js delete mode 100644 docs/theme/extra-f8303dea60.css delete mode 100644 tests/spellcheck.py diff --git a/.pyspelling.yml b/.pyspelling.yml new file mode 100644 index 0000000..4df524f --- /dev/null +++ b/.pyspelling.yml @@ -0,0 +1,120 @@ +matrix: +- name: settings + sources: + - '**/*.sublime-settings' + hunspell: + d: en_US + aspell: + lang: en + dictionary: + wordlists: + - docs/src/dictionary/en-custom.txt + output: build/dictionary/settings.dic + pipeline: + - pyspelling.filters.cpp: + prefix: 'st' + generic_mode: true + group_comments: true + line_comments: false + - pyspelling.filters.context: + context_visible_first: true + escapes: '\\[\\`]' + delimiters: + # Ignore multiline content between fences (fences can have 3 or more back ticks) + # ``` + # content + # ``` + - open: '(?s)^(?P *`{3,})$' + close: '^(?P=open)$' + # Ignore text between inline back ticks + - open: '(?P`+)' + close: '(?P=open)' + - pyspelling.filters.url: + +- name: mkdocs + sources: + - site/**/*.html + hunspell: + d: en_US + aspell: + lang: en + dictionary: + wordlists: + - docs/src/dictionary/en-custom.txt + output: build/dictionary/mkdocs.dic + pipeline: + - pyspelling.filters.html: + comments: false + attributes: + - title + - alt + ignores: + - ':matches(code, pre)' + - 'a:matches(.magiclink-compare, .magiclink-commit, .magiclink-repository)' + - 'span.keys' + - ':matches(.MathJax_Preview, .md-nav__link, .md-footer-custom-text, .md-source__repository, .headerlink, .md-icon)' + - pyspelling.filters.url: + +- name: markdown + sources: + - readme.md + hunspell: + d: en_US + aspell: + lang: en + dictionary: + wordlists: + - docs/src/dictionary/en-custom.txt + output: build/dictionary/markdown.dic + pipeline: + - pyspelling.filters.markdown: + - pyspelling.filters.html: + comments: false + attributes: + - title + - alt + ignores: + - ':matches(code, pre)' + - pyspelling.filters.url: + +- name: python + hidden: true + sources: + - './**/*.py' + hunspell: + d: en_US + aspell: + lang: en + dictionary: + wordlists: + - docs/src/dictionary/en-custom.txt + output: build/dictionary/python.dic + pipeline: + - pyspelling.filters.python: + group_comments: true + - pyspelling.flow_control.wildcard: + allow: + - py-comment + - pyspelling.filters.context: + context_visible_first: true + delimiters: + # Ignore lint (noqa) and coverage (pragma) as well as shebang (#!) + - open: '^(?: *(?:noqa\b|pragma: no cover)|!)' + close: '$' + # Ignore Python encoding string -*- encoding stuff -*- + - open: '^ *-\*-' + close: '-\*-$' + - pyspelling.filters.context: + context_visible_first: true + escapes: '\\[\\`]' + delimiters: + # Ignore multiline content between fences (fences can have 3 or more back ticks) + # ``` + # content + # ``` + - open: '(?s)^(?P *`{3,})$' + close: '^(?P=open)$' + # Ignore text between inline back ticks + - open: '(?P`+)' + close: '(?P=open)' + - pyspelling.filters.url: diff --git a/.travis.yml b/.travis.yml index 481f52e..6aaf03d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -19,6 +19,7 @@ install: - pip install mkdocs-material - pip install pymdown-extensions - pip install pygments + - pip install pyspelling addons: apt: @@ -29,8 +30,8 @@ addons: script: - if [ $TESTENV = unittest ]; then py.test .; fi - if [ $TESTENV = unittest ]; then flake8 .; fi - - if [ $TESTENV = documents ]; then python tests/spellcheck.py; fi - if [ $TESTENV = documents ]; then mkdocs build --clean --verbose --strict; fi + - if [ $TESTENV = documents ]; then pyspelling; fi deploy: - provider: pages diff --git a/LICENSE b/LICENSE index 32083fd..d7ba4f9 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2013 - 2017 Isaac Muse +Copyright (c) 2013 - 2018 Isaac Muse Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in diff --git a/README.md b/README.md index 069df1f..f9ec348 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,7 @@ http://facelessuser.github.io/EasyDiff/ # License EasyDiff is released under the MIT license. -Copyright (c) 2013 - 2015 Isaac Muse +Copyright (c) 2013 - 2018 Isaac Muse Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: diff --git a/.dictionary b/docs/src/dictionary/en-custom.txt similarity index 97% rename from .dictionary rename to docs/src/dictionary/en-custom.txt index abcb221..faf1f37 100644 --- a/.dictionary +++ b/docs/src/dictionary/en-custom.txt @@ -4,6 +4,7 @@ Ctrl DeltaWalker EasyDiff EasyDiff's +EmojiOne Feb MERCHANTABILITY MkDocs diff --git a/docs/src/markdown/_snippets/abbr.md b/docs/src/markdown/_snippets/abbr.txt similarity index 100% rename from docs/src/markdown/_snippets/abbr.md rename to docs/src/markdown/_snippets/abbr.txt diff --git a/docs/src/markdown/_snippets/links.md b/docs/src/markdown/_snippets/links.txt similarity index 100% rename from docs/src/markdown/_snippets/links.md rename to docs/src/markdown/_snippets/links.txt diff --git a/docs/src/markdown/_snippets/refs.md b/docs/src/markdown/_snippets/refs.md deleted file mode 100644 index a3583e7..0000000 --- a/docs/src/markdown/_snippets/refs.md +++ /dev/null @@ -1,4 +0,0 @@ ---8<-- -links.md -abbr.md ---8<-- diff --git a/docs/src/markdown/_snippets/refs.txt b/docs/src/markdown/_snippets/refs.txt new file mode 100644 index 0000000..1715a5c --- /dev/null +++ b/docs/src/markdown/_snippets/refs.txt @@ -0,0 +1,4 @@ +--8<-- +links.txt +abbr.txt +--8<-- diff --git a/docs/src/markdown/contributing.md b/docs/src/markdown/contributing.md index 29e6cad..81995db 100644 --- a/docs/src/markdown/contributing.md +++ b/docs/src/markdown/contributing.md @@ -102,4 +102,4 @@ A ton of time has been spent not only creating and supporting this plugin, but a You don't have to render the docs locally before pull requesting, but if you wish to, I currently use a combination of @mkdocs/mkdocs, the @squidfunk/mkdocs-material, and @facelessuser/pymdown-extensions to render the docs. You can preview the docs if you install these two packages. The command for previewing the docs is `mkdocs serve` from the root directory. You can then view the documents at `localhost:8000`. ---8<-- "refs.md" +--8<-- "refs.txt" diff --git a/docs/src/markdown/index.md b/docs/src/markdown/index.md index bd5aaa1..58ddaa3 100644 --- a/docs/src/markdown/index.md +++ b/docs/src/markdown/index.md @@ -192,4 +192,4 @@ Occasionally, EasyDiff will about a message in the status bar. You can redirect "use_sub_notify": true ``` ---8<-- "refs.md" +--8<-- "refs.txt" diff --git a/docs/src/markdown/installation.md b/docs/src/markdown/installation.md index 50e0661..e800fda 100644 --- a/docs/src/markdown/installation.md +++ b/docs/src/markdown/installation.md @@ -215,4 +215,4 @@ For those who want to install EasyDiff without package control, here are the ste 3. Restart Sublime Text. ---8<-- "refs.md" +--8<-- "refs.txt" diff --git a/docs/src/markdown/license.md b/docs/src/markdown/license.md index db040f3..b420c93 100644 --- a/docs/src/markdown/license.md +++ b/docs/src/markdown/license.md @@ -2,7 +2,7 @@ EasyDiff is released under the MIT license. -Copyright (c) 2013 - 2017 Isaac Muse +Copyright (c) 2013 - 2018 Isaac Muse Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: diff --git a/docs/theme/extra-0b9b22dd13.js b/docs/theme/extra-0b9b22dd13.js new file mode 100644 index 0000000..bb26ef4 --- /dev/null +++ b/docs/theme/extra-0b9b22dd13.js @@ -0,0 +1 @@ +!function(){"use strict";var e=function(e,t,n){for(var o=function(e){for(var t="",n=0;n.admonition-title,.md-typeset details.settings>.admonition-title,.md-typeset details.settings>summary{border-bottom:.1rem solid rgba(170,0,255,.1);background-color:rgba(170,0,255,.1)}.md-typeset .admonition.settings>.admonition-title:before,.md-typeset details.settings>.admonition-title:before,.md-typeset details.settings>summary:before{color:#a0f;content:"settings"}.md-typeset .admonition.new,.md-typeset details.new{border-left:.4rem solid #ffd600}.md-typeset .admonition.new>.admonition-title,.md-typeset details.new>.admonition-title,.md-typeset details.new>summary{border-bottom:.1rem solid rgba(255,214,0,.1);background-color:rgba(255,214,0,.1)}.md-typeset .admonition.new>.admonition-title:before,.md-typeset details.new>.admonition-title:before,.md-typeset details.new>summary:before{color:#ffd600;content:"new_releases"}.md-typeset .uml-flowchart,.md-typeset .uml-sequence-diagram{width:100%;padding:1rem 0;overflow:auto}.md-typeset .uml-flowchart svg,.md-typeset .uml-sequence-diagram svg{max-width:none}.md-typeset a>code{margin:0 .29412em;padding:.07353em 0;border-radius:.2rem;background-color:hsla(0,0%,93%,.5);box-shadow:.29412em 0 0 hsla(0,0%,93%,.5),-.29412em 0 0 hsla(0,0%,93%,.5);-webkit-box-decoration-break:clone;box-decoration-break:clone}.md-typeset .codehilitetable .linenos,.md-typeset .highlighttable .linenos{border-right:.0625rem solid #ddd;border-radius:0;background-color:hsla(0,0%,93%,.5)}.md-typeset .codehilitetable .linenodiv .special,.md-typeset .highlighttable .linenodiv .special{margin-right:-1.2rem;margin-left:-1.2rem;padding-right:1.2rem;padding-left:1.2rem;background-color:hsla(0,0%,60%,.2)}.md-typeset td code{word-break:normal}.md-typeset .codehilite,.md-typeset .highlight{-moz-tab-size:8;-o-tab-size:8;tab-size:8}.md-typeset .codehilite .hll,.md-typeset .highlight .hll{display:inline}.md-typeset .codehilite [data-linenos]:before,.md-typeset .highlight [data-linenos]:before{display:inline-block;margin-right:.5rem;margin-left:-1.2rem;padding-left:1.2rem;border-right:.0625rem solid #ddd;background-color:#f7f7f7;color:#999;content:attr(data-linenos);-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.md-typeset .codehilite [data-linenos].special:before,.md-typeset .highlight [data-linenos].special:before{background-color:#e6e6e6}.md-typeset .codehilite [data-linenos]+.hll,.md-typeset .highlight [data-linenos]+.hll{margin:0 -.5rem;padding:0 .5rem}.md-typeset .headerlink{font:normal 400 2rem Material Icons;vertical-align:middle}.md-typeset h1 .headerlink{margin-top:-.6rem}.md-typeset h2 .headerlink{margin-top:-.4rem}.md-typeset h3 .headerlink{margin-top:-.3rem}.md-typeset h4 .headerlink,.md-typeset h5 .headerlink,.md-typeset h6 .headerlink{margin-top:-.2rem}.md-typeset .progress-label{position:absolute;width:100%;margin:0;color:rgba(0,0,0,.5);font-weight:700;line-height:1.4rem;text-align:center;white-space:nowrap}.md-typeset .progress-bar{height:1.2rem;float:left;background-color:#2979ff}.md-typeset .candystripe-animate .progress-bar{-webkit-animation:a 3s linear infinite;animation:a 3s linear infinite}.md-typeset .progress{display:block;position:relative;width:100%;height:1.2rem;margin:.5rem 0;background-color:#eee}.md-typeset .progress.thin{height:.4rem;margin-top:.9rem}.md-typeset .progress.thin .progress-label{margin-top:-.4rem}.md-typeset .progress.thin .progress-bar{height:.4rem}.md-typeset .progress.candystripe .progress-bar{background-image:linear-gradient(135deg,hsla(0,0%,100%,.8) 27%,transparent 0,transparent 52%,hsla(0,0%,100%,.8) 0,hsla(0,0%,100%,.8) 77%,transparent 0,transparent);background-size:2rem 2rem}.md-typeset .progress-80plus .progress-bar,.md-typeset .progress-100plus .progress-bar{background-color:#00e676}.md-typeset .progress-60plus .progress-bar{background-color:#fbc02d}.md-typeset .progress-40plus .progress-bar{background-color:#ff9100}.md-typeset .progress-20plus .progress-bar{background-color:#ff5252}.md-typeset .progress-0plus .progress-bar{background-color:#ff1744}.md-typeset .progress.note .progress-bar{background-color:#2979ff}.md-typeset .progress.summary .progress-bar{background-color:#00b0ff}.md-typeset .progress.tip .progress-bar{background-color:#00bfa5}.md-typeset .progress.success .progress-bar{background-color:#00e676}.md-typeset .progress.warning .progress-bar{background-color:#ff9100}.md-typeset .progress.failure .progress-bar{background-color:#ff5252}.md-typeset .progress.danger .progress-bar{background-color:#ff1744}.md-typeset .progress.bug .progress-bar{background-color:#f50057}.md-typeset .progress.quote .progress-bar{background-color:#9e9e9e}@-webkit-keyframes a{0%{background-position:0 0}to{background-position:6rem 0}}@keyframes a{0%{background-position:0 0}to{background-position:6rem 0}}.md-footer .md-footer-custom-text{color:hsla(0,0%,100%,.3)}@media only screen and (max-width:44.9375em){.md-typeset>.codehilite [data-linenos]:before,.md-typeset>.codehilitetable .linenodiv .special,.md-typeset>.highlight [data-linenos]:before,.md-typeset>.highlighttable .linenodiv .special{margin-left:-1.6rem;padding-left:1.6rem}}@media only screen and (min-width:76.1876em){.md-typeset .headerlink{margin-left:-2.4rem;float:left}.md-typeset h1 .headerlink{margin-top:.8rem}.md-typeset h2 .headerlink{margin-top:.6rem}.md-typeset h3 .headerlink{margin-top:.4rem}.md-typeset h4 .headerlink{margin-top:.2rem}.md-typeset h5 .headerlink,.md-typeset h6 .headerlink{margin-top:0}} \ No newline at end of file diff --git a/docs/theme/extra-d8800ea088.js b/docs/theme/extra-d8800ea088.js deleted file mode 100644 index 020e42f..0000000 --- a/docs/theme/extra-d8800ea088.js +++ /dev/null @@ -1 +0,0 @@ -!function(){"use strict";var e=function(e,t,n){for(var o=function(e){for(var t="",n=0;ncode{margin:0 .29412em;padding:.07353em 0;border-radius:.2rem;background-color:hsla(0,0%,93%,.5);-webkit-box-shadow:.29412em 0 0 hsla(0,0%,93%,.5),-.29412em 0 0 hsla(0,0%,93%,.5);box-shadow:.29412em 0 0 hsla(0,0%,93%,.5),-.29412em 0 0 hsla(0,0%,93%,.5);-webkit-box-decoration-break:clone;box-decoration-break:clone}.md-typeset td code{word-break:normal}.md-typeset .codehilite .hll,.md-typeset .highlight .hll{display:inline}.md-typeset .headerlink{font:normal 400 2rem Material Icons;vertical-align:middle}.md-typeset h2 .headerlink{margin-top:-.4rem}.md-typeset h3 .headerlink{margin-top:-.3rem}.md-typeset h4 .headerlink,.md-typeset h5 .headerlink,.md-typeset h6 .headerlink{margin-top:-.2rem}.md-typeset .progress-label{position:absolute;width:100%;margin:0;color:rgba(0,0,0,.5);font-weight:700;line-height:1.2rem;text-align:center;white-space:nowrap;overflow:hidden}.md-typeset .progress-bar{height:1.2rem;float:left;background-color:#2979ff}.md-typeset .progress{display:block;position:relative;width:100%;height:1.2rem;margin:.5rem 0;background-color:#eee}.md-typeset .progress.thin{height:.4rem;margin-top:.9rem}.md-typeset .progress.thin .progress-label{margin-top:-.4rem}.md-typeset .progress.thin .progress-bar{height:.4rem}.md-typeset .progress.candystripe .progress-bar{background-image:linear-gradient(135deg,hsla(0,0%,100%,.8) 27%,transparent 0,transparent 52%,hsla(0,0%,100%,.8) 0,hsla(0,0%,100%,.8) 77%,transparent 0,transparent);background-size:2rem 2rem}.md-typeset .progress-80plus .progress-bar,.md-typeset .progress-100plus .progress-bar{background-color:#00e676}.md-typeset .progress-60plus .progress-bar{background-color:#fbc02d}.md-typeset .progress-40plus .progress-bar{background-color:#ff9100}.md-typeset .progress-20plus .progress-bar{background-color:#ff5252}.md-typeset .progress-0plus .progress-bar{background-color:#ff1744}.md-typeset .progress.note .progress-bar{background-color:#2979ff}.md-typeset .progress.summary .progress-bar{background-color:#00b0ff}.md-typeset .progress.tip .progress-bar{background-color:#00bfa5}.md-typeset .progress.success .progress-bar{background-color:#00e676}.md-typeset .progress.warning .progress-bar{background-color:#ff9100}.md-typeset .progress.failure .progress-bar{background-color:#ff5252}.md-typeset .progress.danger .progress-bar{background-color:#ff1744}.md-typeset .progress.bug .progress-bar{background-color:#f50057}.md-typeset .progress.quote .progress-bar{background-color:#9e9e9e}.md-typeset .candystripe-animate .progress-bar{-webkit-animation:a 3s linear infinite;animation:a 3s linear infinite}@-webkit-keyframes a{0%{background-position:0 0}to{background-position:6rem 0}}@keyframes a{0%{background-position:0 0}to{background-position:6rem 0}}.md-footer .md-footer-custom-text{color:hsla(0,0%,100%,.3)}@media only screen and (min-width:76.1876em){.md-typeset .headerlink{margin-left:-2.4rem;float:left}.md-typeset h2 .headerlink{margin-top:.6rem}.md-typeset h3 .headerlink{margin-top:.4rem}.md-typeset h4 .headerlink{margin-top:.2rem}.md-typeset h5 .headerlink,.md-typeset h6 .headerlink{margin-top:0}} \ No newline at end of file diff --git a/mkdocs.yml b/mkdocs.yml index 2d8742a..3f4eb52 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -2,7 +2,7 @@ site_name: EasyDiff Documentation repo_url: https://github.com/facelessuser/EasyDiff site_description: Diff plugin for Sublime Text. copyright: | - Copyright © 2013 - 2017 Isaac Muse + Copyright © 2013 - 2018 Isaac Muse
emoji provided free by EmojiOne docs_dir: docs/src/markdown @@ -18,7 +18,7 @@ theme: text: Roboto code: Roboto Mono -pages: +nav: - User Guide: index.md - Installation: installation.md - Contributing & Support: contributing.md @@ -36,8 +36,20 @@ markdown_extensions: - markdown.extensions.def_list: - markdown.extensions.tables: - markdown.extensions.abbr: + - markdown.extensions.footnotes: - pymdownx.extrarawhtml: - pymdownx.superfences: + preserve_tabs: true + custom_fences: + - name: flow + class: uml-flowchart + format: !!python/name:pymdownx.superfences.fence_code_format + - name: sequence + class: uml-sequence-diagram + format: !!python/name:pymdownx.superfences.fence_code_format + - name: math + class: arithmatex + format: !!python/name:pymdownx.arithmatex.fence_mathjax_format - pymdownx.highlight: css_class: codehilite extend_pygments_lang: @@ -45,10 +57,19 @@ markdown_extensions: lang: php options: startinline: true + - name: pycon3 + lang: pycon + options: + python3: true - pymdownx.inlinehilite: + custom_inline: + - name: math + class: arithmatex + format: !!python/name:pymdownx.arithmatex.inline_mathjax_format - pymdownx.magiclink: repo_url_shortener: true repo_url_shorthand: true + social_url_shorthand: true user: facelessuser repo: EasyDiff - pymdownx.tilde: @@ -62,8 +83,7 @@ markdown_extensions: - pymdownx.tasklist: custom_checkbox: true - pymdownx.progressbar: - - pymdownx.plainhtml: - strip_attributes: '' + - pymdownx.striphtml: - pymdownx.snippets: base_path: docs/src/markdown/_snippets - pymdownx.keys: @@ -75,6 +95,6 @@ extra: - type: github link: https://github.com/facelessuser extra_css: - - extra-f8303dea60.css + - extra-83f68d2c59.css extra_javascript: - - extra-d8800ea088.js + - extra-0b9b22dd13.js diff --git a/tests/spellcheck.py b/tests/spellcheck.py deleted file mode 100644 index c4a15d4..0000000 --- a/tests/spellcheck.py +++ /dev/null @@ -1,210 +0,0 @@ -"""Spell check with aspell.""" -from __future__ import unicode_literals -import subprocess -import os -import sys -import yaml -import codecs - -PY3 = sys.version_info >= (3, 0) - -USER_DICT = '.dictionary' -BUILD_DIR = os.path.join('.', 'build', 'docs') -MKDOCS_CFG = 'mkdocs.yml' -COMPILED_DICT = os.path.join(BUILD_DIR, 'dictionary.bin') -MKDOCS_SPELL = os.path.join(BUILD_DIR, MKDOCS_CFG) -MKDOCS_BUILD = os.path.join(BUILD_DIR, 'site') - - -def console(cmd, input_file=None): - """Call with arguments.""" - - returncode = None - output = None - - if sys.platform.startswith('win'): - startupinfo = subprocess.STARTUPINFO() - startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW - process = subprocess.Popen( - cmd, - startupinfo=startupinfo, - stdout=subprocess.PIPE, - stderr=subprocess.STDOUT, - stdin=subprocess.PIPE, - shell=False - ) - else: - process = subprocess.Popen( - cmd, - stdout=subprocess.PIPE, - stderr=subprocess.STDOUT, - stdin=subprocess.PIPE, - shell=False - ) - - if input_file is not None: - with open(input_file, 'rb') as f: - process.stdin.write(f.read()) - output = process.communicate() - returncode = process.returncode - - assert returncode == 0, "Runtime Error: %s" % ( - output[0].rstrip().decode('utf-8') if PY3 else output[0] - ) - - return output[0].decode('utf-8') if PY3 else output[0] - - -def yaml_dump(data, stream=None, dumper=yaml.Dumper, **kwargs): - """Special dumper wrapper to modify the yaml dumper.""" - - class Dumper(dumper): - """Custom dumper.""" - - if not PY3: - # Unicode - Dumper.add_representer( - unicode, # noqa - lambda dumper, value: dumper.represent_scalar(u'tag:yaml.org,2002:str', value) - ) - - return yaml.dump(data, stream, Dumper, **kwargs) - - -def yaml_load(source, loader=yaml.Loader): - """ - Wrap PyYaml's loader so we can extend it to suit our needs. - - Load all strings as unicode: http://stackoverflow.com/a/2967461/3609487. - """ - - def construct_yaml_str(self, node): - """Override the default string handling function to always return Unicode objects.""" - return self.construct_scalar(node) - - class Loader(loader): - """Define a custom loader to leave the global loader unaltered.""" - - # Attach our unicode constructor to our custom loader ensuring all strings - # will be unicode on translation. - Loader.add_constructor('tag:yaml.org,2002:str', construct_yaml_str) - - return yaml.load(source, Loader) - - -def patch_doc_config(config_file): - """Patch the config file to wrap arithmatex with a tag aspell can ignore.""" - - with open(config_file, 'rb') as f: - config = yaml_load(f) - - index = 0 - for extension in config.get('markdown_extensions', []): - if isinstance(extension, str if PY3 else unicode) and extension == 'pymdownx.arithmatex': # noqa - config['markdown_extensions'][index] = {'pymdownx.arithmatex': {'insert_as_script': True}} - break - elif isinstance(extension, dict) and 'pymdownx.arithmatex' in extension: - if isinstance(extension['pymdownx.arithmatex'], dict): - extension['pymdownx.arithmatex']['insert_as_script'] = True - elif extension['pymdownx.arithmatex'] is None: - extension['pymdownx.arithmatex'] = {'insert_as_script': True} - break - index += 1 - - with codecs.open(MKDOCS_SPELL, "w", encoding="utf-8") as f: - yaml_dump( - config, f, - width=None, - indent=4, - allow_unicode=True, - default_flow_style=False - ) - return MKDOCS_SPELL - - -def build_docs(): - """Build docs with MkDocs.""" - print('Building Docs...') - print( - console( - [ - sys.executable, - '-m', 'mkdocs', 'build', '--clean', - '-d', MKDOCS_BUILD, - '-f', patch_doc_config(MKDOCS_CFG) - ] - ) - ) - - -def compile_dictionary(): - """Compile user dictionary.""" - if os.path.exists(COMPILED_DICT): - os.remove(COMPILED_DICT) - print("Compiling Custom Dictionary...") - print( - console( - [ - 'aspell', - '--lang=en', - '--encoding=utf-8', - 'create', - 'master', - COMPILED_DICT - ], - USER_DICT - ) - ) - - -def check_spelling(): - """Check spelling.""" - print('Spell Checking...') - - fail = False - - for base, dirs, files in os.walk(MKDOCS_BUILD): - # Remove child folders based on exclude rules - for f in files: - if f.endswith('.html'): - file_name = os.path.join(base, f) - wordlist = console( - [ - 'aspell', - 'list', - '--lang=en', - '--mode=html', - '--encoding=utf-8', - '--add-html-skip=code', - '--add-html-skip=pre', - '--add-html-skip=nav', - '--add-html-skip=footer', - '--extra-dicts=%s' % COMPILED_DICT - ], - file_name - ) - - words = [w for w in sorted(set(wordlist.split('\n'))) if w] - - if words: - fail = True - print('Misspelled words in %s' % file_name) - print('-' * 80) - for word in words: - print(word) - print('-' * 80) - print('\n') - return fail - - -def main(): - """Main.""" - if not os.path.exists(BUILD_DIR): - os.makedirs(BUILD_DIR) - build_docs() - compile_dictionary() - return check_spelling() - - -if __name__ == "__main__": - sys.exit(main()) From 3bead4ca435e0ac6d7932d2f595d8a060839cfee Mon Sep 17 00:00:00 2001 From: facelessuser Date: Fri, 30 Nov 2018 19:38:36 -0700 Subject: [PATCH 4/4] Update changelog and bump version --- CHANGES.md | 14 ++++---------- support.py | 2 +- 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 15fe5c3..6ca76c2 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,32 +1,26 @@ -# EasyDiff 2.0.4 +# EasyDiff 2.0.5 + +- **FIX**: Lag during version control binary check. -> Released Mar 16, 2018 +# EasyDiff 2.0.4 - **FIX**: Fix view index issue. # EasyDiff 2.0.3 -> Released Feb 5, 2017 - - **FIX**: More unique name for generated version control files #26. # EasyDiff 2.0.2 -> Released Nov 19, 2017 - - **FIX**: Log rendering. # EasyDiff 2.0.1 -> Released Nov 19, 2017 - - **FIX**: Remove workarounds. - **FIX**: Update dependencies to the latest. # EasyDiff 2.0.0 -> Released May 28, 2017 - - **NEW**: Add new support commands. - **NEW**: Reduce menus down to a few commands. - **NEW**: Check version control binaries on first call to them instead of at plugin load. diff --git a/support.py b/support.py index 3886234..06ae886 100644 --- a/support.py +++ b/support.py @@ -5,7 +5,7 @@ import webbrowser import re -__version__ = "2.0.4" +__version__ = "2.0.5" __pc_name__ = 'EasyDiff' CSS = '''