Ronny Pfannschmidt avatar Ronny Pfannschmidt committed c1a2f63

consider git dirty mark

Comments (0)

Files changed (2)

     out, err = p.communicate()
-    trace('out', repr(out))
-    trace('err', repr(err))
-    trace('ret', p.returncode)
+    if out:
+        trace('out', repr(out))
+    if err:
+        trace('err', repr(err))
+    if p.returncode:
+        trace('ret', p.returncode)
     return out.strip().decode(), err.strip().decode(), p.returncode
 def do(cmd, cwd='.'):
         return _version('0.0', distance=count + 1, node=out)
     if ret:
+    dirty = out.endswith('-dirty')
+    if dirty:
+        out = out.rsplit('-', 1)[0]
     if '-' not in out:
-        return _version(out)
+        return _version(out, node=rev_node[:7], dirty=dirty)
         tag, number, node = out.split('-')
-        return _version(tag, distance=number, node=node)
+        return _version(tag, distance=number, node=node, dirty=dirty)
 def _archival_to_version(data):
     if not isinstance(version, dict):
         return version
     elif version['dirty']:
-        return "%(tag)" % version
+        return "%(tag)" % version
     elif version['distance']:
         return "%(tag)" % version

     assert at_tag_01 == '0.1'
+    dirty_tag_01 = get_version(cwd)
+    assert dirty_tag_01.startswith('0.1.post0-')
     do('git add test.txt', cwd)
     do('git commit -m commit', cwd)
     after_tag_01 = get_version(cwd)
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.