PVCS 到 SVN 迁移 - 如何将 PVCS 标签写入 SVN 日志消息

发布于 2024-10-24 09:27:41 字数 558 浏览 4 评论 0原文

我们正在从 PVCS 迁移到 Subversion。我已经演示了 PVCS 导出 => SVN 导入对我们来说很好地完成了这项工作,但我们有一个问题。

我们广泛使用 PVCS 标签,这些标签为我们提供了与工作请求编号 (WR) 的清晰一致的链接。当我们迁移到 SVN 时,这些标签变成了标签(这本身就很好),但我们也在实现 JIRA,因此需要将适当的 SVN 版本链接到 JIRA 问题号。这是通过将 JIRA 问题编号写入 SVN 日志消息来完成的。

迄今为止;在 SVN 导入时,我会读取每条 SVN 日志消息,并在找到工作请求编号的地方将相应的 JIRA 问题编号附加到 SVN 日志消息中(使用 SVN 中的提交后脚本)。然而,将 WR 写入 PVCS 提交描述的做法是可选的,而 PVCS 标签的使用是强制性的。因此,许多版本在日志中没有 WR 编号,仅在 PVCS 标签中(或成为 SVN 标签)。

有什么办法可以在SVN导入时找到PVCS版本标签吗?我可以在 PVCS 导出创建的转储文件中看到它们,它们成为节点路径的一部分。

或者,我可以运行一个报告或查询来为我提供每个标签的修订列表吗?

问候 卡尔

We are in the process of migrating from PVCS to Subversion. I have demoed a PVCS export => SVN import that does the job quite nicely for us but we have one issue.

We have made extensive use of PVCS labels and these give us a clear and consistent link to our Work Request numbers (W.R.). When we migrate to SVN these labels become tags (which in itself is fine) BUT we're also implementing JIRA and so need to link the appropriate SVN version to a JIRA issue number. This is done by writing the JIRA issue number into the SVN log message.

So far; at SVN Import time I am reading each SVN log message and where I find a work request number I append the appropriate JIRA issue number to the SVN log message (using a post-commit script in SVN). However the practice of writing the W.R. into the PVCS commit description has been optional whereas the use of PVCS labels has been mandatory. Therefore many of the versions do not have a W.R. number in the log, only in the PVCS label (or as it becomes SVN Tag).

Is there any way I can find the PVCS version label during the SVN import? I can see them in the dump file created by the PVCS export where they become a part of the Node-path.

Or alternately is there a report or query I can run that will give me a list of revisions for each tag?

Regards
Karl

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

晨敛清荷 2024-10-31 09:27:41

我最终自己整理了这个。如果其他人有同样的问题,我发现可以使用以下命令获取所有标签的列表

svn ls <repo URL including tags location>

,然后使用这些标签中的版本

svn info ...

并使用以下命令获取 SVN INFO 输出。请注意,我必须将版本号减 1 才能获得我感兴趣的实际版本。我认为这是因为在导入期间 SVN 在创建版本后将适当的版本复制到标记文件夹中,并且这被视为版本。

BEGIN { RS="";
    FS = "\n"; }
/^Path:/ { n1 = split($1,path,":");
           n3 = split($6,nodeKind, ":");
           n2 = split($9,lastRev,":");
           theRev = lastRev[2] -1;
printf("%8s %10s, %-75s\n", theRev, nodeKind[2], path[2]); }

WRKEYFILE 和 PTKEYFILE 只是 .csv 查找文件,用于与格式匹配

PT_TICKET,PKEY,Issue Title

然后我编写了一个脚本,如下所示...

REPO=svn://vuwunicocsagfg1/Banner/tags
REPOPATH=/var/subversion/Banner
WRKEYFILE=workReq_pKey.unix
PTKEYFILE=ptTicket_pKey.unix

# working variables
TEMPFILE=$.tmp
TAGLIST=$.tags
REVISIONS=$.revisions
SVNINFO=$.info
SVNLOOK=/usr/bin/svnlook


# look up details in Subversion
svn info -R $REPO | awk -f new_svn_report.awk > $SVNINFO
svn ls $REPO > $TAGLIST

