Hello community,

here is the log from the commit of package python-setuptools_scm for 
openSUSE:Factory checked in at 2016-01-23 01:15:08
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
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  
    2015-11-12 19:37:31.000000000 +0100
+++ 
/work/SRC/openSUSE:Factory/.python-setuptools_scm.new/python-setuptools_scm.changes
 2016-01-23 01:15:34.000000000 +0100
@@ -1,0 +2,23 @@
+Tue Jan 12 17:07:35 UTC 2016 - mich...@stroeder.com
+
+- Update to 1.10.1:
+
+v1.10.1
+* fix issue #73 - in hg pre commit merge, consider parent1 instead of failing
+
+v1.10.0
+* add support for overriding the version number via the 
+  environment variable SETUPTOOLS_SCM_PRETEND_VERSION
+* fix isssue #63 by adding the --match parameter to the git describe call
+  and prepare the possibility of passing more options to scm backends
+* fix issue #70 and #71 by introducing the parse keyword
+  to specify custom scm parsing, its an expert feature,
+  use with caution
+  this change also introduces the setuptools_scm.parse_scm_fallback
+  entrypoint which can be used to register custom archive fallbacks
+
+v1.9.0
+* Add :code:`relative_to` parameter to :code:`get_version` function;
+  fixes #44 per #45.
+
+-------------------------------------------------------------------

Old:
----
  setuptools_scm-1.8.0.tar.bz2

New:
----
  setuptools_scm-1.10.1.tar.bz2

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

Other differences:
------------------
++++++ python-setuptools_scm.spec ++++++
--- /var/tmp/diff_new_pack.kvVxai/_old  2016-01-23 01:15:35.000000000 +0100
+++ /var/tmp/diff_new_pack.kvVxai/_new  2016-01-23 01:15:35.000000000 +0100
@@ -17,7 +17,7 @@
 
 
 Name:           python-setuptools_scm
-Version:        1.8.0
+Version:        1.10.1
 Release:        0
 Summary:        Manage your versions by scm tags
 License:        MIT

++++++ setuptools_scm-1.8.0.tar.bz2 -> setuptools_scm-1.10.1.tar.bz2 ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/setuptools_scm-1.8.0/.hgtags 
new/setuptools_scm-1.10.1/.hgtags
--- old/setuptools_scm-1.8.0/.hgtags    1970-01-01 01:00:00.000000000 +0100
+++ new/setuptools_scm-1.10.1/.hgtags   2015-11-28 14:49:00.000000000 +0100
@@ -0,0 +1 @@
+1092123ef78598eade56aa9c57e484f3670c8da8 v1.9.0
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/setuptools_scm-1.8.0/CHANGELOG.rst 
new/setuptools_scm-1.10.1/CHANGELOG.rst
--- old/setuptools_scm-1.8.0/CHANGELOG.rst      2015-09-17 22:48:24.000000000 
+0200
+++ new/setuptools_scm-1.10.1/CHANGELOG.rst     2015-12-10 21:58:57.000000000 
+0100
@@ -1,4 +1,30 @@
+v1.10.1
+=======
 
+* fix issue #73 - in hg pre commit merge, consider parent1 instead of failing
+
+v1.10.0
+=======
+
+* add support for overriding the version number via the 
+  environment variable SETUPTOOLS_SCM_PRETEND_VERSION
+
+* fix isssue #63 by adding the --match parameter to the git describe call
+  and prepare the possibility of passing more options to scm backends
+
+* fix issue #70 and #71 by introducing the parse keyword
+  to specify custom scm parsing, its an expert feature,
+  use with caution
+
+  this change also introduces the setuptools_scm.parse_scm_fallback
+  entrypoint which can be used to register custom archive fallbacks
+
+
+v1.9.0
+======
+
+* Add :code:`relative_to` parameter to :code:`get_version` function;
+  fixes #44 per #45.
 
 v1.8.0
 ======
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/setuptools_scm-1.8.0/PKG-INFO 
new/setuptools_scm-1.10.1/PKG-INFO
--- old/setuptools_scm-1.8.0/PKG-INFO   2015-09-17 23:00:09.000000000 +0200
+++ new/setuptools_scm-1.10.1/PKG-INFO  2015-12-10 22:04:05.000000000 +0100
@@ -1,6 +1,6 @@
 Metadata-Version: 1.1
 Name: setuptools_scm
-Version: 1.8.0
+Version: 1.10.1
 Summary: the blessed package to manage your versions by scm tags
 Home-page: https://github.com/pypa/setuptools_scm/
 Author: Ronny Pfannschmidt
@@ -13,7 +13,7 @@
         in scm metadata instead of declaring them as the version argument
         or in a scm managed file.
         
-        It also handles file finders for the supperted scm's.
+        It also handles file finders for the supported scm's.
         
         .. image:: https://travis-ci.org/pypa/setuptools_scm.svg?branch=master
             :target: https://travis-ci.org/pypa/setuptools_scm
