Thursday, May 14, 2009

Revert a change in SVN commit

Suppose you have made an erroneous commit on a particular file, then you can employ the following strategy.


Assume the file we are looking at is SecurityDomainObjectFactory.

Step 1: Do a SVN log on that particular file.

anil@localhost:$ svn log SecurityDomainObjectFactory.java | head -n 25
------------------------------------------------------------------------
r88837 | anil | 2009-05-13 16:55:08 -0500 (Wed, 13 May 2009) | 1 line

JBAS-6857: merge in rev 88834 from trunk
------------------------------------------------------------------------
r85945 | dimitris | 2009-03-16 14:45:12 -0500 (Mon, 16 Mar 2009) | 1 line


Step 2: Determine the two revisions.
In this case, the most recent is 88837 (anil) and 85945(dimitris).


Step 3: Merge it back
$ svn merge -r88837:85945 SecurityDomainObjectFactory.java

Step 4: SVN diff to see the changes are reverted

Step 5: Check in the reverted file
$> svn ci -m "revert the unintentional change" SecurityDomainObjectFactory.java

==================================

Friday, March 20, 2009

JAXB: Pretty print xml in marshalling

Marshaller marshaller = .....
marshaller.setProperty( Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE );

That should do the trick.

Thursday, March 19, 2009

svn merge a particular revision

Assuming that you have committed a few changes to trunk and want to merge the same to a branch, you can use the "merge -c xyz" pattern as follows:

Let us say that the revision that I committed my changes on the trunk was "86077". I do a dry run to check what changes will get merged if I do the real thing.

============================
anil@localhost:~/Branch_5_x$ svn merge -c 86077 https://svn.jboss.org/repos/jbossas/trunk/ --dry-run
U component-matrix/pom.xml
U server/src/main/org/jboss/deployment/security/AbstractSecurityDeployer.java
U server/src/main/org/jboss/deployment/security/EjbPolicyConfigurationFacade.java
U server/src/main/org/jboss/web/deployers/WarSecurityDeployer.java
A server/src/main/org/jboss/web/deployers/SecurityActions.java
U server/src/etc/deployers/security-deployer-jboss-beans.xml
A testsuite/src/resources/web/xacml/requestAttrib/WEB-INF/jbossxacml-config.xml
A testsuite/src/resources/security/authorization/xacml-ejb/META-INF/jbossxacml-config.xml
U testsuite/imports/sections/security.xml
U testsuite/imports/sections/web.xml
U security/.classpath
A security/src/main/org/jboss/security/deployers
A security/src/main/org/jboss/security/deployers/XacmlConfigParsingDeployer.java
A security/src/main/org/jboss/security/deployers/JAXBElementParsingDeployer.java
A security/src/main/org/jboss/security/deployers/AclConfigParsingDeployer.java
U security/pom.xml
===============================

Ok. Those are the changes I want it into my branch. Now I do the real merge without the "--dry-run" option.

======================================
anil@localhost:~/Branch_5_x$ svn merge -c 86077 https://svn.jboss.org/repos/jbossas/trunk/
U component-matrix/pom.xml
U server/src/main/org/jboss/deployment/security/AbstractSecurityDeployer.java
U server/src/main/org/jboss/deployment/security/EjbPolicyConfigurationFacade.java
U server/src/main/org/jboss/web/deployers/WarSecurityDeployer.java
A server/src/main/org/jboss/web/deployers/SecurityActions.java
U server/src/etc/deployers/security-deployer-jboss-beans.xml
A testsuite/src/resources/web/xacml/requestAttrib/WEB-INF/jbossxacml-config.xml
A testsuite/src/resources/security/authorization/xacml-ejb/META-INF/jbossxacml-config.xml
U testsuite/imports/sections/security.xml
U testsuite/imports/sections/web.xml
U security/.classpath
A security/src/main/org/jboss/security/deployers
A security/src/main/org/jboss/security/deployers/XacmlConfigParsingDeployer.java
A security/src/main/org/jboss/security/deployers/JAXBElementParsingDeployer.java
A security/src/main/org/jboss/security/deployers/AclConfigParsingDeployer.java
U security/pom.xml
anil@localhost:~/Branch_5_x$
=============================