Просмотр исходного кода

lib/config: Bump config version to 14

GitHub-Pull-Request: https://github.com/syncthing/syncthing/pull/3092
Jakob Borg 9 лет назад
Родитель
Сommit
5d2414dfa9

+ 9 - 2
lib/config/config.go

@@ -23,7 +23,7 @@ import (
 
 const (
 	OldestHandledVersion = 10
-	CurrentVersion       = 13
+	CurrentVersion       = 14
 	MaxRescanIntervalS   = 365 * 24 * 60 * 60
 )
 
@@ -198,6 +198,9 @@ func (cfg *Configuration) prepare(myID protocol.DeviceID) {
 	if cfg.Version == 12 {
 		convertV12V13(cfg)
 	}
+	if cfg.Version == 13 {
+		convertV13V14(cfg)
+	}
 
 	// Build a list of available devices
 	existingDevices := make(map[protocol.DeviceID]bool)
@@ -251,7 +254,7 @@ func (cfg *Configuration) prepare(myID protocol.DeviceID) {
 	}
 }
 
-func convertV12V13(cfg *Configuration) {
+func convertV13V14(cfg *Configuration) {
 	// Not using the ignore cache is the new default. Disable it on existing
 	// configurations.
 	cfg.Options.CacheIgnoredFiles = false
@@ -300,6 +303,10 @@ func convertV12V13(cfg *Configuration) {
 		cfg.Folders[i].DeprecatedReadOnly = false
 	}
 
+	cfg.Version = 14
+}
+
+func convertV12V13(cfg *Configuration) {
 	if cfg.Options.ReleasesURL == "https://api.github.com/repos/syncthing/syncthing/releases?per_page=30" {
 		cfg.Options.ReleasesURL = "https://upgrades.syncthing.net/meta.json"
 	}

+ 1 - 1
lib/config/testdata/overridenvalues.xml

@@ -1,4 +1,4 @@
-<configuration version="13">
+<configuration version="14">
     <options>
         <listenAddress>tcp://:23000</listenAddress>
         <allowDelete>false</allowDelete>

+ 1 - 1
lib/config/testdata/v13.xml

@@ -1,5 +1,5 @@
 <configuration version="13">
-    <folder id="test" path="testdata" type="readonly" ignorePerms="false" rescanIntervalS="600" autoNormalize="true">
+    <folder id="test" path="testdata" ro="true" ignorePerms="false" rescanIntervalS="600" autoNormalize="true">
         <device id="AIR6LPZ-7K4PTTV-UXQSMUU-CPQ5YWH-OEDFIIQ-JUG777G-2YQXXR5-YD6AWQR"></device>
         <device id="P56IOI7-MZJNU2Y-IQGDREY-DM2MGTI-MGL3BXN-PQ6W5BM-TBBZ4TJ-XZWICQ2"></device>
         <minDiskFreePct>1</minDiskFreePct>

+ 14 - 0
lib/config/testdata/v14.xml

@@ -0,0 +1,14 @@
+<configuration version="14">
+    <folder id="test" path="testdata" type="readonly" ignorePerms="false" rescanIntervalS="600" autoNormalize="true">
+        <device id="AIR6LPZ-7K4PTTV-UXQSMUU-CPQ5YWH-OEDFIIQ-JUG777G-2YQXXR5-YD6AWQR"></device>
+        <device id="P56IOI7-MZJNU2Y-IQGDREY-DM2MGTI-MGL3BXN-PQ6W5BM-TBBZ4TJ-XZWICQ2"></device>
+        <minDiskFreePct>1</minDiskFreePct>
+        <maxConflicts>-1</maxConflicts>
+    </folder>
+    <device id="AIR6LPZ-7K4PTTV-UXQSMUU-CPQ5YWH-OEDFIIQ-JUG777G-2YQXXR5-YD6AWQR" name="node one" compression="metadata">
+        <address>tcp://a</address>
+    </device>
+    <device id="P56IOI7-MZJNU2Y-IQGDREY-DM2MGTI-MGL3BXN-PQ6W5BM-TBBZ4TJ-XZWICQ2" name="node two" compression="metadata">
+        <address>tcp://b</address>
+    </device>
+</configuration>