patch 8.1.1116: cannot enforce a Vim script style

Problem:    Cannot enforce a Vim script style.
Solution:   Add the :scriptversion command. (closes #3857)
diff --git a/src/ex_cmds2.c b/src/ex_cmds2.c
index a8040a7..97bf143 100644
--- a/src/ex_cmds2.c
+++ b/src/ex_cmds2.c
@@ -2321,7 +2321,7 @@
 	    else
 #endif
 	    /* Try auto-writing the buffer.  If this fails but the buffer no
-	    * longer exists it's not changed, that's OK. */
+	     * longer exists it's not changed, that's OK. */
 	    if (check_changed(buf, (p_awa ? CCGD_AW : 0)
 				 | CCGD_MULTWIN
 				 | CCGD_ALLBUF) && bufref_valid(&bufref))
@@ -4501,12 +4501,14 @@
      * Also starts profiling timer for nested script. */
     save_funccal(&funccalp_entry);
 
+    save_current_sctx = current_sctx;
+    current_sctx.sc_lnum = 0;
+    current_sctx.sc_version = 1;
+
     // Check if this script was sourced before to finds its SID.
     // If it's new, generate a new SID.
     // Always use a new sequence number.
-    save_current_sctx = current_sctx;
     current_sctx.sc_seq = ++last_current_SID_seq;
-    current_sctx.sc_lnum = 0;
 # ifdef UNIX
     stat_ok = (mch_stat((char *)fname_exp, &st) >= 0);
 # endif
@@ -5077,10 +5079,9 @@
 
 /*
  * ":scriptencoding": Set encoding conversion for a sourced script.
- * Without the multi-byte feature it's simply ignored.
  */
     void
-ex_scriptencoding(exarg_T *eap UNUSED)
+ex_scriptencoding(exarg_T *eap)
 {
     struct source_cookie	*sp;
     char_u			*name;
@@ -5108,6 +5109,29 @@
 	vim_free(name);
 }
 
+/*
+ * ":scriptversion": Set Vim script version for a sourced script.
+ */
+    void
+ex_scriptversion(exarg_T *eap UNUSED)
+{
+    int		nr;
+
+    if (!getline_equal(eap->getline, eap->cookie, getsourceline))
+    {
+	emsg(_("E984: :scriptversion used outside of a sourced file"));
+	return;
+    }
+
+    nr = getdigits(&eap->arg);
+    if (nr == 0 || *eap->arg != NUL)
+	emsg(_(e_invarg));
+    else if (nr > 2)
+	semsg(_("E999: scriptversion not supported: %d"), nr);
+    else
+	current_sctx.sc_version = nr;
+}
+
 #if defined(FEAT_EVAL) || defined(PROTO)
 /*
  * ":finish": Mark a sourced file as finished.