The command diff can compare two files and it can, by using the -r option, walk entire directory trees, recursively checking differences between subdirectories and files that occur at comparable points in each tree.
In some case, it’s useful to know only whether (and which) files differ, not the details of the differences (-q option). For example:
diff -bBqr dirA/ dirB/
-b and -B are tricks options to ignore white space and blank lines.
By using unified output format (-u option) is also possible to create a patch:
diff -bBNru dirA/ dirB/ > fix.patch
-N includes added and removed files.
To Apply patches to entire directories it’s necessary to pay attention about setting a “p level”. The p level instructs patch to ignore parts of the path name so that it can identify the files correctly.
For example, with a name like:
/home/pasquale/myprojects/projecta/src/main/java/net/marcoccia/MyClass.java
…and a working directory that contains:
src/main/java/net/marcoccia/MyClass.java
…the patch process requires the following command:
patch -p5 < fix.patch
In general, count up one for each path separator (slash character) that you remove from the beginning of the path, until what's left is a path that exists in your working directory. The count you reach is the p level.
28 February 2012 at 12:05 AM
Reverting to a previous version of your software in Subversion, you merge the changes from your current revision back to the revision you want to revert to.
So, for example, if you want to revert the trunk of your application from revision 682 to 680, you would do the following:
svn merge -r 682:680 http://myrepository.com/my/project/trunk
Subversion calculates the changes between revision 682 and revision 680 of the trunk and applying them to your working copy.
If you want to see exactly what changes will be applied, do a diff:
svn diff -r 682:680 http://myrepository.com/my/project/trunk
Finally, since the merge happens on your local working copy, you need to commit it to the repository.
6 August 2010 at 3:43 PM
We use find command to find all .svn folders beginning from current directory:
$ find . -type d -name .svn
Now, we pass these directories to rm command, using backtick (key to left of ’1′) around find for command substitution:
$ rm -rf `find . -type d -name .svn`
9 April 2010 at 3:44 PM
Subversion has the ability to substitute keywords—pieces of useful, dynamic information about a versioned file—into the contents of the file itself. The list of keywords available for substitution are:
- Date – describes the last time the file was known to have been changed in the repository.
- Revision – describes the last known revision in which this file changed in the repository.
- Author – describes the last known user to change this file in the repository.
- Id – is a compressed combination of the other keywords.
Now combine svn-keywords with JavaDoc of a Java Class. A tipically header template can be:
/**
* CLASS DESCRIPTION
*
* @author Pasquale Marcoccia
* @version $Revision$ on $Date$ by $Author$
*/
or:
/**
* CLASS DESCRIPTION
*
* @author Pasquale Marcoccia
* @version $Id$
*/
To tell Subversion whether or not to substitute keywords on a particular file, we can use propset subcommand. The svn:keywords property, when set on a versioned file, controls which keywords will be substituted on that file. The value is a space-delimited list of the keyword names.
svn propset svn:keywords "Date Revision Author Id" MyClass.java
We can set keywords on all java files in a directory:
find myProject/ -type f -name '*.java' -exec svn propset svn:keywords "Date Revision Author Id" {} \; -print
Instead, for files added later, we can automatically set keywords changing svn config file (~/.subversion/config):
[miscellany]
enable-auto-props = yes
[auto-props]
*.java = svn:keywords=Date Revision Author Id
5 April 2009 at 11:10 AM
Sorry, but this post is not available in English
1 March 2009 at 4:46 PM
Sorry, but this post is not available in English
26 February 2009 at 9:48 PM
To resize a VMWare disk there is an easy way: VMWare vCenter Converter. Unfortunately a linux version is not available. Additionally, this process seems to be very slow and at the end VMWare Tools needs to be re-installed.
So here a manual procedure:
- turn off the virtual machine
- remove all snapshots (or revert to one)
- run
vmware-vdiskmanager -x {size} {disk}
where
{size} is the new size of the disk (for example 8GB) and
{disk} is the full path of the file .vmdk.
This procedure only expands the disk and not the partition. If the virtual disk is partitioned, you will need to use a third-party utility to resize the expanded partitions (Partition Magic, GParted Live CD, Paragon Partition Manager). If you are using the Windows DiskPart utility, it can only extend data volumes; if you use the DiskPart utility to extend a system or boot volume, you may get an error.
21 January 2009 at 5:47 PM
Sorry, but this post is not available in English
2 December 2008 at 11:53 AM
Sorry, but this post is not available in English
27 February 2008 at 3:52 PM
Sorry, but this post is not available in English
17 January 2008 at 11:12 AM
Previous Posts