Hello community,

here is the log from the commit of package python-setuptools_scm for 
openSUSE:Factory checked in at 2017-01-23 11:30:52
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-setuptools_scm (Old)
 and      /work/SRC/openSUSE:Factory/.python-setuptools_scm.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "python-setuptools_scm"

Changes:
--------
--- 
/work/SRC/openSUSE:Factory/python-setuptools_scm/python-setuptools_scm.changes  
    2016-12-11 13:24:51.304669567 +0100
+++ 
/work/SRC/openSUSE:Factory/.python-setuptools_scm.new/python-setuptools_scm.changes
 2017-01-23 11:30:53.357185941 +0100
@@ -1,0 +2,43 @@
+Wed Jan 18 14:19:15 UTC 2017 - [email protected]
+
+- updated source project URL (now github)
+- source link without hash
+
+-------------------------------------------------------------------
+Sat Jan 14 18:44:19 UTC 2017 - [email protected]
+
+- Update to v1.15.0
+  - more sophisticated ignoring of mercurial tag commits when considering
+    distance in commits (thanks Petre Mierlutiu)
+  - fix issue #114: stop trying to be smart for the sdist and ensure its always
+    correctly usign itself
+  - update trove classifiers
+  - fix issue #84: document using the installed package metadata for sphinx
+  - fix issue #81: fail more gracious when git/hg are missing
+  - address issue #93: provide an experimental api to customize behaviour on
+    shallow git repos a custom parse function may pick pre parse actions to do
+    when using git
+
+- Update to v1.14.1
+  - fix #109: when detecting a dirty git workdir
+      - don't consider untracked file (this was a regression due to #86 in 
v1.13.1)
+  - consider the distance 0 when the git node is unknown (happens when you
+    haven't commited anything)
+
+- Update to v1.14.0
+  - publish bdist_egg for python 2.6, 2.7 and 3.3-3.5
+  - fix issue #107 - dont use node if it is None
+
+- Update to v1.13.1
+  - fix issue #86 - detect dirty git workdir without tags
+
+- Update to v1.13.0
+  - fix regression caused by the fix of #101 * assert types for version dumping
+    * strictly pass all versions trough parsed version metadata
+
+- Update to v1.12.0
+  - fix issue #97 - add support for mercurial plugins
+  - fix issue #101 - write version cache even for pretend version (thanks
+    anarcat for reporting and fixing)
+
+-------------------------------------------------------------------

Old:
----
  setuptools_scm-1.11.1.tar.gz

New:
----
  setuptools_scm-1.15.0.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ python-setuptools_scm.spec ++++++
--- /var/tmp/diff_new_pack.AsiI5Y/_old  2017-01-23 11:30:53.837117895 +0100
+++ /var/tmp/diff_new_pack.AsiI5Y/_new  2017-01-23 11:30:53.837117895 +0100
@@ -1,7 +1,7 @@
 #
 # spec file for package python-setuptools_scm
 #
-# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -17,13 +17,13 @@
 
 
 Name:           python-setuptools_scm
-Version:        1.11.1
+Version:        1.15.0
 Release:        0
 Summary:        Manage your versions by scm tags
 License:        MIT
 Group:          Development/Languages/Python
-Url:            http://bitbucket.org/pypa/setuptools_scm/
-Source:         
https://files.pythonhosted.org/packages/84/aa/c693b5d41da513fed3f0ee27f1bf02a303caa75bbdfa5c8cc233a1d778c4/setuptools_scm-1.11.1.tar.gz
+Url:            https://github.com/pypa/setuptools_scm
+Source:         
https://pypi.io/packages/source/s/setuptools_scm/setuptools_scm-%{version}.tar.gz
 BuildRequires:  python-devel
 BuildRequires:  python-setuptools
 # Testing requirements

++++++ setuptools_scm-1.11.1.tar.gz -> setuptools_scm-1.15.0.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/setuptools_scm-1.11.1/.travis.yml 
new/setuptools_scm-1.15.0/.travis.yml
--- old/setuptools_scm-1.11.1/.travis.yml       2016-06-12 23:09:53.000000000 
+0200
+++ new/setuptools_scm-1.15.0/.travis.yml       2016-10-20 23:55:22.000000000 
+0200
@@ -6,21 +6,40 @@
 - '3.3'
 - '3.4'
 - '3.5'
+- '3.6-dev'
+env:
+- TOXENV=py-test
+
+matrix:
+  include:
+    - python: '2.7'
+      env: TOXENV=flake8
+    - python: '3.5'
+      env: TOXENV=flake8
 cache:
   files:
   - $HOME/.pip/cache
   - $Home/.cache/pip
 install: pip install tox
 script:
