2011-11-18 60 views
1

我想使用coldfusion獲取最新的svn修訂版號。任何想法如何?顯示在Coldfusion中的SVN修訂號

+0

可能重複[獲取SVN中的最後一個版本號?](http://stackoverflow.com/questions/579196/getting-the-last-revision-number -in-svn) – Henry

+1

並使用'' – Henry

+0

你是不是指 nasaa

回答

2

你仍然需要解析的結果,就像這樣: (可根據您的SVN的應用程序,以及是否在Windows或Linux會發生變化)

<cfexecute name="c:\Program Files\SlikSvn\bin\svn.exe" timeout="30" 
      arguments="--username myusername --password mypassword info ""c:\inetpub\mysite\""" 
      variable="res"></cfexecute> 

<cfset a = listToArray(res,chr(10))> 


<cfset rev=0> 
<cfloop array="#a#" index="i"> 
    <cfset info = listToArray(i,":")> 
    <cfif info[1] eq "Last Changed Rev"> 
      <cfset rev=trim(info[2])> 
    </cfif> 
</cfloop> 

<cfoutput>#rev#</cfoutput> 
+0

工作得很好......非常感謝:) – nasaa

0
<cfset workcopyPath = "[path to svn working copy]"> 
<cfset svnPath = "[path to svn executable]"> 
<cfset svnArg = " info #workcopyPath#"> 

<cfexecute name="#svnPath#" 
      arguments="#svnArg#" 
      timeout="10" 
      variable="svnInfoResult"> 

<cfdump var=#svnInfoResult#> 

http://www.coldfusionjedi.com/index.cfm/2006/12/9/ColdFsion-handling-of-Subversion-events

http://www.numtopia.com/terry/blog/archives/2008/02/using_coldfusion_and_svn_to_create_release_notes.cfm

+0

我在這裏發現了這篇文章,好 - http://obligious.blogspot.com/2011/12/you-can-access-svn-information-from.html – nasaa