@@ -51,6 +51,17 @@
             version = get_version()
         
         
+        Notable Plugins
+        ----------------
+        
+        `setuptools_scm_git_archive 
<https://pypi.python.org/pypi/setuptools_scm_git_archive>`_
+        provides partial support for obtaining versions from git archvies
+        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,
+        which is preventing a consistent UX.
+        
+        
         Default versioning scheme
         --------------------------
         
@@ -134,6 +145,18 @@
             a newstyle format string thats given the current version as
             the :code:`version` keyword argument for formatting
         
+        :relative_to:
+            a file from which root may be resolved. typically called by a
+            script or module that is not
+            in the root of the repository to direct setuptools_scm to the
+            root of the repository by supplying ``__file__``.
+        
+        :parse:
+          a function that will be used instead of the discovered scm for 
parsing the version,
+          use with caution, this is a expert function and you should be 
closely familiar
+          with the setuptools_scm internals to use it
+        
+        
         To use setuptools_scm in other Python code you can use the
         ``get_version`` function:
         
@@ -146,6 +169,15 @@
         keyword arguments.
         
         
+        Environment Variables
+        ---------------------
+        
+        :SETUPTOOLS_SCM_PRETEND_VERSION:
+          when defined and not empty,
+          its used as the primary source for the version number
+          in which case it will be a unparsed string
+        
+        
         Extending setuptools_scm
         ------------------------
         
@@ -205,7 +237,7 @@
         To support usage in :code:`setup.py` passing a callable into 
use_scm_version
         is supported.
         
-        Within that callable, setuptools_scm is availiable for import.
+        Within that callable, setuptools_scm is available for import.
         The callable must return the configuration.
         
         
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/setuptools_scm-1.8.0/README.rst 
new/setuptools_scm-1.10.1/README.rst
--- old/setuptools_scm-1.8.0/README.rst 2015-09-17 22:49:11.000000000 +0200
+++ new/setuptools_scm-1.10.1/README.rst        2015-12-07 21:45:49.000000000 
+0100
@@ -5,7 +5,7 @@
 in scm metadata instead of declaring them as the version argument
 or in a scm managed file.
 
-It also handles file finders for the supperted scm's.
+It also handles file finders for the supported scm's.
 
 .. image:: https://travis-ci.org/pypa/setuptools_scm.svg?branch=master
     :target: https://travis-ci.org/pypa/setuptools_scm
@@ -43,6 +43,17 @@
     version = get_version()
 
 
+Notable Plugins
+----------------
+
+`setuptools_scm_git_archive 
<https://pypi.python.org/pypi/setuptools_scm_git_archive>`_
+provides partial support for obtaining versions from git archvies
+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,
+which is preventing a consistent UX.
+
+
 Default versioning scheme
 --------------------------
 
@@ -126,6 +137,18 @@
     a newstyle format string thats given the current version as
     the :code:`version` keyword argument for formatting
 
+:relative_to:
+    a file from which root may be resolved. typically called by a
+    script or module that is not
+    in the root of the repository to direct setuptools_scm to the
+    root of the repository by supplying ``__file__``.
+
+:parse:
+  a function that will be used instead of the discovered scm for parsing the 
version,
+  use with caution, this is a expert function and you should be closely 
familiar
+  with the setuptools_scm internals to use it
+
+
 To use setuptools_scm in other Python code you can use the
 ``get_version`` function:
 
@@ -138,6 +161,15 @@
 keyword arguments.
 
 
+Environment Variables
+---------------------
+
+:SETUPTOOLS_SCM_PRETEND_VERSION:
+  when defined and not empty,
+  its used as the primary source for the version number
+  in which case it will be a unparsed string
+
+
 Extending setuptools_scm
 ------------------------
 
@@ -197,7 +229,7 @@
 To support usage in :code:`setup.py` passing a callable into use_scm_version
 is supported.
 
-Within that callable, setuptools_scm is availiable for import.
+Within that callable, setuptools_scm is available for import.
 The callable must return the configuration.
 
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/setuptools_scm-1.8.0/setup.cfg 
new/setuptools_scm-1.10.1/setup.cfg
--- old/setuptools_scm-1.8.0/setup.cfg  2015-09-17 23:00:09.000000000 +0200
+++ new/setuptools_scm-1.10.1/setup.cfg 2015-12-10 22:04:05.000000000 +0100
@@ -4,8 +4,11 @@
 [devpi:upload]
 formats = sdist,bdist_wheel
 
+[aliases]
+release = sdist bdist_wheel upload
+
 [egg_info]
-tag_date = 0
 tag_build = 
