From 7d18a93c2edfabe4348bb445739ef531bba12cea Mon Sep 17 00:00:00 2001
From: Adam Frisby
Date: Sun, 20 Apr 2008 04:15:12 +0000
Subject: * Added experimental "svn load <revision>" command to allow you to
 load a region from a specified SVN revision. Potentially useful for
 rollbacks.

---
 .../Modules/SvnSerialiser/SvnBackupModule.cs       | 45 ++++++++++++++++++----
 1 file changed, 38 insertions(+), 7 deletions(-)

(limited to 'OpenSim/Region')

diff --git a/OpenSim/Region/Modules/SvnSerialiser/SvnBackupModule.cs b/OpenSim/Region/Modules/SvnSerialiser/SvnBackupModule.cs
index 0c1ee33..26f1fa3 100644
--- a/OpenSim/Region/Modules/SvnSerialiser/SvnBackupModule.cs
+++ b/OpenSim/Region/Modules/SvnSerialiser/SvnBackupModule.cs
@@ -149,22 +149,53 @@ namespace OpenSim.Region.Modules.SvnSerialiser
         {
             if (args[0] == "svn" && args[1] == "save")
             {
-                foreach (Scene scene in m_scenes)
+                SaveAllScenes();
+            }
+            if (args.Length == 2)
+            {
+                if (args[0] == "svn" && args[1] == "load")
                 {
-                    SaveRegion(scene);
+                    LoadAllScenes();
                 }
             }
-            if (args[0] == "svn" && args[1] == "load")
+            if (args.Length == 3)
             {
-                CheckoutSvn();
-
-                foreach (Scene scene in m_scenes)
+                if (args[0] == "svn" && args[1] == "load")
                 {
-                    LoadRegion(scene);
+                    LoadAllScenes(Int32.Parse(args[2]));
                 }
             }
         }
 
+        private void LoadAllScenes()
+        {
+            CheckoutSvn();
+
+            foreach (Scene scene in m_scenes)
+            {
+                LoadRegion(scene);
+            }
+        }
+
+
+        private void LoadAllScenes(int revision)
+        {
+            CheckoutSvn(new SvnRevision(revision));
+
+            foreach (Scene scene in m_scenes)
+            {
+                LoadRegion(scene);
+            }
+        }
+
+        private void SaveAllScenes()
+        {
+            foreach (Scene scene in m_scenes)
+            {
+                SaveRegion(scene);
+            }
+        }
+
         public void PostInitialise()
         {
             if (m_enabled == false)
-- 
cgit v1.1