# HG changeset patch # User Christian Brabandt # Date 1725997506 -7200 # Node ID 590ab2c926e63cb96a91f79544f1eb95cb2ef16f # Parent 8c394230efedcceefa876f4e27a50c0ee5e4767e runtime(spec): Recognize epoch when making spec changelog in ftplugin Commit: https://github.com/vim/vim/commit/e40157641c1ddb9cc805c04ca23fb80a6382a349 Author: fundawang Date: Tue Sep 10 21:43:05 2024 +0200 runtime(spec): Recognize epoch when making spec changelog in ftplugin closes: https://github.com/vim/vim/issues/15537 Signed-off-by: fundawang Signed-off-by: Christian Brabandt diff --git a/runtime/ftplugin/spec.vim b/runtime/ftplugin/spec.vim --- a/runtime/ftplugin/spec.vim +++ b/runtime/ftplugin/spec.vim @@ -2,8 +2,9 @@ " Filename: spec.vim " Maintainer: Igor Gnatenko i.gnatenko.brain@gmail.com " Former Maintainer: Gustavo Niemeyer (until March 2014) -" Last Change: Mon Jun 01 21:15 MSK 2015 Igor Gnatenko -" Update by Zdenek Dohnal, 2022 May 17 +" Last Change: 2015 Jun 01 +" Update by Zdenek Dohnal, 2022 May 17 +" 2024 Sep 10 by Vim Project: add epoch support for spec changelog, #15537 if exists("b:did_ftplugin") finish @@ -66,9 +67,11 @@ if !exists("*s:SpecChangelog") endif let line = 0 let name = "" + let epoch = "" let ver = "" let rel = "" let nameline = -1 + let epochline = -1 let verline = -1 let relline = -1 let chgline = -1 @@ -77,6 +80,9 @@ if !exists("*s:SpecChangelog") if name == "" && linestr =~? '^Name:' let nameline = line let name = substitute(strpart(linestr,5), '^[ ]*\([^ ]\+\)[ ]*$','\1','') + elseif epoch == "" && linestr =~? '^Epoch:' + let epochline = line + let epoch = substitute(strpart(linestr,6), '^[ ]*\([^ ]\+\)[ ]*$','\1','') elseif ver == "" && linestr =~? '^Version:' let verline = line let ver = substitute(strpart(linestr,8), '^[ ]*\([^ ]\+\)[ ]*$','\1','') @@ -93,6 +99,7 @@ if !exists("*s:SpecChangelog") if nameline != -1 && verline != -1 && relline != -1 let include_release_info = exists("g:spec_chglog_release_info") let name = s:ParseRpmVars(name, nameline) + let epoch = s:ParseRpmVars(epoch, epochline) let ver = s:ParseRpmVars(ver, verline) let rel = s:ParseRpmVars(rel, relline) else @@ -117,6 +124,9 @@ if !exists("*s:SpecChangelog") if chgline != -1 let tmptime = v:lc_time language time C + if strlen(epoch) + let ver = epoch.":".ver + endif let parsed_format = "* ".strftime(format)." - ".ver."-".rel execute "language time" tmptime let release_info = "+ ".name."-".ver."-".rel