Can't make keywords work
Neil Martinsen-Burrell
nmb at wartburg.edu
Fri Mar 20 19:52:49 GMT 2009
I wanted to try out the content filtering stuff using the keywords plugin,
but I don't seem to be able to make it work using the instructions in the
current documentation. Here's what I tried:
nmb at guttle[~]$ cd /tmp
nmb at guttle[/tmp]$ rm -r test
nmb at guttle[/tmp]$ bzr version |grep revision
revision: 4175
nmb at guttle[/tmp]$ bzr plugins |grep -i keywords
keywords
Keywords
# got the necessary equipment
nmb at guttle[/tmp]$ bzr init --development-wt5 test
Created a standalone tree (format: development-wt5)
nmb at guttle[/tmp]$ cd test
# turn on keywords
nmb at guttle[/tmp/test]$ echo '[name *.txt]
keywords=on' >.bzrrules
nmb at guttle[/tmp/test]$ rm ~/.bazaar/rules
nmb at guttle[/tmp/test]$ echo '$Date$ $Author$' > test.txt
nmb at guttle[/tmp/test]$ bzr add test.txt .bzrrules
bzr: ERROR: Specified file "test.txt" is outside the current view:
# what the heck, I didn't say anything about views!
nmb at guttle[/tmp/test]$ bzr view --switch off
bzr: ERROR: No current view to disable
# yeah, tell me about it
nmb at guttle[/tmp/test]$ bzr view --name arrgh .bzrrules test.txt
Using 'arrgh' view: .bzrrules, test.txt
# this doesn't seem right
nmb at guttle[/tmp/test]$ bzr add test.txt .bzrrules
adding test.txt
adding .bzrrules
nmb at guttle[/tmp/test]$ bzr ci -m 'initial commit'
ignoring files outside view: .bzrrules, test.txt
Committing to: /private/tmp/test/
added .bzrrules
added test.txt
Committed revision 1.
# Lets see those keywords
nmb at guttle[/tmp/test]$ cat test.txt
$Date$ $Author$
# Maybe an update expands them
nmb at guttle[/tmp/test]$ bzr up
Tree is up to date at revision 1.
nmb at guttle[/tmp/test]$ cat test.txt
$Date$ $Author$
# Maybe they're only available in bzr cat
nmb at guttle[/tmp/test]$ bzr cat test.txt
$Date$ $Author$
nmb at guttle[/tmp/test]$ bzr cat --keywords test.txt
bzr: ERROR: Bad value "test.txt" for option "keywords".
nmb at guttle[/tmp/test]$ bzr cat --keywords=raw test.txt
$Date$ $Author$
nmb at guttle[/tmp/test]$ bzr cat --keywords=publish test.txt
$Date$ $Author$
# Maybe a new branch would do it
nmb at guttle[/tmp/test]$ cd ..
nmb at guttle[/tmp]$ bzr branch test test2
Branched 1 revision(s).
nmb at guttle[/tmp]$ cd test2
nmb at guttle[/tmp/test2]$ cat test.txt
$Date$ $Author$
# Maybe using global rules
nmb at guttle[/tmp/test2]$ cd ..
nmb at guttle[/tmp]$ rm -r test2
nmb at guttle[/tmp]$ cp test/.bzrrules ~/.bazaar/rules
nmb at guttle[/tmp]$ bzr branch test test2
Branched 1 revision(s).
nmb at guttle[/tmp]$ cd test2
nmb at guttle[/tmp/test2]$ cat test.txt
$Date$ $Author$
That's about all the fighting I'm willing to do to try out a new feature.
Problems I noticed above:
1) Views get in the way when they have never been asked for. That is
completely bogus and to get them out of the way, one has to define a view
for every file one wants to use.
2) Keyword expansion apparently never happens. There are no errors in
~/.bzr.log related to keywords::
mb at guttle[/tmp/test]$ grep keywords ~/.bzr.log |grep -v svn:keywords
0.063 bzr arguments: [u'help', u'keywords']
0.063 bzr arguments: [u'help', u'keywords']
0.063 bzr arguments: [u'help', u'keywords']
0.063 bzr arguments: [u'help', u'keywords']
0.063 bzr arguments: [u'cat', u'--keywords', u'test.txt']
BadOptionValue: Bad value "test.txt" for option "keywords".
0.063 bzr arguments: [u'cat', u'--keywords=raw', u'test.txt']
0.063 bzr arguments: [u'cat', u'--keywords=publish', u'test.txt']
3) ``bzr help keywords`` says I can set rules in .bzrrules.
``bzr help rules`` says I have to set them in ~/.bazaar/rules.
Who's right? Neither apparently.
Hopefully the experience with this can be easily improved.
-Neil
(an EARLY adopter)
More information about the bazaar
mailing list