+tag_date = 0
 tag_svn_revision = 0
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/setuptools_scm-1.8.0/setup.py 
new/setuptools_scm-1.10.1/setup.py
--- old/setuptools_scm-1.8.0/setup.py   2015-09-17 23:00:09.000000000 +0200
+++ new/setuptools_scm-1.10.1/setup.py  2015-12-10 22:04:05.000000000 +0100
@@ -63,7 +63,7 @@
     url='https://github.com/pypa/setuptools_scm/',
     zip_safe=True,
     # pass here since entrypints are not yet registred
-    version="1.8.0",
+    version="1.10.1",
     author='Ronny Pfannschmidt',
     author_email='opensou...@ronnypfannschmidt.de',
     description=('the blessed package to manage your versions by scm tags'),
@@ -82,6 +82,12 @@
         [setuptools_scm.parse_scm]
         .hg = setuptools_scm.hg:parse
         .git = setuptools_scm.git:parse
+
+        # those are left here for backward compatibility in the 1.x series
+        .hg_archival.txt = setuptools_scm.hg:parse_archival
+        PKG-INFO = setuptools_scm.hacks:parse_pkginfo
+
+        [setuptools_scm.parse_scm_fallback]
         .hg_archival.txt = setuptools_scm.hg:parse_archival
         PKG-INFO = setuptools_scm.hacks:parse_pkginfo
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/setuptools_scm-1.8.0/setuptools_scm/__init__.py 
new/setuptools_scm-1.10.1/setuptools_scm/__init__.py
--- old/setuptools_scm-1.8.0/setuptools_scm/__init__.py 2015-09-17 
22:43:47.000000000 +0200
+++ new/setuptools_scm-1.10.1/setuptools_scm/__init__.py        2015-12-07 
21:24:21.000000000 +0100
@@ -9,6 +9,9 @@
 from .version import format_version
 from .discover import find_matching_entrypoint
 
