At present, leoVersion.py gets version info by parsing
leo/core/commit_timestamp.json. There are at least two unacceptable
problems with this approach:
1. The dates don't get updated if a developer (like me!) forgets to install
the git hooks.
Just today I noticed that the last update was supposedly in July!
2. Continually changing commit_timestamp.json creates merge conflicts.
There is a much easier way. Rather than parsing commit_timestamp.json, we
can get info about the last commit from "git log -1". Like this:
p = subprocess.Popen(
["git", "log" , '-1', '--date=default-local'],
out, err = p.communicate()
out = g.toUnicode(out)
m = re.search('commit (.*)\n', out)
commit = m.group(1)[0:8].strip() if m else ''
m = re.search('Date: (.*)\n', out)
date = m.group(1).strip() if m else '
This works well in my tests.
For official releases, we expect that git won't be installed, or that "git
log" will fail because the official release contains no .git directory.
Either way, the code will catch exceptions thrown by subprocess and return
the official (static) release date defined in leoVersion.py.
My release testing will ensure that this approach works. Do you see any
problems with it?
You received this message because you are subscribed to the Google Groups
To unsubscribe from this group and stop receiving emails from it, send an email
To post to this group, send email to email@example.com.
Visit this group at https://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/d/optout.