13.07.2015 Views

Linux System Administration Recipes A Problem-Solution Approach

Linux System Administration Recipes A Problem-Solution Approach

Linux System Administration Recipes A Problem-Solution Approach

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

CHAPTER 1 ■ SAVING YOURSELF EFFORT■ Note Unfortunately, there’s no way in Subversion to remove a directory from the database altogether, in otherwords, including all of its change history; this recipe just deletes it from this point in time, with all the pastinformation still kept. If you want to erase it altogether, you’ll have to use svndumpfilter exclude to create anew repository without the unwanted directory. This code will do that:svnadmin create /path/to/new_main_reposcat repos.dump | svndumpfilter exclude testdir | svnadmin load new_main_reposAfter you’ve checked your new main repository, you can delete the old one altogether and then check everythingout again from the new one.1-13. Subversion: Branching RepositoriesThe canonical situation for coders where you’d want to branch is when you want to create a dev branchof a project so that the main fork can be the stable code. (Or vice versa.) For sysadmin purposes, it mightbe useful to branch your config file tree when you upgrade some machines to a different version of yourdistro—so you can also merge across changes from the main version when they apply and then mergethe whole branch back in when you upgrade the other machines.To create a new branch, you need to make a copy of the main project:svn copy /path/to/repos/proj/trunk /path/to/repos/proj/branchNow check out that new directory to start working on the branch, and that’s it:cd my_branch_dirsvn checkout proj/branchIn due course, you’ll probably want to merge the changes back into the main tree (for example,when all your machines have been upgraded). This is going to be a little more complicated, becausechances are, you’ve made a few changes to the stable branch as well, and it may not be possible toautomatically merge them all.To merge changes from the trunk back to your branch, use this:cd my_branch_dirsvn merge /path/to/repos/proj/trunkCheck for conflicts with svn status, resolve them if necessary, run any appropriate tests (forexample, config file syntax checkers) to check for conflicts, and then commit the changes as usual.To merge your branch back into the trunk, first check out a clean copy of the trunk. Then (from thatchecked-out directory), run this:svn merge --reintegrate /path/to/repos/proj/branch15Download at WoweBook.Com

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!