+PRETEND_KEY = 'SETUPTOOLS_SCM_PRETEND_VERSION'
+
+
 TEMPLATES = {
     '.py': """\
 # coding: utf-8
@@ -24,16 +27,13 @@
 
 
 def version_from_scm(root):
-    ep = find_matching_entrypoint(root, 'setuptools_scm.parse_scm')
+    return _version_from_entrypoint(root, 'setuptools_scm.parse_scm')
+
+
+def _version_from_entrypoint(root, entrypoint):
+    ep = find_matching_entrypoint(root, entrypoint)
     if ep:
         return ep.load()(root)
-    raise LookupError(
-        "setuptools-scm was unable to detect version for %r.\n\n"
-        "Make sure you're not using GitHub's tarballs (or similar ones), as "
-        "those don't contain the necessary metadata. Use PyPI's tarballs "
-        "instead.\n\nFor example, if you're using pip, instead of "
-        "https://github.com/user/proj/archive/master.zip "
-        "use git+https://github.com/user/proj.git#egg=proj"; % root)
 
 
 def dump_version(root, version, write_to, template=None):
@@ -56,15 +56,50 @@
         fp.write(dump)
 
 
+def _do_parse(root, parse):
+    pretended = os.environ.get(PRETEND_KEY)
+    if pretended:
+        return pretended
+
+    if parse:
+        version = parse(root) or _version_from_entrypoint(
+            root, 'setuptools_scm.parse_scm_fallback')
+    else:
+        # include fallbacks after dropping them from the main entrypoint
+        version = version_from_scm(root)
+
+    if version:
+        return version
+
+    raise LookupError(
+        "setuptools-scm was unable to detect version for %r.\n\n"
+        "Make sure you're not using GitHub's tarballs (or similar ones), as "
+        "those don't contain the necessary metadata. Use PyPI's tarballs "
+        "instead.\n\nFor example, if you're using pip, instead of "
+        "https://github.com/user/proj/archive/master.zip "
+        "use git+https://github.com/user/proj.git#egg=proj"; % root)
+
+
 def get_version(root='.',
                 version_scheme='guess-next-dev',
                 local_scheme='node-and-date',
                 write_to=None,
-                write_to_template=None):
+                write_to_template=None,
+                relative_to=None,
+                parse=None,
+                ):
+    """
+    If supplied, relative_to should be a file from which root may
+    be resolved. Typically called by a script or module that is not
+    in the root of the repository to direct setuptools_scm to the
+    root of the repository by supplying ``__file__``.
+    """
+    if relative_to:
+        root = os.path.join(os.path.dirname(relative_to), root)
     root = os.path.abspath(root)
     trace('root', repr(root))
 
-    version = version_from_scm(root)
+    version = _do_parse(root, parse)
 
     if version:
         if isinstance(version, string_types):
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/setuptools_scm-1.8.0/setuptools_scm/__main__.py 
new/setuptools_scm-1.10.1/setuptools_scm/__main__.py
--- old/setuptools_scm-1.8.0/setuptools_scm/__main__.py 2015-06-14 
08:39:53.000000000 +0200
+++ new/setuptools_scm-1.10.1/setuptools_scm/__main__.py        2015-11-28 
14:49:00.000000000 +0100
@@ -1,7 +1,8 @@
 from __future__ import print_function
 import sys
-from setuptools_scm import get_version, find_files, \
-    _warn_if_setuptools_outdated
+from setuptools_scm import get_version
+from setuptools_scm.integration import find_files
+from setuptools_scm.version import _warn_if_setuptools_outdated
 
 if __name__ == '__main__':
     _warn_if_setuptools_outdated()
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/setuptools_scm-1.8.0/setuptools_scm/git.py 
new/setuptools_scm-1.10.1/setuptools_scm/git.py
--- old/setuptools_scm-1.8.0/setuptools_scm/git.py      2015-09-17 
22:46:32.000000000 +0200
+++ new/setuptools_scm-1.10.1/setuptools_scm/git.py     2015-12-07 
18:44:51.000000000 +0100
@@ -4,10 +4,13 @@
 
 
 FILES_COMMAND = 'git ls-files'
+DEFAULT_DESCRIBE = 'git describe --dirty --tags --long --match *.*'
 
 
-def parse(root):
+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 abspath(realpath(real_root)) != abspath(realpath(root)):
         return
@@ -15,7 +18,7 @@
     if ret:
         return meta('0.0')
     rev_node = rev_node[:7]
-    out, err, ret = do_ex('git describe --dirty --tags --long', root)
+    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')
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/setuptools_scm-1.8.0/setuptools_scm/hg.py 
new/setuptools_scm-1.10.1/setuptools_scm/hg.py
--- old/setuptools_scm-1.8.0/setuptools_scm/hg.py       2015-09-17 
22:46:32.000000000 +0200
+++ new/setuptools_scm-1.10.1/setuptools_scm/hg.py      2015-12-10 
21:57:24.000000000 +0100
@@ -31,10 +31,12 @@
         trace('initial node', root)
         return meta('0.0', dirty=dirty)
 
-    cmd = 'hg parents --template "{latesttag} {latesttagdistance}"'
+    # the newline is needed for merge stae, see issue 72
+    cmd = 'hg parents --template "{latesttag} {latesttagdistance}\n"'
     out = do(cmd, root)
     try:
-        tag, dist = out.split()
+        # in merge state we assume parent 1 is fine
+        tag, dist = out.splitlines()[0].split()
         if tag == 'null':
             tag = '0.0'
             dist = int(dist) + 1
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/setuptools_scm-1.8.0/setuptools_scm/version.py 
new/setuptools_scm-1.10.1/setuptools_scm/version.py
--- old/setuptools_scm-1.8.0/setuptools_scm/version.py  2015-09-17 
22:46:32.000000000 +0200
+++ new/setuptools_scm-1.10.1/setuptools_scm/version.py 2015-11-28 
20:33:43.000000000 +0100
@@ -22,8 +22,8 @@
 def callable_or_entrypoint(group, callable_or_name):
     trace('ep', (group, callable_or_name))
     if isinstance(callable_or_name, str):
-        ep = next(iter_entry_points(group, callable_or_name))
-        return ep.load()
+        for ep in iter_entry_points(group, callable_or_name):
+            return ep.load()
     else:
         return callable_or_name
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/setuptools_scm-1.8.0/setuptools_scm.egg-info/PKG-INFO 
new/setuptools_scm-1.10.1/setuptools_scm.egg-info/PKG-INFO
--- old/setuptools_scm-1.8.0/setuptools_scm.egg-info/PKG-INFO   2015-09-17 
23:00:09.000000000 +0200
+++ new/setuptools_scm-1.10.1/setuptools_scm.egg-info/PKG-INFO  2015-12-10 
22:04:05.000000000 +0100
@@ -1,6 +1,6 @@
 Metadata-Version: 1.1
 Name: setuptools-scm
-Version: 1.8.0
+Version: 1.10.1
 Summary: the blessed package to manage your versions by scm tags
 Home-page: https://github.com/pypa/setuptools_scm/
 Author: Ronny Pfannschmidt
@@ -13,7 +13,7 @@
         in scm metadata instead of declaring them as the version argument
         or in a scm managed file.
         
-        It also handles file finders for the supperted scm's.
+        It also handles file finders for the supported scm's.
         
         .. image:: https://travis-ci.org/pypa/setuptools_scm.svg?branch=master
             :target: https://travis-ci.org/pypa/setuptools_scm
@@ -51,6 +51,17 @@
             version = get_version()
         
         
+        Notable Plugins
+        ----------------
+        
+        `setuptools_scm_git_archive 
<https://pypi.python.org/pypi/setuptools_scm_git_archive>`_
+        provides partial support for obtaining versions from git archvies
+        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,
+        which is preventing a consistent UX.
+        
+        
         Default versioning scheme
         --------------------------
         
@@ -134,6 +145,18 @@
             a newstyle format string thats given the current version as
             the :code:`version` keyword argument for formatting
         
+        :relative_to:
+            a file from which root may be resolved. typically called by a
+            script or module that is not
+            in the root of the repository to direct setuptools_scm to the
+            root of the repository by supplying ``__file__``.
+        
+        :parse:
+          a function that will be used instead of the discovered scm for 
parsing the version,
+          use with caution, this is a expert function and you should be 
closely familiar
+          with the setuptools_scm internals to use it
+        
+        
         To use setuptools_scm in other Python code you can use the
         ``get_version`` function:
         
@@ -146,6 +169,15 @@
         keyword arguments.
         
         
+        Environment Variables
+        ---------------------
+        
+        :SETUPTOOLS_SCM_PRETEND_VERSION:
+          when defined and not empty,
+          its used as the primary source for the version number
+          in which case it will be a unparsed string
+        
+        
         Extending setuptools_scm
         ------------------------
         
@@ -205,7 +237,7 @@
         To support usage in :code:`setup.py` passing a callable into 
use_scm_version
         is supported.
         
-        Within that callable, setuptools_scm is availiable for import.
+        Within that callable, setuptools_scm is available for import.
         The callable must return the configuration.
         
         
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/setuptools_scm-1.8.0/setuptools_scm.egg-info/SOURCES.txt 
new/setuptools_scm-1.10.1/setuptools_scm.egg-info/SOURCES.txt
--- old/setuptools_scm-1.8.0/setuptools_scm.egg-info/SOURCES.txt        
2015-09-17 23:00:09.000000000 +0200
+++ new/setuptools_scm-1.10.1/setuptools_scm.egg-info/SOURCES.txt       
2015-12-10 22:04:05.000000000 +0100
@@ -1,4 +1,5 @@
 .gitignore
+.hgtags
 .travis.yml
 CHANGELOG.rst
 LICENSE
@@ -25,4 +26,7 @@
 testing/conftest.py
 testing/test_basic_api.py
 testing/test_functions.py
+testing/test_git.py
+testing/test_main.py
+testing/test_mercurial.py
 testing/test_regressions.py
\ No newline at end of file
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/setuptools_scm-1.8.0/setuptools_scm.egg-info/entry_points.txt 
new/setuptools_scm-1.10.1/setuptools_scm.egg-info/entry_points.txt
--- old/setuptools_scm-1.8.0/setuptools_scm.egg-info/entry_points.txt   
2015-09-17 23:00:09.000000000 +0200
+++ new/setuptools_scm-1.10.1/setuptools_scm.egg-info/entry_points.txt  
2015-12-10 22:04:05.000000000 +0100
@@ -8,6 +8,12 @@
         [setuptools_scm.parse_scm]
         .hg = setuptools_scm.hg:parse
         .git = setuptools_scm.git:parse
+
+        # those are left here for backward compatibility in the 1.x series
+        .hg_archival.txt = setuptools_scm.hg:parse_archival
+        PKG-INFO = setuptools_scm.hacks:parse_pkginfo
+
+        [setuptools_scm.parse_scm_fallback]
         .hg_archival.txt = setuptools_scm.hg:parse_archival
         PKG-INFO = setuptools_scm.hacks:parse_pkginfo
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/setuptools_scm-1.8.0/testing/conftest.py 
new/setuptools_scm-1.10.1/testing/conftest.py
--- old/setuptools_scm-1.8.0/testing/conftest.py        2015-06-20 
16:02:46.000000000 +0200
+++ new/setuptools_scm-1.10.1/testing/conftest.py       2015-11-29 
17:37:41.000000000 +0100
@@ -1,4 +1,7 @@
 import os
+import itertools
+import pytest
+
 os.environ['SETUPTOOLS_SCM_DEBUG'] = '1'
 VERSION_PKGS = ['setuptools', 'setuptools_scm']
 
@@ -10,3 +13,54 @@
         version = pkg_resources.get_distribution(pkg).version
         res.append('%s version %s' % (pkg, version))
     return res
+
+
+class Wd(object):
+    commit_command = None
+    add_command = None
+
+    def __init__(self, cwd):
+        self.cwd = cwd
+        self.__counter = itertools.count()
+
+    def __call__(self, cmd, **kw):
+        if kw:
+            cmd = cmd.format(**kw)
+        from setuptools_scm.utils import do
+        return do(cmd, self.cwd)
+
+    def write(self, name, value, **kw):
+        filename = self.cwd.join(name)
+        if kw:
+            value = value.format(**kw)
+        filename.write(value)
+        return filename
+
+    def _reason(self, given_reason):
+        if given_reason is None:
+            return 'number-{c}'.format(c=next(self.__counter))
+        else:
+            return given_reason
+
+    def commit(self, reason=None):
+        reason = self._reason(reason)
+        self(self.commit_command, reason=reason)
+
+    def commit_testfile(self, reason=None):
+        reason = self._reason(reason)
+        self.write('test.txt', 'test {reason}', reason=reason)
+        self(self.add_command)
+        self.commit(reason=reason)
+
+    @property
+    def version(self):
+        __tracebackhide__ = True
+        from setuptools_scm import get_version
+        version = get_version(root=str(self.cwd))
+        print(version)
+        return version
+
+
+@pytest.fixture
+def wd(tmpdir):
+    return Wd(tmpdir)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/setuptools_scm-1.8.0/testing/test_basic_api.py 
new/setuptools_scm-1.10.1/testing/test_basic_api.py
--- old/setuptools_scm-1.8.0/testing/test_basic_api.py  2015-09-17 
22:46:32.000000000 +0200
+++ new/setuptools_scm-1.10.1/testing/test_basic_api.py 2015-12-07 
19:00:11.000000000 +0100
@@ -3,22 +3,9 @@
 import pytest
 
 import setuptools_scm
-from setuptools_scm import format_version
-from setuptools_scm import integration
 from setuptools_scm import dump_version
 
-
 from setuptools_scm.utils import data_from_mime, do
-from setuptools_scm.hg import archival_to_version
-
-
-def get_version(root, method='get_version', __tracebackhide__=False, **kw):
-    call = getattr(setuptools_scm, method)
-    data = call(root=root.strpath, **kw)
-    if isinstance(data, dict):
-        return format_version(data)
-    else:
-        return data
 
 
 @pytest.mark.parametrize('cmd', ['ls', 'dir'])
@@ -28,35 +15,9 @@
     do(cmd, str(tmpdir))
 
 
-class Wd(object):
-    def __init__(self, cwd):
-        self.cwd = cwd
-
-    def __call__(self, cmd):
-        return do(cmd, self.cwd)
-
-    def write(self, name, value):
-        filename = self.cwd.join(name)
-        filename.write(value)
-        return filename
-
-    @property
-    def version(self):
-        __tracebackhide__ = True
-        version = get_version(self.cwd, __tracebackhide__=True)
-        print(version)
-        return version
-
-
-@pytest.fixture
-def wd(tmpdir):
-    return Wd(tmpdir)
-
-
-def test_data_from_mime(wd):
-    tmpfile = wd.write(
-        'test.archival',
-        'name: test\nrevision: 1')
+def test_data_from_mime(tmpdir):
+    tmpfile = tmpdir.join('test.archival')
+    tmpfile.write('name: test\nrevision: 1')
 
     res = data_from_mime(str(tmpfile))
     assert res == {
@@ -65,135 +26,40 @@
     }
 
 
-archival_mapping = {
-    '1.0': {'tag': '1.0'},
-    '1.1.dev3+n000000000000': {
-        'latesttag': '1.0',
-        'latesttagdistance': '3',
-        'node': '0'*20,
-    },
-    '0.0': {
-        'node': '0'*20,
-    },
-    '1.2.2': {'tag': 'release-1.2.2'},
-    '1.2.2.dev0': {'tag': 'release-1.2.2.dev'},
-
-}
-
-
-@pytest.mark.parametrize('expected,data', sorted(archival_mapping.items()))
-def test_archival_to_version(expected, data):
-    version = archival_to_version(data)
-    assert format_version(
-        version,
-        version_scheme='guess-next-dev',
-        local_scheme='node-and-date') == expected
-
-
-def test_version_from_git(wd):
-    wd('git init')
-    wd('git config user.email t...@example.com')
-    wd('git config user.name "a test"')
-    assert wd.version == '0.0'
-    wd.write('test.txt', 'test')
-    wd('git add test.txt')
-    wd('git commit -m commit')
-
-    assert wd.version.startswith('0.1.dev1+')
-    assert not wd.version.endswith('1-')
-
-    wd('git tag v0.1')
-    assert wd.version == '0.1'
-
-    wd.write('test.txt', 'test2')
-    assert wd.version.startswith('0.2.dev0+')
-    wd('git add test.txt')
-    wd('git commit -m commit')
-    assert wd.version.startswith('0.2.dev1+')
-    wd('git tag version-0.2')
-    assert wd.version.startswith('0.2')
-
-
-# XXX: better tests for tag prefixes
-def test_version_from_hg_id(wd):
-    wd('hg init')
-    assert wd.version == '0.0'
-    wd.write('test.txt', 'test')
-    wd('hg add test.txt')
-    wd('hg commit -m commit -u test -d "0 0"')
-
-    assert wd.version.startswith('0.1.dev2+')
-
-    # tagging commit is considered the tag
-    wd('hg tag v0.1 -u test -d "0 0"')
+def test_version_from_pkginfo(wd):
+    wd.write('PKG-INFO', 'Version: 0.1')
     assert wd.version == '0.1'
-    wd.write('test.txt', 'test2')
-
-    wd('hg commit -m commit2 -u test -d "0 0"')
 
-    assert wd.version.startswith('0.2.dev2')
-
-    wd('hg up v0.1')
-    assert wd.version == '0.1'
 
-    # commit originating from the taged revision
-    # that is not a actual tag
-    wd.write('test.txt', 'test2')
-    wd('hg commit -m commit3 -u test -d "0 0"')
-    assert wd.version.startswith('0.2.dev1+')
-
-
-def test_version_from_archival(tmpdir):
-    tmpdir.join('.hg_archival.txt').write(
-        'node: 000000000000\n'
-        'tag: 0.1\n'
-    )
-    assert get_version(tmpdir) == '0.1'
-
-    tmpdir.join('.hg_archival.txt').write(
-        'node: 000000000000\n'
-        'latesttag: 0.1\n'
-        'latesttagdistance: 3\n'
-    )
-
-    assert get_version(tmpdir) == '0.2.dev3+n000000000000'
-
-
-def test_version_from_pkginfo(tmpdir):
-    tmpdir.join('PKG-INFO').write('Version: 0.1')
-    assert get_version(tmpdir) == '0.1'
+def assert_root(monkeypatch, expected_root):
+    """
+    Patch version_from_scm to simply assert that root is expected root
+    """
+    def assertion(root, unused_parse):
+        assert root == expected_root
+    monkeypatch.setattr(setuptools_scm, '_do_parse', assertion)
 
 
 def test_root_parameter_creation(monkeypatch):
-    def assert_cwd(root, cache_file=None):
-        assert root == os.getcwd()
-    monkeypatch.setattr(setuptools_scm, 'version_from_scm', assert_cwd)
+    assert_root(monkeypatch, os.getcwd())
     setuptools_scm.get_version()
 
 
 def test_root_parameter_pass_by(monkeypatch):
-    def assert_root_tmp(root):
-        assert root == os.path.abspath('/tmp')
-    monkeypatch.setattr(setuptools_scm, 'version_from_scm', assert_root_tmp)
+    assert_root(monkeypatch, '/tmp')
     setuptools_scm.get_version(root='/tmp')
 
 
-def test_find_files_stop_at_root_hg(wd):
-    wd('hg init')
-    wd.write('test.txt', 'test')
-    wd('hg add .')
-    wd('hg commit -m test -u test')
-    wd.cwd.ensure('project/setup.cfg')
-    assert integration  .find_files(str(wd.cwd/'project')) == []
-
-
-def test_find_files_stop_at_root_git(wd):
-    wd('git init')
-    wd.write('test.txt', 'test')
-    wd('git add .')
-    wd('git commit -m test -u test')
-    wd.cwd.ensure('project/setup.cfg')
-    assert integration.find_files(str(wd.cwd/'project')) == []
+def test_pretended(monkeypatch):
+    pretense = '2345'
+    monkeypatch.setenv(setuptools_scm.PRETEND_KEY, pretense)
+    assert setuptools_scm.get_version() == pretense
+
+
+def test_root_relative_to(monkeypatch):
+    assert_root(monkeypatch, '/tmp/alt')
+    __file__ = '/tmp/module/file.py'
+    setuptools_scm.get_version(root='../alt', relative_to=__file__)
 
 
 def test_dump_version(tmpdir):
@@ -206,3 +72,9 @@
     assert repr('1.0') in content
     import ast
     ast.parse(content)
+
+
+def test_parse_plain():
+    def parse(root):
+        return 'tricked you'
+    assert setuptools_scm.get_version(parse=parse) == 'tricked you'
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/setuptools_scm-1.8.0/testing/test_git.py 
new/setuptools_scm-1.10.1/testing/test_git.py
--- old/setuptools_scm-1.8.0/testing/test_git.py        1970-01-01 
01:00:00.000000000 +0100
+++ new/setuptools_scm-1.10.1/testing/test_git.py       2015-11-29 
17:38:10.000000000 +0100
@@ -0,0 +1,44 @@
+from setuptools_scm import integration
+import pytest
+
+
+@pytest.fixture
+def wd(wd):
+    wd('git init')
+    wd('git config user.email t...@example.com')
+    wd('git config user.name "a test"')
+    wd.add_command = 'git add .'
+    wd.commit_command = 'git commit -m test-{reason}'
+    return wd
+
+
+def test_version_from_git(wd):
+    assert wd.version == '0.0'
+
+    wd.commit_testfile()
+    assert wd.version.startswith('0.1.dev1+')
+    assert not wd.version.endswith('1-')
+
+    wd('git tag v0.1')
+    assert wd.version == '0.1'
+
+    wd.write('test.txt', 'test2')
+    assert wd.version.startswith('0.2.dev0+')
+
+    wd.commit_testfile()
+    assert wd.version.startswith('0.2.dev1+')
+
+    wd('git tag version-0.2')
+    assert wd.version.startswith('0.2')
+
+
+def test_find_files_stop_at_root_git(wd):
+    wd.commit_testfile()
+    wd.cwd.ensure('project/setup.cfg')
+    assert integration.find_files(str(wd.cwd/'project')) == []
+
+
+def test_alphanumeric_tags_match(wd):
+    wd.commit_testfile()
+    wd('git tag newstyle-development-started')
+    assert wd.version.startswith('0.1.dev1+')
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/setuptools_scm-1.8.0/testing/test_main.py 
new/setuptools_scm-1.10.1/testing/test_main.py
--- old/setuptools_scm-1.8.0/testing/test_main.py       1970-01-01 
01:00:00.000000000 +0100
+++ new/setuptools_scm-1.10.1/testing/test_main.py      2015-11-28 
14:49:00.000000000 +0100
@@ -0,0 +1,9 @@
+import os.path
+
+
+def test_main():
+    mainfile = os.path.join(
+        os.path.dirname(__file__), "..", "setuptools_scm", "__main__.py")
+    with open(mainfile) as f:
+        code = compile(f.read(), "__main__.py", 'exec')
+        exec(code)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/setuptools_scm-1.8.0/testing/test_mercurial.py 
new/setuptools_scm-1.10.1/testing/test_mercurial.py
--- old/setuptools_scm-1.8.0/testing/test_mercurial.py  1970-01-01 
01:00:00.000000000 +0100
+++ new/setuptools_scm-1.10.1/testing/test_mercurial.py 2015-12-10 
21:58:05.000000000 +0100
@@ -0,0 +1,97 @@
+from setuptools_scm import format_version
+from setuptools_scm.hg import archival_to_version
+from setuptools_scm import integration
+
+import pytest
+
+
+@pytest.fixture
+def wd(wd):
+    wd('hg init')
+    wd.add_command = 'hg add .'
+    wd.commit_command = 'hg commit -m test-{reason} -u test -d "0 0"'
+    return wd
+
+archival_mapping = {
+    '1.0': {'tag': '1.0'},
+    '1.1.dev3+n000000000000': {
+        'latesttag': '1.0',
+        'latesttagdistance': '3',
+        'node': '0'*20,
+    },
+    '0.0': {
+        'node': '0'*20,
+    },
+    '1.2.2': {'tag': 'release-1.2.2'},
+    '1.2.2.dev0': {'tag': 'release-1.2.2.dev'},
+
+}
+
+
+@pytest.mark.parametrize('expected,data', sorted(archival_mapping.items()))
+def test_archival_to_version(expected, data):
+    version = archival_to_version(data)
+    assert format_version(
+        version,
+        version_scheme='guess-next-dev',
+        local_scheme='node-and-date') == expected
+
+
+def test_find_files_stop_at_root_hg(wd):
+    wd.commit_testfile()
+    wd.cwd.ensure('project/setup.cfg')
+    assert integration.find_files(str(wd.cwd/'project')) == []
+
+
+# XXX: better tests for tag prefixes
+def test_version_from_hg_id(wd):
+    assert wd.version == '0.0'
+
+    wd.commit_testfile()
+    assert wd.version.startswith('0.1.dev2+')
+
+    # tagging commit is considered the tag
+    wd('hg tag v0.1 -u test -d "0 0"')
+    assert wd.version == '0.1'
+
+    wd.commit_testfile()
+    assert wd.version.startswith('0.2.dev2')
+
+    wd('hg up v0.1')
+    assert wd.version == '0.1'
+
+    # commit originating from the taged revision
+    # that is not a actual tag
+    wd.commit_testfile()
+    assert wd.version.startswith('0.2.dev1+')
+
+
+def test_version_from_archival(wd):
+    # entrypoints are unordered,
+    # cleaning the wd ensure this test wont break randomly
+    wd.cwd.join('.hg').remove()
+    wd.write(
+        '.hg_archival.txt',
+        'node: 000000000000\n'
+        'tag: 0.1\n'
+    )
+    assert wd.version == '0.1'
+
+    wd.write(
+        '.hg_archival.txt',
+        'node: 000000000000\n'
+        'latesttag: 0.1\n'
+        'latesttagdistance: 3\n'
+    )
+
+    assert wd.version == '0.2.dev3+n000000000000'
+
+
+@pytest.mark.issue('#72')
+def test_version_in_merge(wd):
+    wd.commit_testfile()
+    wd.commit_testfile()
+    wd('hg up 0')
+    wd.commit_testfile()
+    wd('hg merge')
+    assert wd.version is not None


Reply via email to