Reputation: 4715
I'm wonder if there is anyway to just export files that have changed in specific revision.
e.g : I have branch with three files :
file.php
file.js
file.css
Just file.js
has changed in last commit.
How to use export
command to just export changed file (file.js
) and prevent exporting others.
Is there any Plugin or external 3rdParty ?
Upvotes: 1
Views: 530
Reputation: 124704
Using bzr export
you can specify a single directory to export, but not individual files.
As an alternative, you can get the contents of a file at some past revision like this:
bzr cat -r REV path/to/file > file.rREV
You can get the list of changed files at some past revision with the one-liner:
bzr diff -c REV | grep ^===
To wrap it up, here's a complete one-liner that does just what you asked for: export just the modified files of some specific revision REV into a directory called EX:
bzr diff -cREV | grep '^=== modified file ' | sed -e "s/[^']*//" -e "s/'//g" |\
while read fname; do echo $fname; mkdir -p EX/"$(dirname "$fname")";\
bzr cat -rREV "$fname" > EX/"$fname"; done
It loops over the modified files in revision REV, prepares the export directory EX with all parent directories needed to save the file preserving the path, and finally gets the file with bzr cat
and writes it at the correct relative path inside EX.
Upvotes: 5