cat $TAGLIST | awk '{ print $1}' | while read LINE
do

   JIRAISSUE=""
   WRNUM=""
   PTNUM=""
   UWRNUM=""
   UPTNUM=""

   # Find Work Request or Perfect Tracker number
   WRNUM=$(echo "$LINE" | sed -n -e "s:.*\([wW][rR][0-9# -][0-9]\+\).*:\1:p")
   PTNUM=$(echo "$LINE" | sed -n -e "s:.*\([pP][tT][0-9# -][0-9]\+\).*:\1:p")

   # upper case the strings found and remove unwanted chars
   UWRNUM=`echo $WRNUM| tr 'a-z' 'A-Z' | tr --delete '# -'`
   UPTNUM=`echo $PTNUM| tr 'a-z' 'A-Z' | tr --delete '# -'`
   # Debug
   # echo "=============================="
   # echo "Line is: $LINE,  WRNUM is: $WRNUM, PTNUM is: $PTNUM"

   if [[ -n "$UWRNUM" ]]
   then

      # Find the JIRA issue number
      awk -F',' '/'"$UWRNUM"'/ {print $2}' $WRKEYFILE | awk '{if (NR==1) {print $0}}'  > $TEMPFILE
      JIRAISSUE=`cat $TEMPFILE`

      awk -F',' '/'"$UWRNUM"'/ {print $2,"; " $3}' $WRKEYFILE | tr '"' '_' | awk '{if (NR==1) {print $0}}' > $TEMPFILE
      NEWLOG=`cat $TEMPFILE`

      # all revisions in this Tag which are not directories
      grep $UWRNUM $SVNINFO | grep -v "directory" > $REVISIONS
   fi

   if [[ -n "$UPTNUM" ]]
   then
      # Find the JIRA issue number
      awk -F',' '/'"$UPTNUM"'/ {print $2}' $PTKEYFILE | awk '{if (NR==1) {print $0}}'  > $TEMPFILE
      JIRAISSUE=`cat $TEMPFILE`

      awk -F',' '/'"$UPTNUM"'/ {print $2,"; " $3}' $PTKEYFILE | tr '"' '_' | awk '{if (NR==1) {print $0}}' > $TEMPFILE
      NEWLOG=`cat $TEMPFILE`

      # all revisions in this Tag which are not directories
      grep $UPTNUM $SVNINFO | grep -v "directory" > $REVISIONS
   fi

   if [[ -n "$JIRAISSUE"  ]]
   then
      cat $REVISIONS | awk '{ print $1}' | while read REVLINE
      do

         $SVNLOOK log -r "$REVLINE" "$REPOPATH" | tr '"' '_' > $TEMPFILE
         OLDLOG=`cat $TEMPFILE `

         if `echo $OLDLOG | grep "$JIRAISSUE" 1>/dev/null 2>&1`
         then
            LOGMSG=$OLDLOG
         else
            LOGMSG="$OLDLOG  $NEWLOG"
         fi
        # Debug
         # echo "Jira issue is: $JIRAISSUE"
         # echo "update the log message for Revision $REVLINE"
         # echo "New log message is: $LOGMSG"
         # echo "***********************************"

         echo "svn propset --revprop -r "$REVLINE" svn:log \""$LOGMSG"\" $REPO"
         svn propset --revprop -r "$REVLINE" svn:log \""$LOGMSG"\" $REPO
         echo ""

       done
   fi
done

I ended up sorting this myself. If anyone else has the same problem, I found that it was possible to get a list of all tags using

svn ls <repo URL including tags location>

and then get the versions in those tags using

svn info ...

And AWK the SVN INFO output using the following. Note I had to decrement the version number by 1 to get the actual version I was interested in. I think this is because during the import SVN copies the approriate version to the tag folder after creating the version and this is considered a version.

BEGIN { RS="";
    FS = "\n"; }
/^Path:/ { n1 = split($1,path,":");
           n3 = split($6,nodeKind, ":");
           n2 = split($9,lastRev,":");
           theRev = lastRev[2] -1;
printf("%8s %10s, %-75s\n", theRev, nodeKind[2], path[2]); }

