How to properly create an SVN tag from trunk?

前端 未结 9 1615
挽巷
挽巷 2021-01-29 17:04

I am creating my first project in Subversion. So far I have

 branches
 tags
 trunk

I think I immediately need to make branches singular and sta

9条回答
  •  时光取名叫无心
    2021-01-29 17:36

    Another option to tag a Subversion repository is to add the tag to the svn:log property like this:

       echo "TAG: your_tag_text" > newlog
       svn propget $REPO --revprop -r $tagged_revision >> newlog
       svn propset $REPO --revprop -r $tagged_revision -F newlog
       rm newlog
    

    I recently started thinking that this is the most "right" way to tag. This way you don't create extra revisions (as you do with "svn cp") and still can easily extract all tags by using grep on "svn log" output:

       svn log | awk '/----/ {
                          expect_rev=1;
                          expect_tag=0;
                      }
                      /^r[[:digit:]]+/ {
                          if(expect_rev) {
                              rev=$1;
                              expect_tag=1;
                              expect_rev=0;
                          }
                      }
                      /^TAG:/ {
                          if(expect_tag) {
                              print "Revision "rev", Tag: "$2;
                          }
                          expect_tag=0;
                      }'
    

    Also, this way you may seamlessly delete tags if you need to. So the tags become a complete meta-information, and I like it.

提交回复
热议问题