-- tox -e py-test,flake8
-deploy:
-  provider: pypi
-  user: ronny
-  password:
-    secure: 
QGJhDXmfFDKysMJJV/ONGaHHzG/aImhU3DdhEP63d657iQSn/Cb4EG/l9YmVnRzpJ94nSDXZB8YwptR7rid0bOtidb32lxN8n6UiWILCXWeAN2FE+tT9/0xIct4HUJZ8OttD1gft/Di722Gy+s9PzFwjwrV4efkxCzgjfYOjkMeq3aO6NoG3ur0iZXJh7ODwLp4sRFep2NpIEaXm2qMdnnXpck6bJ1q/NtvPx9CAZivd9HYa0evg5j1ENTz1mXXafhgF+0vRCBXA33xJuysO6CKtk+2mizL1QHfosOERiKl9+zPyZw+VvSchbCVwgxrMSiRcpGag+4SegyHrj1M/2YqfFzMF/yuFGcqXl2VkEqlnBQOVMNW3Kdcmnm+caNbddnv+M384WFz4nV8nWjcsD5l27+XlMWfuvskDIvZKtVCXmmbtqgwM4tqoYd6uxbnooRfwINTGx8sNzKP10xkaesB3ZBCEpecOKA1AXUAZ74RfYWWExv6eIuVGwyIJmOcD8M/17N8g58GxxO+88gx50EuhyNiRjYZDUipfVydfJwBwpD+p695NixUMITuksucQftjHsQp+laGWJlDIPvFwI85wDJUYAyrzn6L1W+smkm1bGomuliW2MJfxeSZAmSk4CE5VOpIWQTBmDLR3pxBhcaqzwdd4mAWvMi/fpM4yJJI=
-  on:
-    tags: true
-    python: '2.7'
+- tox -e $TOXENV
+
 
 
-  distributions: "sdist bdist_wheel"
+credentials:
+  - &pypi
+    provider: pypi
+    user: ronny
+    password:
+      secure: 
QGJhDXmfFDKysMJJV/ONGaHHzG/aImhU3DdhEP63d657iQSn/Cb4EG/l9YmVnRzpJ94nSDXZB8YwptR7rid0bOtidb32lxN8n6UiWILCXWeAN2FE+tT9/0xIct4HUJZ8OttD1gft/Di722Gy+s9PzFwjwrV4efkxCzgjfYOjkMeq3aO6NoG3ur0iZXJh7ODwLp4sRFep2NpIEaXm2qMdnnXpck6bJ1q/NtvPx9CAZivd9HYa0evg5j1ENTz1mXXafhgF+0vRCBXA33xJuysO6CKtk+2mizL1QHfosOERiKl9+zPyZw+VvSchbCVwgxrMSiRcpGag+4SegyHrj1M/2YqfFzMF/yuFGcqXl2VkEqlnBQOVMNW3Kdcmnm+caNbddnv+M384WFz4nV8nWjcsD5l27+XlMWfuvskDIvZKtVCXmmbtqgwM4tqoYd6uxbnooRfwINTGx8sNzKP10xkaesB3ZBCEpecOKA1AXUAZ74RfYWWExv6eIuVGwyIJmOcD8M/17N8g58GxxO+88gx50EuhyNiRjYZDUipfVydfJwBwpD+p695NixUMITuksucQftjHsQp+laGWJlDIPvFwI85wDJUYAyrzn6L1W+smkm1bGomuliW2MJfxeSZAmSk4CE5VOpIWQTBmDLR3pxBhcaqzwdd4mAWvMi/fpM4yJJI=
+
+deploy:
+  - <<: *pypi
+    on:
+      tags: true
+      python: '2.7'
+    distributions: "sdist bdist_wheel"
+  - <<: *pypi
+    on:
+      tags: true
+    distributions: "bdist_egg"
\ No newline at end of file
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/setuptools_scm-1.11.1/CHANGELOG.rst 
new/setuptools_scm-1.15.0/CHANGELOG.rst
--- old/setuptools_scm-1.11.1/CHANGELOG.rst     2016-06-12 23:09:53.000000000 
+0200
+++ new/setuptools_scm-1.15.0/CHANGELOG.rst     2016-10-20 23:55:22.000000000 
+0200
@@ -1,9 +1,58 @@
+v1.15.0
+=======
+
+* more sophisticated ignoring of mercurial tag commits
+  when considering distance in commits
+  (thanks Petre Mierlutiu)
+* fix issue #114: stop trying to be smart for the sdist
+  and ensure its always correctly usign itself
+* update trove classifiers
+* fix issue #84: document using the installed package metadata for sphinx
+* fix issue #81: fail more gracious when git/hg are missing
+* address issue #93: provide an experimental api to customize behaviour on 
shallow git repos
+  a custom parse function may pick pre parse actions to do when using git
+
+
+v1.14.1
+=======
+
+* fix #109: when detecting a dirty git workdir
+            don't consider untracked file
+            (this was a regression due to #86 in v1.13.1)
+* consider the distance 0 when the git node is unknown
+  (happens when you haven't commited anything)
+
+v1.14.0
+=======
+
+* publish bdist_egg for python 2.6, 2.7 and 3.3-3.5
+* fix issue #107 - dont use node if it is None
+
+v1.13.1
+=======
+
+* fix issue #86 - detect dirty git workdir without tags
+
+v1.13.0
+=======
+
+* fix regression caused by the fix of #101
+  * assert types for version dumping
+  * strictly pass all versions trough parsed version metadata
+
+v1.12.0
+=======
+
+* fix issue #97 - add support for mercurial plugins
+* fix issue #101 - write version cache even for pretend version
+  (thanks anarcat for reporting and fixing)
+
 v1.11.1
 ========
 
 * fix issue #88 - better docs for sphinx usage (thanks Jason)
 * fix issue #89 - use normpath to deal with windows
-  (thanks Te-jé Rodgers for reporting and fixing) 
+  (thanks Te-jé Rodgers for reporting and fixing)
 
 v1.11.0
 =======
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/setuptools_scm-1.11.1/PKG-INFO 
new/setuptools_scm-1.15.0/PKG-INFO
--- old/setuptools_scm-1.11.1/PKG-INFO  2016-06-12 23:10:13.000000000 +0200
+++ new/setuptools_scm-1.15.0/PKG-INFO  2016-10-20 23:55:36.000000000 +0200
@@ -1,6 +1,6 @@
 Metadata-Version: 1.1
 Name: setuptools_scm
-Version: 1.11.1
+Version: 1.15.0
 Summary: the blessed package to manage your versions by scm tags
 Home-page: https://github.com/pypa/setuptools_scm/
 Author: Ronny Pfannschmidt
@@ -43,8 +43,8 @@
         Programmatic usage
         ------------------
         
-        In order to use setuptools_scm for sphinx config, assuming the sphinx 
conf
-        is one directory deeper than the project's root, use::
+        In order to use setuptools_scm from code
+        that one directory deeper than the project's root, you can use:
         
         .. code:: python
         
@@ -52,11 +52,28 @@
             version = get_version(root='..', relative_to=__file__)
         
         
+        Usage from sphinx
+        -----------------
+        
+        It is discouraged to use setuptools_scm from sphinx itself,
+        instead use ``pkg_resources`` after editable/real installation:
+        
+        .. code:: python
+        
+            from pkg_resources import get_distribution
+            release = pkg_resources('myproject').version
+            # for the example take major/minor
+            version = '.'.join(release.split('.')[:2])
+        
+        The underlying reason is, that services like readthedocs sometimes 
change
+        the workingdirectory for good reasons and using the installed metadata 
prevents
+        using needless volatile data there.
+        
         Notable Plugins
         ----------------
         
         `setuptools_scm_git_archive 
<https://pypi.python.org/pypi/setuptools_scm_git_archive>`_
-        provides partial support for obtaining versions from git archvies
+        provides partial support for obtaining versions from git archives
         that belong to tagged versions. The only reason for not including
         it in setuptools-scm itself is git/github not supporting
         sufficient metadata for untagged/followup commits,
@@ -247,10 +264,7 @@
             def myversion():
                 from setuptools_scm.version import dirty_tag
                 def clean_scheme(version):
-                    if not version.dirty:
-                        return '+clean'
-                    else:
-                        return dirty_tag(version)
+                    return dirty_tag(version) if version.dirty else '+clean'
         
                 return {'local_scheme': clean_scheme}
         
@@ -270,8 +284,12 @@
 Classifier: License :: OSI Approved :: MIT License
 Classifier: Programming Language :: Python
 Classifier: Programming Language :: Python :: 3
+Classifier: Programming Language :: Python :: 2.6
 Classifier: Programming Language :: Python :: 2.7
+Classifier: Programming Language :: Python :: 3.3
 Classifier: Programming Language :: Python :: 3.4
+Classifier: Programming Language :: Python :: 3.5
+Classifier: Programming Language :: Python :: 3.6
 Classifier: Topic :: Software Development :: Libraries
 Classifier: Topic :: Software Development :: Version Control
 Classifier: Topic :: System :: Software Distribution
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/setuptools_scm-1.11.1/README.rst 
new/setuptools_scm-1.15.0/README.rst
--- old/setuptools_scm-1.11.1/README.rst        2016-06-12 23:09:53.000000000 
+0200
+++ new/setuptools_scm-1.15.0/README.rst        2016-10-20 23:55:22.000000000 
+0200
@@ -35,8 +35,8 @@
 Programmatic usage
 ------------------
 
-In order to use setuptools_scm for sphinx config, assuming the sphinx conf
-is one directory deeper than the project's root, use::
+In order to use setuptools_scm from code
+that one directory deeper than the project's root, you can use:
 
 .. code:: python
 
@@ -44,11 +44,28 @@
     version = get_version(root='..', relative_to=__file__)
 
 
+Usage from sphinx
+-----------------
+
+It is discouraged to use setuptools_scm from sphinx itself,
+instead use ``pkg_resources`` after editable/real installation:
+
+.. code:: python
+
+    from pkg_resources import get_distribution
+    release = pkg_resources('myproject').version
+    # for the example take major/minor
+    version = '.'.join(release.split('.')[:2])
+
+The underlying reason is, that services like readthedocs sometimes change
+the workingdirectory for good reasons and using the installed metadata prevents
+using needless volatile data there.
+
 Notable Plugins
 ----------------
 
 `setuptools_scm_git_archive 
<https://pypi.python.org/pypi/setuptools_scm_git_archive>`_
-provides partial support for obtaining versions from git archvies
+provides partial support for obtaining versions from git archives
 that belong to tagged versions. The only reason for not including
 it in setuptools-scm itself is git/github not supporting
 sufficient metadata for untagged/followup commits,
@@ -239,10 +256,7 @@
     def myversion():
         from setuptools_scm.version import dirty_tag
         def clean_scheme(version):
-            if not version.dirty:
-                return '+clean'
-            else:
-                return dirty_tag(version)
+            return dirty_tag(version) if version.dirty else '+clean'
 
         return {'local_scheme': clean_scheme}
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/setuptools_scm-1.11.1/default.nix 
new/setuptools_scm-1.15.0/default.nix
--- old/setuptools_scm-1.11.1/default.nix       1970-01-01 01:00:00.000000000 
+0100
+++ new/setuptools_scm-1.15.0/default.nix       2016-10-20 23:55:22.000000000 
+0200
@@ -0,0 +1,9 @@
+{pkgs ? import <nixpkgs> {}}:
+with pkgs.pythonPackages;
+buildPythonPackage {
+  name = "setuptools_scm";
+  src = ./.;
+  version = "git";
+  buildInputs = [setuptools pip pytest pkgs.git pkgs.mercurial];
+}
+
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/setuptools_scm-1.11.1/setup.py 
new/setuptools_scm-1.15.0/setup.py
--- old/setuptools_scm-1.11.1/setup.py  2016-06-12 23:10:13.000000000 +0200
+++ new/setuptools_scm-1.15.0/setup.py  2016-10-20 23:55:22.000000000 +0200
@@ -13,7 +13,6 @@
 import os
 import sys
 import setuptools
-from setuptools.command.sdist import sdist as sdist_orig
 
 
 PROBLEMATIC_COMMANDS = 'install', 'develop', 'easy_install', 'bdist_egg'
@@ -39,31 +38,12 @@
     long_description = fp.read()
 
 
-class sdist(sdist_orig):
-    def make_release_tree(self, base_dir, files):
-        sdist_orig.make_release_tree(self, base_dir, files)
-        target = os.path.join(base_dir, 'setup.py')
-        with open(__file__) as fp:
-            template = fp.read()
-        ver = self.distribution.version
-        if not ver:
-            from setuptools_scm import get_version
-            ver = get_version(**scm_config())
-
-        finalized = template.replace(
-            'use_scm_version=scm_config,\n',
-            'version="%s",\n' % ver)
-        os.remove(target)
-        with open(target, 'w') as fp:
-            fp.write(finalized)
-
-
 arguments = dict(
     name='setuptools_scm',
     url='https://github.com/pypa/setuptools_scm/',
     zip_safe=True,
     # pass here since entrypints are not yet registred
-    version="1.11.1",
+    use_scm_version=scm_config,
     author='Ronny Pfannschmidt',
     author_email='[email protected]',
     description=('the blessed package to manage your versions by scm tags'),
@@ -109,14 +89,17 @@
         'License :: OSI Approved :: MIT License',
         'Programming Language :: Python',
         'Programming Language :: Python :: 3',
+        'Programming Language :: Python :: 2.6',
         'Programming Language :: Python :: 2.7',
+        'Programming Language :: Python :: 3.3',
         'Programming Language :: Python :: 3.4',
+        'Programming Language :: Python :: 3.5',
+        'Programming Language :: Python :: 3.6',
         'Topic :: Software Development :: Libraries',
         'Topic :: Software Development :: Version Control',
         'Topic :: System :: Software Distribution',
         'Topic :: Utilities',
     ],
-    cmdclass={'sdist': sdist}
 )
 
 if __name__ == '__main__':
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/setuptools_scm-1.11.1/setuptools_scm/__init__.py 
new/setuptools_scm-1.15.0/setuptools_scm/__init__.py
--- old/setuptools_scm-1.11.1/setuptools_scm/__init__.py        2016-06-12 
23:09:53.000000000 +0200
+++ new/setuptools_scm-1.15.0/setuptools_scm/__init__.py        2016-10-20 
23:55:22.000000000 +0200
@@ -4,9 +4,10 @@
 """
 import os
 import sys
+import warnings
 
 from .utils import trace
-from .version import format_version
+from .version import format_version, meta, ScmVersion
 from .discover import find_matching_entrypoint
 
 PRETEND_KEY = 'SETUPTOOLS_SCM_PRETEND_VERSION'
@@ -37,6 +38,7 @@
 
 
 def dump_version(root, version, write_to, template=None):
+    assert isinstance(version, string_types)
     if not write_to:
         return
     target = os.path.normpath(os.path.join(root, write_to))
@@ -59,10 +61,21 @@
 def _do_parse(root, parse):
     pretended = os.environ.get(PRETEND_KEY)
     if pretended:
-        return pretended
+        # we use meta here since the pretended version
+        # must adhere to the pep to begin with
+        return meta(pretended)
 
     if parse:
-        version = parse(root) or _version_from_entrypoint(
+        parse_result = parse(root)
+        if isinstance(parse_result, string_types):
+            warnings.warn(
+                "version parse result was a string\n"
+                "please return a parsed version",
+                category=DeprecationWarning)
+            # we use ScmVersion here in order to keep legacy code working
+            # for 2.0 we should use meta
+            parse_result = ScmVersion(parse_result)
+        version = parse_result or _version_from_entrypoint(
             root, 'setuptools_scm.parse_scm_fallback')
     else:
         # include fallbacks after dropping them from the main entrypoint
@@ -101,18 +114,17 @@
     root = os.path.abspath(root)
     trace('root', repr(root))
 
-    version = _do_parse(root, parse)
+    parsed_version = _do_parse(root, parse)
 
-    if version:
-        if isinstance(version, string_types):
-            return version
-        version = format_version(
-            version,
+    if parsed_version:
+        version_string = format_version(
+            parsed_version,
             version_scheme=version_scheme,
             local_scheme=local_scheme)
         dump_version(
             root=root,
-            version=version,
+            version=version_string,
             write_to=write_to,
             template=write_to_template)
-        return version
+
+        return version_string
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/setuptools_scm-1.11.1/setuptools_scm/git.py 
new/setuptools_scm-1.15.0/setuptools_scm/git.py
--- old/setuptools_scm-1.11.1/setuptools_scm/git.py     2016-06-12 
23:09:53.000000000 +0200
+++ new/setuptools_scm-1.15.0/setuptools_scm/git.py     2016-10-20 
23:55:22.000000000 +0200
@@ -1,40 +1,103 @@
-from .utils import do, do_ex, trace
+from .utils import do_ex, trace, has_command
 from .version import meta
-from os.path import abspath, normcase, realpath
-
+from os.path import abspath, normcase, realpath, isfile, join
+import warnings
 
 FILES_COMMAND = 'git ls-files'
-DEFAULT_DESCRIBE = 'git describe --dirty --tags --long --match *.*'
+DEFAULT_DESCRIBE = 'git describe --tags --long --match *.*'
 
 
-def parse(root, describe_command=DEFAULT_DESCRIBE):
-    real_root, _, ret = do_ex('git rev-parse --show-toplevel', root)
-    if ret:
-        return
-    trace('real root', real_root)
-    if (normcase(abspath(realpath(real_root))) !=
-            normcase(abspath(realpath(root)))):
+def _normalized(path):
+    return normcase(abspath(realpath(path)))
+
+
+class GitWorkdir(object):
+    """experimental, may change at any time"""
+    def __init__(self, path):
+        self.path = path
+
+    def do_ex(self, cmd):
+        return do_ex(cmd, cwd=self.path)
+
+    @classmethod
+    def from_potential_worktree(cls, wd):
+        real_wd, _, ret = do_ex('git rev-parse --show-toplevel', wd)
+        if ret:
+            return
+        trace('real root', real_wd)
+        if _normalized(real_wd) != _normalized(wd):
+            return
+
+        return cls(real_wd)
+
+    def is_dirty(self):
+        out, _, _ = self.do_ex("git status --porcelain --untracked-files=no")
+        return bool(out)
+
+    def is_shallow(self):
+        return isfile(join(self.path, '.git/shallow'))
+
+    def fetch_shallow(self):
+        self.do_ex("git fetch --unshallow")
+
+    def node(self):
+        rev_node, _, ret = self.do_ex('git rev-parse --verify --quiet HEAD')
+        if not ret:
+            return rev_node[:7]
+
+    def count_all_nodes(self):
+        revs, _, _ = self.do_ex('git rev-list HEAD')
+        return revs.count('\n') + 1
+
+
+def warn_on_shallow(wd):
+    """experimental, may change at any time"""
+    if wd.is_shallow():
+        warnings.warn('"%s" is shallow and may cause errors' % (wd.path,))
+
+
+def fetch_on_shallow(wd):
+    """experimental, may change at any time"""
+    if wd.is_shallow():
+        warnings.warn('"%s" was shallow, git fetch was used to rectify')
+        wd.fetch_shallow()
+
+
+def fail_on_shallow(wd):
+    """experimental, may change at any time"""
+    if wd.is_shallow():
+        raise ValueError(
+            '%r is shallow, please correct with '
+            '"git fetch --unshallow"' % wd.path)
+
+
+def parse(root, describe_command=DEFAULT_DESCRIBE, pre_parse=warn_on_shallow):
+    """
+    :param pre_parse: experimental pre_parse action, may change at any time
+    """
+    if not has_command('git'):
         return
-    rev_node, _, ret = do_ex('git rev-parse --verify --quiet HEAD', root)
-    if ret:
-        return meta('0.0')
-    rev_node = rev_node[:7]
+    wd = GitWorkdir(root)
+    if pre_parse:
+        pre_parse(wd)
+    rev_node = wd.node()
+    dirty = wd.is_dirty()
+
+    if rev_node is None:
+        return meta('0.0', distance=0, dirty=dirty)
+
     out, err, ret = do_ex(describe_command, root)
-    if '-' not in out and '.' not in out:
-        revs = do('git rev-list HEAD', root)
-        count = revs.count('\n')
-        if ret:
-            out = rev_node
-        return meta('0.0', distance=count + 1, node=out)
     if ret:
-        return
-    dirty = out.endswith('-dirty')
-    if dirty:
-        out = out.rsplit('-', 1)[0]
+        return meta(
+            '0.0',
+            distance=wd.count_all_nodes(),
+            node=rev_node,
+            dirty=dirty,
+        )
 
     tag, number, node = out.rsplit('-', 2)
     number = int(number)
     if number:
         return meta(tag, distance=number, node=node, dirty=dirty)
     else:
-        return meta(tag, dirty=dirty, node=node)
+        return meta(tag, node=node, dirty=dirty)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/setuptools_scm-1.11.1/setuptools_scm/hacks.py 
new/setuptools_scm-1.15.0/setuptools_scm/hacks.py
--- old/setuptools_scm-1.11.1/setuptools_scm/hacks.py   2016-06-12 
23:09:53.000000000 +0200
+++ new/setuptools_scm-1.15.0/setuptools_scm/hacks.py   2016-10-20 
23:55:22.000000000 +0200
@@ -1,5 +1,6 @@
 import os
 from .utils import data_from_mime, trace
+from .version import meta
 
 
 def parse_pkginfo(root):
@@ -9,4 +10,4 @@
     data = data_from_mime(pkginfo)
     version = data.get('Version')
     if version != 'UNKNOWN':
-        return version
+        return meta(version)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/setuptools_scm-1.11.1/setuptools_scm/hg.py 
new/setuptools_scm-1.15.0/setuptools_scm/hg.py
--- old/setuptools_scm-1.11.1/setuptools_scm/hg.py      2016-06-12 
23:09:53.000000000 +0200
+++ new/setuptools_scm-1.15.0/setuptools_scm/hg.py      2016-10-20 
23:55:22.000000000 +0200
@@ -1,5 +1,5 @@
 import os
-from .utils import do, trace, data_from_mime
+from .utils import do, trace, data_from_mime, has_command
 from .version import meta, tags_to_versions
 
 FILES_COMMAND = 'hg locate -I .'
@@ -8,16 +8,23 @@
 def _hg_tagdist_normalize_tagcommit(root, tag, dist, node):
     dirty = node.endswith('+')
     node = node.strip('+')
-    st = do('hg st --no-status --change %s' % str(node), root)
-
-    trace('normalize', locals())
-    if int(dist) == 1 and st == '.hgtags' and not dirty:
-        return meta(tag)
+    revset = ("(branch(.) and tag({tag!r})::. and file('re:^(?!\.hgtags).*$')"
+              " - tag({tag!r}))").format(tag=tag)
+    if tag != '0.0':
+        commits = do(['hg', 'log', '-r', revset, '--template', '{node|short}'],
+                     root)
     else:
+        commits = True
+    trace('normalize', locals())
+    if commits or dirty:
         return meta(tag, distance=dist, node=node, dirty=dirty)
+    else:
+        return meta(tag)
 
 
 def parse(root):
+    if not has_command('hg'):
+        return
     l = do('hg id -i -t', root).split()
     node = l.pop(0)
     tags = tags_to_versions(l)
@@ -36,7 +43,9 @@
     out = do(cmd, root)
     try:
         # in merge state we assume parent 1 is fine
-        tag, dist = out.splitlines()[0].split()
+        tags, dist = out.splitlines()[0].split()
+        # pick latest tag from tag list
+        tag = tags.split(':')[-1]
         if tag == 'null':
             tag = '0.0'
             dist = int(dist) + 1
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/setuptools_scm-1.11.1/setuptools_scm/utils.py 
new/setuptools_scm-1.15.0/setuptools_scm/utils.py
--- old/setuptools_scm-1.11.1/setuptools_scm/utils.py   2016-06-12 
23:09:53.000000000 +0200
+++ new/setuptools_scm-1.15.0/setuptools_scm/utils.py   2016-10-20 
23:55:22.000000000 +0200
@@ -2,6 +2,7 @@
 utils
 """
 from __future__ import print_function, unicode_literals
+import warnings
 import sys
 import shlex
 import subprocess
@@ -41,17 +42,15 @@
     return env_dict
 
 
-def do_ex(cmd, cwd='.'):
-    trace('cmd', repr(cmd))
-    p = subprocess.Popen(
-        shlex.split(cmd),
+def _popen_pipes(cmd, cwd):
+
+    return subprocess.Popen(
+        cmd,
         stdout=subprocess.PIPE,
         stderr=subprocess.PIPE,
         cwd=str(cwd),
         env=_always_strings(dict(
             os.environ,
-            # disable hgrc processing other than .hg/hgrc
-            HGRCPATH='',
             # try to disable i18n
             LC_ALL='C',
             LANGUAGE='',
@@ -59,6 +58,13 @@
         ))
     )
 
+
+def do_ex(cmd, cwd='.'):
+    trace('cmd', repr(cmd))
+    if not isinstance(cmd, (list, tuple)):
+        cmd = shlex.split(cmd)
+
+    p = _popen_pipes(cmd, cwd)
     out, err = p.communicate()
     if out:
         trace('out', repr(out))
@@ -72,7 +78,6 @@
 def do(cmd, cwd='.'):
     out, err, ret = do_ex(cmd, cwd)
     if ret:
-        trace('ret', ret)
         print(err)
     return out
 
@@ -88,3 +93,17 @@
         if ': ' in x)
     trace('data', data)
     return data
+
+
+def has_command(name):
+    try:
+        p = _popen_pipes([name, 'help'], '.')
+    except OSError:
+        trace(*sys.exc_info())
+        res = False
+    else:
+        p.communicate()
+        res = not p.returncode
+    if not res:
+        warnings.warn("%r was not found" % name)
+    return res
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/setuptools_scm-1.11.1/setuptools_scm/version.py 
new/setuptools_scm-1.15.0/setuptools_scm/version.py
--- old/setuptools_scm-1.11.1/setuptools_scm/version.py 2016-06-12 
23:09:53.000000000 +0200
+++ new/setuptools_scm-1.15.0/setuptools_scm/version.py 2016-10-20 
23:55:22.000000000 +0200
@@ -106,7 +106,7 @@
 
 
 def get_local_node_and_date(version):
-    if version.exact:
+    if version.exact or version.node is None:
         return version.format_choice("", "+d{time:%Y%m%d}")
     else:
         return version.format_choice("+n{node}", "+n{node}.d{time:%Y%m%d}")
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/setuptools_scm-1.11.1/setuptools_scm.egg-info/PKG-INFO 
new/setuptools_scm-1.15.0/setuptools_scm.egg-info/PKG-INFO
--- old/setuptools_scm-1.11.1/setuptools_scm.egg-info/PKG-INFO  2016-06-12 
23:10:13.000000000 +0200
+++ new/setuptools_scm-1.15.0/setuptools_scm.egg-info/PKG-INFO  2016-10-20 
23:55:36.000000000 +0200
@@ -1,6 +1,6 @@
 Metadata-Version: 1.1
 Name: setuptools-scm
-Version: 1.11.1
+Version: 1.15.0
 Summary: the blessed package to manage your versions by scm tags
 Home-page: https://github.com/pypa/setuptools_scm/
 Author: Ronny Pfannschmidt
@@ -43,8 +43,8 @@
         Programmatic usage
         ------------------
         
-        In order to use setuptools_scm for sphinx config, assuming the sphinx 
conf
-        is one directory deeper than the project's root, use::
+        In order to use setuptools_scm from code
+        that one directory deeper than the project's root, you can use:
         
         .. code:: python
         
@@ -52,11 +52,28 @@
             version = get_version(root='..', relative_to=__file__)
         
         
+        Usage from sphinx
+        -----------------
+        
+        It is discouraged to use setuptools_scm from sphinx itself,
+        instead use ``pkg_resources`` after editable/real installation:
+        
+        .. code:: python
+        
+            from pkg_resources import get_distribution
+            release = pkg_resources('myproject').version
+            # for the example take major/minor
+            version = '.'.join(release.split('.')[:2])
+        
+        The underlying reason is, that services like readthedocs sometimes 
change
+        the workingdirectory for good reasons and using the installed metadata 
prevents
+        using needless volatile data there.
+        
         Notable Plugins
         ----------------
         
         `setuptools_scm_git_archive 
<https://pypi.python.org/pypi/setuptools_scm_git_archive>`_
-        provides partial support for obtaining versions from git archvies
+        provides partial support for obtaining versions from git archives
         that belong to tagged versions. The only reason for not including
         it in setuptools-scm itself is git/github not supporting
         sufficient metadata for untagged/followup commits,
@@ -247,10 +264,7 @@
             def myversion():
                 from setuptools_scm.version import dirty_tag
                 def clean_scheme(version):
-                    if not version.dirty:
-                        return '+clean'
-                    else:
-                        return dirty_tag(version)
+                    return dirty_tag(version) if version.dirty else '+clean'
         
                 return {'local_scheme': clean_scheme}
         
@@ -270,8 +284,12 @@
 Classifier: License :: OSI Approved :: MIT License
 Classifier: Programming Language :: Python
 Classifier: Programming Language :: Python :: 3
+Classifier: Programming Language :: Python :: 2.6
 Classifier: Programming Language :: Python :: 2.7
+Classifier: Programming Language :: Python :: 3.3
 Classifier: Programming Language :: Python :: 3.4
+Classifier: Programming Language :: Python :: 3.5
+Classifier: Programming Language :: Python :: 3.6
 Classifier: Topic :: Software Development :: Libraries
 Classifier: Topic :: Software Development :: Version Control
 Classifier: Topic :: System :: Software Distribution
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/setuptools_scm-1.11.1/setuptools_scm.egg-info/SOURCES.txt 
new/setuptools_scm-1.15.0/setuptools_scm.egg-info/SOURCES.txt
--- old/setuptools_scm-1.11.1/setuptools_scm.egg-info/SOURCES.txt       
2016-06-12 23:10:13.000000000 +0200
+++ new/setuptools_scm-1.15.0/setuptools_scm.egg-info/SOURCES.txt       
2016-10-20 23:55:36.000000000 +0200
@@ -5,6 +5,7 @@
 LICENSE
 README.rst
 appveyor.yml
+default.nix
 setup.cfg
 setup.py
 tox.ini
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/setuptools_scm-1.11.1/testing/conftest.py 
new/setuptools_scm-1.15.0/testing/conftest.py
--- old/setuptools_scm-1.11.1/testing/conftest.py       2016-06-12 
23:09:53.000000000 +0200
+++ new/setuptools_scm-1.15.0/testing/conftest.py       2016-10-20 
23:55:22.000000000 +0200
@@ -63,4 +63,4 @@
 
 @pytest.fixture
 def wd(tmpdir):
-    return Wd(tmpdir)
+    return Wd(tmpdir.ensure('wd', dir=True))
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/setuptools_scm-1.11.1/testing/test_basic_api.py 
new/setuptools_scm-1.15.0/testing/test_basic_api.py
--- old/setuptools_scm-1.11.1/testing/test_basic_api.py 2016-06-12 
23:09:53.000000000 +0200
+++ new/setuptools_scm-1.15.0/testing/test_basic_api.py 2016-10-20 
23:55:22.000000000 +0200
@@ -74,7 +74,9 @@
     ast.parse(content)
 
 
-def test_parse_plain():
+def test_parse_plain(recwarn):
     def parse(root):
         return 'tricked you'
     assert setuptools_scm.get_version(parse=parse) == 'tricked you'
+    assert str(recwarn.pop().message) == \
+        'version parse result was a string\nplease return a parsed version'
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/setuptools_scm-1.11.1/testing/test_functions.py 
new/setuptools_scm-1.15.0/testing/test_functions.py
--- old/setuptools_scm-1.11.1/testing/test_functions.py 2016-06-12 
23:09:53.000000000 +0200
+++ new/setuptools_scm-1.15.0/testing/test_functions.py 2016-10-20 
23:55:22.000000000 +0200
@@ -1,7 +1,8 @@
 import pytest
 import pkg_resources
-from setuptools_scm import dump_version
+from setuptools_scm import dump_version, get_version, PRETEND_KEY
 from setuptools_scm.version import guess_next_version, meta, format_version
+from setuptools_scm.utils import has_command
 
 
 class MockTime(object):
@@ -30,15 +31,15 @@
 
 @pytest.mark.parametrize('version,scheme,expected', [
     ('exact', 'guess-next-dev node-and-date', '1.1'),
-    ('zerodistance', 'guess-next-dev node-and-date', '1.2.dev0+nNone'),
-    ('dirty', 'guess-next-dev node-and-date', '1.2.dev0+nNone.dtime'),
-    ('distance', 'guess-next-dev node-and-date', '1.2.dev3+nNone'),
-    ('distancedirty', 'guess-next-dev node-and-date', '1.2.dev3+nNone.dtime'),
+    ('zerodistance', 'guess-next-dev node-and-date', '1.2.dev0'),
+    ('dirty', 'guess-next-dev node-and-date', '1.2.dev0+dtime'),
+    ('distance', 'guess-next-dev node-and-date', '1.2.dev3'),
+    ('distancedirty', 'guess-next-dev node-and-date', '1.2.dev3+dtime'),
     ('exact', 'post-release node-and-date', '1.1'),
-    ('zerodistance', 'post-release node-and-date', '1.1.post0+nNone'),
-    ('dirty', 'post-release node-and-date', '1.1.post0+nNone.dtime'),
-    ('distance', 'post-release node-and-date', '1.1.post3+nNone'),
-    ('distancedirty', 'post-release node-and-date', '1.1.post3+nNone.dtime'),
+    ('zerodistance', 'post-release node-and-date', '1.1.post0'),
+    ('dirty', 'post-release node-and-date', '1.1.post0+dtime'),
+    ('distance', 'post-release node-and-date', '1.1.post3'),
+    ('distancedirty', 'post-release node-and-date', '1.1.post3+dtime'),
 ])
 def test_format_version(version, monkeypatch, scheme, expected):
     version = VERSIONS[version]
@@ -52,7 +53,19 @@
 
 def test_dump_version_doesnt_bail_on_value_error(tmpdir):
     write_to = "VERSION"
-    version = VERSIONS['exact']
+    version = str(VERSIONS['exact'].tag)
     with pytest.raises(ValueError) as exc_info:
         dump_version(tmpdir.strpath, version, write_to)
     assert str(exc_info.value).startswith("bad file format:")
+
+
+def test_dump_version_works_with_pretend(tmpdir, monkeypatch):
+    monkeypatch.setenv(PRETEND_KEY, '1.0')
+    get_version(write_to=str(tmpdir.join('VERSION.txt')))
+    assert tmpdir.join('VERSION.txt').read() == '1.0'
+
+
+def test_has_command(recwarn):
+    assert not has_command('yadayada_setuptools_aint_ne')
+    msg = recwarn.pop()
+    assert 'yadayada' in str(msg.message)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/setuptools_scm-1.11.1/testing/test_git.py 
new/setuptools_scm-1.15.0/testing/test_git.py
--- old/setuptools_scm-1.11.1/testing/test_git.py       2016-06-12 
23:09:53.000000000 +0200
+++ new/setuptools_scm-1.15.0/testing/test_git.py       2016-10-20 
23:55:22.000000000 +0200
@@ -1,5 +1,8 @@
 from setuptools_scm import integration
+from setuptools_scm.utils import do
+from setuptools_scm import git
 import pytest
+from datetime import date
 
 
 @pytest.fixture
@@ -13,7 +16,7 @@
 
 
 def test_version_from_git(wd):
-    assert wd.version == '0.0'
+    assert wd.version == '0.1.dev0'
 
     wd.commit_testfile()
     assert wd.version.startswith('0.1.dev1+')
@@ -32,6 +35,57 @@
     assert wd.version.startswith('0.2')
 
 
[email protected](108)
[email protected](109)
+def test_git_worktree(wd):
+    wd.write('test.txt', 'test2')
+    # untracked files dont change the state
+    assert wd.version == '0.1.dev0'
+    wd('git add test.txt')
+    assert wd.version.startswith('0.1.dev0+d')
+
+
[email protected](86)
+def test_git_dirty_notag(wd):
+    wd.commit_testfile()
+    wd.write('test.txt', 'test2')
+    wd("git add test.txt")
+    assert wd.version.startswith('0.1.dev1')
+    today = date.today()
+    # we are dirty, check for the tag
+    assert today.strftime('.d%Y%m%d') in wd.version
+
+
[email protected]
+def shallow_wd(wd, tmpdir):
+    wd.commit_testfile()
+    wd.commit_testfile()
+    wd.commit_testfile()
+    target = tmpdir.join('wd_shallow')
+    do(['git', 'clone', "file://%s" % wd.cwd, str(target,), '--depth=1'])
+    return target
+
+
+def test_git_parse_shallow_warns(shallow_wd, recwarn):
+    git.parse(str(shallow_wd))
+    msg = recwarn.pop()
+    assert 'is shallow and may cause errors' in str(msg.message)
+
+
+def test_git_parse_shallow_fail(shallow_wd):
+    with pytest.raises(ValueError) as einfo:
+        git.parse(str(shallow_wd), pre_parse=git.fail_on_shallow)
+
+    assert 'git fetch' in str(einfo.value)
+
+
+def test_git_shallow_autocorrect(shallow_wd, recwarn):
+    git.parse(str(shallow_wd), pre_parse=git.fetch_on_shallow)
+    msg = recwarn.pop()
+    assert 'git fetch was used to rectify' in str(msg.message)
+    git.parse(str(shallow_wd), pre_parse=git.fail_on_shallow)
+
+
 def test_find_files_stop_at_root_git(wd):
     wd.commit_testfile()
     wd.cwd.ensure('project/setup.cfg')
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/setuptools_scm-1.11.1/testing/test_mercurial.py 
new/setuptools_scm-1.15.0/testing/test_mercurial.py
--- old/setuptools_scm-1.11.1/testing/test_mercurial.py 2016-06-12 
23:09:53.000000000 +0200
+++ new/setuptools_scm-1.15.0/testing/test_mercurial.py 2016-10-20 
23:55:22.000000000 +0200
@@ -65,6 +65,12 @@
     wd.commit_testfile()
     assert wd.version.startswith('0.2.dev1+')
 
+    # several tags
+    wd('hg up')
+    wd('hg tag v0.2 -u test -d "0 0"')
+    wd('hg tag v0.3 -u test -d "0 0" -r v0.2')
+    assert wd.version == '0.3'
+
 
 def test_version_from_archival(wd):
     # entrypoints are unordered,
@@ -93,5 +99,5 @@
     wd.commit_testfile()
     wd('hg up 0')
     wd.commit_testfile()
-    wd('hg merge')
+    wd('hg merge --tool :merge')
     assert wd.version is not None


Reply via email to