Dealing with SVN keyword expansion with git-svn -
i asked keyword expansion in git , i'm willing accept design not support idea in git.
for better or worse, project i'm working on @ moment requires svn keyword expansion this:
svn propset svn:keywords "id" expl3.dtx
to keep string up-to-date:
$id: expl3.dtx 803 2008-09-11 14:01:58z $
but quite use git version control. unfortunately, git-svn doesn't support this, according docs:
"we ignore svn properties except svn:executable"
but doesn't seem tricky have keyword stuff emulated couple of pre/post commit hooks. first person want this? have code this?
what's going on here: git optimized switch between branches possible. in particular, git checkout
designed not touch files identical in both branches.
unfortunately, rcs keyword substitution breaks this. example, using $date$
require git checkout
touch every file in tree when switching branches. repository size of linux kernel, bring screeching halt.
in general, best bet tag @ least 1 version:
$ git tag v0.5.whatever
...and call following command makefile:
$ git describe --tags v0.5.15.1-6-g61cde1d
here, git telling me i'm working on anonymous version 6 commits past v0.5.15.1, sha1 hash beginning g61cde1d
. if stick output of command *.h
file somewhere, you're in business, , have no problem linking released software source code. preferred way of doing things.
if can't possibly avoid using rcs keywords, may want start explanation lars hjemli. basically, $id$
pretty easy, , if you're using git archive
, can use $format$
.
but, if absolutely cannot avoid rcs keywords, following should started:
git config filter.rcs-keyword.clean 'perl -pe "s/\\\$date[^\\\$]*\\\$/\\\$date\\\$/"' git config filter.rcs-keyword.smudge 'perl -pe "s/\\\$date[^\\\$]*\\\$/\\\$date: `date`\\\$/"' echo '$date$' > test.html echo 'test.html filter=rcs-keyword' >> .gitattributes git add test.html .gitattributes git commit -m "experimental rcs keyword support git" rm test.html git checkout test.html cat test.html
on system, get:
$date: tue sep 16 10:15:02 edt 2008$
if have trouble getting shell escapes in smudge
, clean
commands work, write own perl scripts expanding , removing rcs keywords, respectively, , use scripts filter.
note really don't want more files absolutely necessary, or git lose of speed.
Comments
Post a Comment