runtime(spec): Recognize epoch when making spec changelog in ftplugin

Commit: 
https://github.com/vim/vim/commit/e40157641c1ddb9cc805c04ca23fb80a6382a349
Author: fundawang <fundaw...@yeah.net>
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 <fundaw...@yeah.net>
    Signed-off-by: Christian Brabandt <c...@256bit.org>

diff --git a/runtime/ftplugin/spec.vim b/runtime/ftplugin/spec.vim
index 9040e19ce..fa125be52 100644
--- a/runtime/ftplugin/spec.vim
+++ b/runtime/ftplugin/spec.vim
@@ -2,8 +2,9 @@
 " Filename: spec.vim
 " Maintainer: Igor Gnatenko i.gnatenko.br...@gmail.com
 " Former Maintainer: Gustavo Niemeyer <nieme...@conectiva.com> (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), '^[   
 ]*\([^         ]\+\)[          ]*$',' ','')
+                       elseif epoch == "" && linestr =~? '^Epoch:'
+                               let epochline = line
+                               let epoch = substitute(strpart(linestr,6), '^[  
   ]*\([^         ]\+\)[          ]*$',' ','')
                        elseif ver == "" && linestr =~? '^Version:'
                                let verline = line
                                let ver = substitute(strpart(linestr,8), '^[    
 ]*\([^         ]\+\)[          ]*$',' ','')
@@ -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

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/E1so6nS-007mCA-9P%40256bit.org.

Raspunde prin e-mail lui