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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

CHAPTER 1 ■ SAVING YOURSELF EFFORTalias svs='svn status' just outputs the status of the current directory, showing which files aremodified and which haven’t been added. It’s a good idea to get into the habit of doing this before yourun a commit; plus, it reminds you of what you’re about to commit so you can write a useful commitmessage.1-9. Version Control: Adding Labels to Subversion LogMessagesSomething that can be an issue when using Subversion is that the default svn log command won’t showyou what files were changed in each commit; it shows only some revision information and the logmessage. svn log -v gives path information, or you can add more information to the log message itself.For example, say you have three big projects that you’re working on, A, B, and C; the following script willadd labels for them:01 #!/usr/bin/perl -w02 # svnl.pl: script to add labels to SVN commit message03 # usage: svnl.pl A|B|C “commit message”04 # Juliet Kemp 23.03.20090506 use strict;0708 die 'usage: svnl.pl A|B|C "commit message"' if $#ARGV > 1;0910 my $label = $ARGV[0];11 my $msg = $ARGV[1] || "";12 my $project;1314 if ( $label eq "A" ) { $project = "Project Able:"; }15 elsif ( $label eq "B" ) { $project = "Project Beta: "; }16 elsif ( $label eq "C" ) { $project = "Project Code:"; }17 else { $project = "Other: $label"; }1819 `svn commit -m "$project $msg"`;Note that this script allows for the usage svnl.pl "message text". In this case, $label = "messagetext" (line 10, since message text is the first and only argument) and $project = "Other: message text"(line 17), so that is what’s committed as the log message. Your labels can be as simple or as complicatedas you like.1-10. Version Control: Adding Multiple Files to SubversionOccasionally, you’ll find that you have a large stack of files to add all at once. sva * will add everything inthe directory and just give you a warning message about anything that’s already there. But first, that’s abit untidy, and second, you might not want to add everything.The following script, which must have a commit message as an argument, will look for all the filesthat haven’t been added to the repository, ask you whether you want to add each one (you can shortcut11Download at WoweBook.Com

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

Saved successfully!

Ooh no, something went wrong!