Versioneer now also returns and persists the branch from which OctoPrint was installed
Changed version output accordingly to now display "{version} ({branch} branch)" if branch information is available (which should be the case if installation was performed from git).
(cherry picked from commit a48b5de)
This commit is contained in:
parent
e51d9439c5
commit
45c1958d83
4 changed files with 38 additions and 9 deletions
|
|
@ -166,7 +166,7 @@ def versions_from_lookup(lookup, root, verbose=False):
|
|||
if dirty:
|
||||
version += "-dirty"
|
||||
full += "-dirty"
|
||||
return {"version": version, "full": full}
|
||||
return {"version": version, "full": full, "branch": current_branch}
|
||||
|
||||
return {}
|
||||
|
||||
|
|
@ -195,7 +195,14 @@ def versions_from_vcs(tag_prefix, root, verbose=False):
|
|||
full = stdout.strip()
|
||||
if tag.endswith("-dirty"):
|
||||
full += "-dirty"
|
||||
return {"version": tag, "full": full}
|
||||
|
||||
stdout = run_command(GITS, ["rev-parse", "--abbrev-ref", "HEAD"],
|
||||
cwd=root)
|
||||
if stdout is None:
|
||||
branch = None
|
||||
else:
|
||||
branch = stdout.strip()
|
||||
return {"version": tag, "full": full, "branch": branch}
|
||||
|
||||
|
||||
def versions_from_parentdir(parentdir_prefix, root, verbose=False):
|
||||
|
|
|
|||
|
|
@ -41,8 +41,12 @@ import octoprint.timelapse
|
|||
import octoprint._version
|
||||
|
||||
|
||||
VERSION = octoprint._version.get_versions()['version']
|
||||
|
||||
versions = octoprint._version.get_versions()
|
||||
VERSION = versions['version']
|
||||
BRANCH = versions['branch'] if 'branch' in versions else None
|
||||
DISPLAY_VERSION = "%s (%s branch)" % (VERSION, BRANCH) if BRANCH else VERSION
|
||||
del versions
|
||||
|
||||
@app.route("/")
|
||||
def index():
|
||||
|
|
@ -58,6 +62,7 @@ def index():
|
|||
firstRun=settings().getBoolean(["server", "firstRun"]) and (userManager is None or not userManager.hasBeenCustomized()),
|
||||
debug=debug,
|
||||
version=VERSION,
|
||||
display_version=DISPLAY_VERSION,
|
||||
stylesheet=settings().get(["devel", "stylesheet"]),
|
||||
gcodeMobileThreshold=settings().get(["gcodeViewer", "mobileSizeThreshold"]),
|
||||
gcodeThreshold=settings().get(["gcodeViewer", "sizeThreshold"])
|
||||
|
|
@ -126,7 +131,7 @@ class Server():
|
|||
self._initLogging(self._debug)
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
logger.info("Starting OctoPrint (%s)" % VERSION)
|
||||
logger.info("Starting OctoPrint %s" % DISPLAY_VERSION)
|
||||
|
||||
eventManager = events.eventManager()
|
||||
gcodeManager = gcodefiles.GcodeManager()
|
||||
|
|
|
|||
|
|
@ -597,7 +597,7 @@
|
|||
</div>
|
||||
<div class="footer">
|
||||
<ul class="pull-left muted">
|
||||
<li><small>Version: <span class="version">{{ version }}</span></small></li>
|
||||
<li><small>Version: <span class="version">{{ display_version }}</span></small></li>
|
||||
</ul>
|
||||
<ul class="pull-right">
|
||||
<li><a href="http://octoprint.org"><i class="icon-home"></i> Homepage</a></li>
|
||||
|
|
|
|||
|
|
@ -425,7 +425,7 @@ def versions_from_lookup(lookup, root, verbose=False):
|
|||
if dirty:
|
||||
version += "-dirty"
|
||||
full += "-dirty"
|
||||
return {"version": version, "full": full}
|
||||
return {"version": version, "full": full, "branch": current_branch}
|
||||
|
||||
return {}
|
||||
|
||||
|
|
@ -454,7 +454,14 @@ def versions_from_vcs(tag_prefix, root, verbose=False):
|
|||
full = stdout.strip()
|
||||
if tag.endswith("-dirty"):
|
||||
full += "-dirty"
|
||||
return {"version": tag, "full": full}
|
||||
|
||||
stdout = run_command(GITS, ["rev-parse", "--abbrev-ref", "HEAD"],
|
||||
cwd=root)
|
||||
if stdout is None:
|
||||
branch = None
|
||||
else:
|
||||
branch = stdout.strip()
|
||||
return {"version": tag, "full": full, "branch": branch}
|
||||
|
||||
|
||||
def versions_from_parentdir(parentdir_prefix, root, verbose=False):
|
||||
|
|
@ -685,7 +692,7 @@ def versions_from_lookup(lookup, root, verbose=False):
|
|||
if dirty:
|
||||
version += "-dirty"
|
||||
full += "-dirty"
|
||||
return {"version": version, "full": full}
|
||||
return {"version": version, "full": full, "branch": current_branch}
|
||||
|
||||
return {}
|
||||
|
||||
|
|
@ -715,7 +722,14 @@ def versions_from_vcs(tag_prefix, root, verbose=False):
|
|||
full = stdout.strip()
|
||||
if tag.endswith("-dirty"):
|
||||
full += "-dirty"
|
||||
return {"version": tag, "full": full}
|
||||
|
||||
stdout = run_command(GITS, ["rev-parse", "--abbrev-ref", "HEAD"],
|
||||
cwd=root)
|
||||
if stdout is None:
|
||||
branch = None
|
||||
else:
|
||||
branch = stdout.strip()
|
||||
return {"version": tag, "full": full, "branch": branch}
|
||||
|
||||
|
||||
def versions_from_parentdir(parentdir_prefix, root, verbose=False):
|
||||
|
|
@ -787,7 +801,10 @@ SHORT_VERSION_PY = """
|
|||
|
||||
version_version = '%(version)s'
|
||||
version_full = '%(full)s'
|
||||
version_branch = %(branch)r
|
||||
def get_versions(default={}, verbose=False):
|
||||
if version_branch:
|
||||
return {'version': version_version, 'full': version_full, 'branch': version_branch}
|
||||
return {'version': version_version, 'full': version_full}
|
||||
|
||||
"""
|
||||
|
|
|
|||
Loading…
Reference in a new issue