I was looking for a way to get rid of CVS / dirs that did this in all my commit bzr. I am new to bzr, so at that time I was still not sure how to deal with them. (At work, the central repo is CVS, but I use bzr locally to help me). Here is an example of what I did to get rid of some CVS disks in my project, it was not ideal, but a quick hack :)
You have a project called 'projAAA' in the dir / home / user / dev directory
Export current bzr project (for bzr import)
cd /home/user/dev bzr fast-export --no-plain projAAA export.gz
Move this export to an empty directory (for some reason, the filter looks at other disks where it starts)
cp export.gz ~/tmp/rewrite/ cd ~/tmp/rewrite
Script_1
This script accepts export and filters everything you supply with -x
Unfortunately, -x doesn't seem to work with wildcards, so you need to give exact values ββ/ paths / files
It works in ~ / tmp / rewrite
#!/bin/bash rm -r new.import/ out.filtered bzr fast-import-filter -x gradle/wrapper/CVS -x gradle/CVS -x .cvsignore* -x .cvsignore -x ChangeFile -x src/main/groovy/cvs/util/CVS -x src/main/groovy/cvs/CVS -x src/main/groovy/CVS -x src/main/java/cvs/util/CVS -x src/main/java/cvs/CVS -x src/main/java/CVS -x src/main/resources/CVS -x src/main/CVS -x src/test/groovy/cvs/util/CVS -x src/test/groovy/cvs/CVS -x src/test/groovy/CVS -x src/test/resources/CVS -x src/test/CVS -x src/CVS -x CVS export.gz > out.filtered bzr fast-import out.filtered new.import
Now the dir directory "new.import" will contain everything except what you filtered.
Run the following script to view the entire change history of this new import for things that may still be there that you don't need, for which you have to add another -x value to Script_1 (after which I ran again while Im happy)
Script_2:
Run this in ~ / tmp / rewrite:
#!/bin/bash THISDIR=$(pwd) pushd new.import/trunk/ #clean file echo `date` > $THISDIR/search.out # I manually enter the revisions that exist here, if you only have 1 to 19, change this accordingly: for i in `seq 1 70`; do echo $i printf "\n============== rev $i =================\n" >> $THISDIR/search.out bzr revert -r$i # Change this find to look for things you want to filter out find . -name CVS -type d >> $THISDIR/search.out 2>&1 done popd
If you now look at search.out, you will see that you have found the search, and then add them to the previous script until you are happy.
So, essentially, I do it a couple of times until I am happy;
- Run Script_1 to export, filter, rewrite the branch.
- Then Script_2, to look for a new branch, to make sure everything went well, if not, add more -x entries
- Restart the corrected script_1.
- Repeat
eugenevd
source share