Incorrectly applied TortoiseSVN patch file

I am trying to use SVN patch files to remove authentication from the web API during development. The patch file for removing authentication works fine and looks like this:

Index: WebApplication.Api/Global.asax.cs
===================================================================
--- WebApplication.Api/Global.asax.cs   (revision 18939)
+++ WebApplication.Api/Global.asax.cs   (working copy)
@@ -115,7 +115,7 @@
             _dependencyRegister.AddRegistration<WebApplication.Application.Aspects.AuthorisationAspect>();

             // WebApplication.Application.CurrentUser
-            _dependencyRegister.AddRegistration<WebApplication.Application.CurrentUser.ICurrentUserService, WebApplication.Application.CurrentUser.CurrentUserService>();
+            _dependencyRegister.AddRegistration<WebApplication.Application.CurrentUser.ICurrentUserService, WebApplication.Api.DummyServices.CurrentUserService>();

             // WebApplication.Application.Interface.Manager
             _dependencyRegister.AddRegistration<WebApplication.Application.Interface.Manager.IAspNetMembershipManager, WebApplication.Application.Manager.AspNetMembershipManager>();
Index: WebApplication.Api/Web.config
===================================================================
--- WebApplication.Api/Web.config   (revision 18939)
+++ WebApplication.Api/Web.config   (working copy)
@@ -64,14 +64,12 @@
     </sessionState>
       <httpModules>
           <add name="PerRequestLifestyle" type="Castle.MicroKernel.Lifestyle.PerWebRequestLifestyleModule, Castle.Windsor" />
-          <add name="ProtectedResourceModule" type="WebApplication.Api.Modules.ProtectionModule"/>
       </httpModules>
   </system.web>
   <system.webServer>
     <validation validateIntegratedModeConfiguration="false" />
       <modules runAllManagedModulesForAllRequests="true">
           <add name="PerRequestLifestyle" type="Castle.MicroKernel.Lifestyle.PerWebRequestLifestyleModule, Castle.Windsor" />
-          <add name="ProtectedResourceModule" type="WebApplication.Api.Modules.ProtectionModule"/>
       </modules>
       <httpErrors existingResponse="PassThrough" />
   </system.webServer>

As you can see, it modifies the implementation of the DI interface and removes two nodes from the XML configuration file.

Since there is no way (which I found) to reverse apply the patch (I use VisualSVN in Visual Studio to apply the patch), I created a “reverse patch” based on the source patch file:

Index: WebApplication.Api/Global.asax.cs
===================================================================
--- WebApplication.Api/Global.asax.cs   (revision 18939)
+++ WebApplication.Api/Global.asax.cs   (working copy)
@@ -115,7 +115,7 @@
             _dependencyRegister.AddRegistration<WebApplication.Application.Aspects.AuthorisationAspect>();

             // WebApplication.Application.CurrentUser
+            _dependencyRegister.AddRegistration<WebApplication.Application.CurrentUser.ICurrentUserService, WebApplication.Application.CurrentUser.CurrentUserService>();
-            _dependencyRegister.AddRegistration<WebApplication.Application.CurrentUser.ICurrentUserService, WebApplication.Api.DummyServices.CurrentUserService>();

             // WebApplication.Application.Interface.Manager
             _dependencyRegister.AddRegistration<WebApplication.Application.Interface.Manager.IAspNetMembershipManager, WebApplication.Application.Manager.AspNetMembershipManager>();
Index: WebApplication.Api/Web.config
===================================================================
--- WebApplication.Api/Web.config   (revision 18939)
+++ WebApplication.Api/Web.config   (working copy)
@@ -64,14 +64,12 @@
     </sessionState>
       <httpModules>
           <add name="PerRequestLifestyle" type="Castle.MicroKernel.Lifestyle.PerWebRequestLifestyleModule, Castle.Windsor" />
+          <add name="ProtectedResourceModule" type="WebApplication.Api.Modules.ProtectionModule"/>
       </httpModules>
   </system.web>
   <system.webServer>
     <validation validateIntegratedModeConfiguration="false" />
       <modules runAllManagedModulesForAllRequests="true">
           <add name="PerRequestLifestyle" type="Castle.MicroKernel.Lifestyle.PerWebRequestLifestyleModule, Castle.Windsor" />
+          <add name="ProtectedResourceModule" type="WebApplication.Api.Modules.ProtectionModule"/>
       </modules>
       <httpErrors existingResponse="PassThrough" />
   </system.webServer>

Rather simplified, all I did was change + characters to - and vice versa. This creates a reverse patch file that makes sense to me.

, , XML, , XML.

- , ? - @@ -64,14 +64,12 @@?

+3
3

, - . Visual SVN Tortoise, , .

:

svn patch [path and name of patch file]

:

svn patch --reverse-diff [path and name of patch file]
+4

, , . :

, , . .

diff command, , .

+4

Will the replacement work 14and 12? (Change @@ -64,14 +64,12 @@to @@ -64,12 +64,14)

0
source

All Articles