mirror of
https://github.com/facebook/sapling.git
synced 2024-12-28 07:33:10 +03:00
version: warn users when they are running an old build
Summary: Old is defined by being based on a commit that is more than 30 days old. The build date is taken from the version string. One observation is that if we fail to release in more than 30 days then all users will start seeing this message without any way of turning it off. Doesn't seem worth while to add a config for silencing it though. Reviewed By: quark-zju Differential Revision: D20825399 fbshipit-source-id: f97518031bbda5e2c49226f3df634c5b80651c5b
This commit is contained in:
parent
170dc08976
commit
d1ba21803a
@ -372,6 +372,8 @@ remotefilelog=
|
||||
cachepath=$TESTTMP/cachepath
|
||||
[extensions]
|
||||
commitextras=
|
||||
[hint]
|
||||
ack=*
|
||||
EOF
|
||||
}
|
||||
|
||||
|
@ -440,6 +440,9 @@ def dispatch(req):
|
||||
)
|
||||
blackbox.sync()
|
||||
|
||||
if util.isoldversion():
|
||||
hintutil.trigger("old-version")
|
||||
|
||||
# by registering this exit handler here, we guarantee that it runs
|
||||
# after other exithandlers, like the killpager one
|
||||
req.ui.atexit(logatexit)
|
||||
|
@ -40,6 +40,9 @@ hinttable = {
|
||||
"graph-renderer": lambda: _(
|
||||
"The new graph renderer is in use. See fburl.com/wiki/8zhodl1g for customization and troubleshooting."
|
||||
),
|
||||
"old-version": lambda: _(
|
||||
"WARNING! You are running an old version of Mercurial. Please upgrade your installation."
|
||||
),
|
||||
}
|
||||
messages = []
|
||||
triggered = set()
|
||||
|
@ -402,6 +402,18 @@ def version():
|
||||
return "unknown"
|
||||
|
||||
|
||||
def isoldversion():
|
||||
"""Returns approximate date information for the current version if available"""
|
||||
try:
|
||||
v = version()
|
||||
parts = remod.split("_", v)
|
||||
approxbuilddate = datetime.datetime.strptime(parts[1], "%Y%m%d")
|
||||
now = datetime.datetime.now()
|
||||
return (now - approxbuilddate).days > 31
|
||||
except Exception:
|
||||
return None
|
||||
|
||||
|
||||
def versiontuple(v=None, n=4):
|
||||
"""Parses a Mercurial version string into an N-tuple.
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user