WRKEYFILE and PTKEYFILE are just .csv lookup files to match against with a format of

PT_TICKET,PKEY,Issue Title

Then I wrote a script as follows ...

REPO=svn://vuwunicocsagfg1/Banner/tags
REPOPATH=/var/subversion/Banner
WRKEYFILE=workReq_pKey.unix
PTKEYFILE=ptTicket_pKey.unix

# working variables
TEMPFILE=$.tmp
TAGLIST=$.tags
REVISIONS=$.revisions
SVNINFO=$.info
SVNLOOK=/usr/bin/svnlook


# look up details in Subversion
svn info -R $REPO | awk -f new_svn_report.awk > $SVNINFO
svn ls $REPO > $TAGLIST

cat $TAGLIST | awk '{ print $1}' | while read LINE
do

   JIRAISSUE=""
   WRNUM=""
   PTNUM=""
   UWRNUM=""
   UPTNUM=""

   # Find Work Request or Perfect Tracker number
   WRNUM=$(echo "$LINE" | sed -n -e "s:.*\([wW][rR][0-9# -][0-9]\+\).*:\1:p")
   PTNUM=$(echo "$LINE" | sed -n -e "s:.*\([pP][tT][0-9# -][0-9]\+\).*:\1:p")

   # upper case the strings found and remove unwanted chars
   UWRNUM=`echo $WRNUM| tr 'a-z' 'A-Z' | tr --delete '# -'`
   UPTNUM=`echo $PTNUM| tr 'a-z' 'A-Z' | tr --delete '# -'`
   # Debug
   # echo "=============================="
   # echo "Line is: $LINE,  WRNUM is: $WRNUM, PTNUM is: $PTNUM"

   if [[ -n "$UWRNUM" ]]
   then

      # Find the JIRA issue number
      awk -F',' '/'"$UWRNUM"'/ {print $2}' $WRKEYFILE | awk '{if (NR==1) {print $0}}'  > $TEMPFILE
      JIRAISSUE=`cat $TEMPFILE`

      awk -F',' '/'"$UWRNUM"'/ {print $2,"; " $3}' $WRKEYFILE | tr '"' '_' | awk '{if (NR==1) {print $0}}' > $TEMPFILE
      NEWLOG=`cat $TEMPFILE`

      # all revisions in this Tag which are not directories
      grep $UWRNUM $SVNINFO | grep -v "directory" > $REVISIONS
   fi

   if [[ -n "$UPTNUM" ]]
   then
      # Find the JIRA issue number
      awk -F',' '/'"$UPTNUM"'/ {print $2}' $PTKEYFILE | awk '{if (NR==1) {print $0}}'  > $TEMPFILE
      JIRAISSUE=`cat $TEMPFILE`

      awk -F',' '/'"$UPTNUM"'/ {print $2,"; " $3}' $PTKEYFILE | tr '"' '_' | awk '{if (NR==1) {print $0}}' > $TEMPFILE
      NEWLOG=`cat $TEMPFILE`

      # all revisions in this Tag which are not directories
      grep $UPTNUM $SVNINFO | grep -v "directory" > $REVISIONS
   fi

   if [[ -n "$JIRAISSUE"  ]]
   then
      cat $REVISIONS | awk '{ print $1}' | while read REVLINE
      do

         $SVNLOOK log -r "$REVLINE" "$REPOPATH" | tr '"' '_' > $TEMPFILE
         OLDLOG=`cat $TEMPFILE `

         if `echo $OLDLOG | grep "$JIRAISSUE" 1>/dev/null 2>&1`
         then
            LOGMSG=$OLDLOG
         else
            LOGMSG="$OLDLOG  $NEWLOG"
         fi
        # Debug
         # echo "Jira issue is: $JIRAISSUE"
         # echo "update the log message for Revision $REVLINE"
         # echo "New log message is: $LOGMSG"
         # echo "***********************************"

         echo "svn propset --revprop -r "$REVLINE" svn:log \""$LOGMSG"\" $REPO"
         svn propset --revprop -r "$REVLINE" svn:log \""$LOGMSG"\" $REPO
         echo ""

       done
   fi
done
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文