git - BASH variables to SVN commit -
i'm migrating repositories , have created key variables use in subversion commit, important of commit message, , date trying commit variables part of svn ci
operation, message easy can use svn ci -m"$(logmsg)"
message, have no idea how explicitly add date , author fields commit, help?
for (( r=$currev; r<$endrev+1; r++ )) git svn fetch -r $currev # move whitelists subversion folder find "$git_folder" \ -mindepth 1 \ -maxdepth 1 \ -regextype posix-egrep \ -not -regex ".*/(${exclude_pattern})$" \ -exec mv -t "$svn_folder" '{}' '+' # set opts svn logging cid=$(git log --format=oneline |awk '{print $1}') author='jd daniel <jdaniel@erado.com>' date=$(git log --date=iso |grep 'date' |awk -v n=2 '{sep=""; (i=n; i<=nf; i++) {printf("%s%s",sep,$i); sep=ofs}; printf("\n")}') logmsg=$(git log --oneline |awk -v n=2 '{sep=""; (i=n; i<=nf; i++) {printf("%s%s",sep,$i); sep=ofs}; printf("\n")}') # move svn cd $svn_folder add=$(svn st |grep '?\|m' |awk '{printf "%s ", $2}'); [ -z "$add" ] || svn add $add rem=$(svn st |grep 'd\|!' |awk '{printf "%s ", $2}'); [ -z "$rem" ] || svn rm $rem # commit svn ci -m 'git id: '$cid$'\n'$logmsg break # on rev done
you can change author , date of committed revision command svn propset --revprop
. following 2 commands change properties recent revision:
svn propset --revprop -r head svn:author "$author" svn propset --revprop -r head svn:date "$date"
the date should in format yyyy-mm-ddthh:mm:ss.msz
. see output of following command reference:
svn propget --revprop -r head svn:date
unfortunately, have change each property separately. command svn commit
has option revision properties (--with-revprop
). however, option can not used override standard properties during commit.
the svn repository must configured allow revision property changes. if not configured accordingly, error message. in case have create or change hook script hooks/pre-revprop-change
in svn repository. take @ template file hooks/pre-revprop-change.tmpl
more information.
Comments
Post a Comment