Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/monodevelop.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Hutchinson <m.j.hutchinson@gmail.com>2011-08-09 20:00:11 +0400
committerMichael Hutchinson <m.j.hutchinson@gmail.com>2011-08-09 20:03:15 +0400
commit19205c80ae9a2016e7a131a2dd4614789c881e35 (patch)
tree031391bb757784a5ad3c989067e1c02b6da09dba /main/src/core
parent7da2171b6d5e71074513c123537e5ccf146e2d7e (diff)
Profile migrations from 2.6
Diffstat (limited to 'main/src/core')
-rw-r--r--main/src/core/MonoDevelop.Core/MonoDevelop.Core.AddIns/UserDataMigrationNode.cs30
-rw-r--r--main/src/core/MonoDevelop.Core/MonoDevelop.Core.addin.xml11
-rw-r--r--main/src/core/MonoDevelop.Core/MonoDevelop.Core/PropertyService.cs7
-rw-r--r--main/src/core/MonoDevelop.Core/MonoDevelop.Core/Runtime.cs4
-rw-r--r--main/src/core/MonoDevelop.Core/MonoDevelop.Core/UserDataMigrationService.cs5
-rw-r--r--main/src/core/MonoDevelop.Core/MonoDevelop.Core/UserProfile.cs7
-rw-r--r--main/src/core/MonoDevelop.Ide/ExtensionModel/MonoDevelop.Ide.addin.xml20
7 files changed, 60 insertions, 24 deletions
diff --git a/main/src/core/MonoDevelop.Core/MonoDevelop.Core.AddIns/UserDataMigrationNode.cs b/main/src/core/MonoDevelop.Core/MonoDevelop.Core.AddIns/UserDataMigrationNode.cs
index f48feb022f..a14d62514c 100644
--- a/main/src/core/MonoDevelop.Core/MonoDevelop.Core.AddIns/UserDataMigrationNode.cs
+++ b/main/src/core/MonoDevelop.Core/MonoDevelop.Core.AddIns/UserDataMigrationNode.cs
@@ -32,18 +32,21 @@ namespace MonoDevelop.Core.AddIns
{
class UserDataMigrationNode: ExtensionNode
{
- [NodeAttribute (Required=true)]
+ [NodeAttribute (Required=true, Description="The version of the source profile for this migration applies.")]
string sourceVersion;
- [NodeAttribute (Required=true)]
- string sourcePath;
+ [NodeAttribute (Required=true, Description="The relative path of the data")]
+ string path;
- [NodeAttribute ()]
+ [NodeAttribute (Description="The relative path of the target, if it differs from the source")]
string targetPath;
- [NodeAttribute (Required=true)]
+ [NodeAttribute (Required=true, Description="The kind of the data to be migrated")]
UserDataKind kind;
+ [NodeAttribute (Description="The kind of the target, if it differs from the source")]
+ string targetKind;
+
[NodeAttribute (Name="handler")]
string handlerTypeName;
@@ -52,20 +55,28 @@ namespace MonoDevelop.Core.AddIns
}
public FilePath SourcePath {
- get { return FileService.MakePathSeparatorsNative (sourcePath); }
+ get { return FileService.MakePathSeparatorsNative (path); }
}
public FilePath TargetPath {
get {
return FileService.MakePathSeparatorsNative (
- string.IsNullOrEmpty (targetPath)? sourcePath : targetPath);
+ string.IsNullOrEmpty (targetPath)? path : targetPath);
}
}
- public UserDataKind Kind {
+ public UserDataKind SourceKind {
get { return kind; }
}
+ public UserDataKind TargetKind {
+ get {
+ return string.IsNullOrEmpty (targetKind)
+ ? kind
+ : (UserDataKind) Enum.Parse (typeof (UserDataKind), targetKind);
+ }
+ }
+
public IUserDataMigrationHandler GetHandler ()
{
if (string.IsNullOrEmpty (handlerTypeName))
@@ -73,5 +84,4 @@ namespace MonoDevelop.Core.AddIns
return (IUserDataMigrationHandler) Activator.CreateInstance (Addin.GetType (handlerTypeName));
}
}
-}
-
+} \ No newline at end of file
diff --git a/main/src/core/MonoDevelop.Core/MonoDevelop.Core.addin.xml b/main/src/core/MonoDevelop.Core/MonoDevelop.Core.addin.xml
index 3fbb8d929d..469292bfef 100644
--- a/main/src/core/MonoDevelop.Core/MonoDevelop.Core.addin.xml
+++ b/main/src/core/MonoDevelop.Core/MonoDevelop.Core.addin.xml
@@ -185,10 +185,15 @@
</Extension>
<Extension path = "/MonoDevelop/Core/UserDataMigration">
- <Migration sourceVersion="2.4" kind="Config" sourcePath="mono-runtimes.xml" />
- <Migration sourceVersion="2.4" kind="UserData" sourcePath="DefaultPolicies.xml" targetPath="Policies/Default.mdpolicy.xml" />
+ <!-- 2.4 -->
+ <Migration sourceVersion="2.4" kind="Config" path="mono-runtimes.xml" />
+ <Migration sourceVersion="2.4" kind="UserData" path="DefaultPolicies.xml" targetPath="Policies/Default.mdpolicy.xml" />
<!-- the following file belongs to the instrumentation viewer but it's not an addin so can't register for migrations -->
- <Migration sourceVersion="2.4" kind="Config" sourcePath="monitor-views.xml" />
+ <Migration sourceVersion="2.4" kind="Config" path="monitor-views.xml" />
+ <!-- 2.6 -->
+ <Migration sourceVersion="2.6" kind="Config" targetKind="LocalConfig" path="mono-runtimes.xml" />
+ <Migration sourceVersion="2.6" kind="UserData" path="Policies" isDirectory="true" />
+ <Migration sourceVersion="2.6" kind="Config" path="monitor-views.xml" />
</Extension>
<Extension path = "/MonoDevelop/Core/Applications">
diff --git a/main/src/core/MonoDevelop.Core/MonoDevelop.Core/PropertyService.cs b/main/src/core/MonoDevelop.Core/MonoDevelop.Core/PropertyService.cs
index 5ffa605c2b..89ec438ea9 100644
--- a/main/src/core/MonoDevelop.Core/MonoDevelop.Core/PropertyService.cs
+++ b/main/src/core/MonoDevelop.Core/MonoDevelop.Core/PropertyService.cs
@@ -37,6 +37,10 @@ namespace MonoDevelop.Core
{
public static class PropertyService
{
+ //force the static class to intialize
+ internal static void Initialize ()
+ {
+ }
readonly static string FileName = "MonoDevelopProperties.xml";
static Properties properties;
@@ -113,8 +117,7 @@ namespace MonoDevelop.Core
profile = null;
version = null;
- //TODO: check 2.6 when 2.8 is released, etc
- string[] migratableVersions = { };
+ string[] migratableVersions = UserProfile.GetMigratableVersions ();
//try versioned profiles
for (int i = migratableVersions.Length -1; i >= 0; i--) {
diff --git a/main/src/core/MonoDevelop.Core/MonoDevelop.Core/Runtime.cs b/main/src/core/MonoDevelop.Core/MonoDevelop.Core/Runtime.cs
index 36c03deec5..976b5fed76 100644
--- a/main/src/core/MonoDevelop.Core/MonoDevelop.Core/Runtime.cs
+++ b/main/src/core/MonoDevelop.Core/MonoDevelop.Core/Runtime.cs
@@ -86,7 +86,9 @@ namespace MonoDevelop.Core
setupService = new AddinSetupService (AddinManager.Registry);
Counters.RuntimeInitialization.Trace ("Initialized Addin Manager");
- //have to do this after the addin service is initialized
+ PropertyService.Initialize ();
+
+ //have to do this after the addin service and property service have initialized
if (UserDataMigrationService.HasSource) {
Counters.RuntimeInitialization.Trace ("Migrating User Data from MD " + UserDataMigrationService.SourceVersion);
UserDataMigrationService.StartMigration ();
diff --git a/main/src/core/MonoDevelop.Core/MonoDevelop.Core/UserDataMigrationService.cs b/main/src/core/MonoDevelop.Core/MonoDevelop.Core/UserDataMigrationService.cs
index c6683d4fe4..0dc88926a8 100644
--- a/main/src/core/MonoDevelop.Core/MonoDevelop.Core/UserDataMigrationService.cs
+++ b/main/src/core/MonoDevelop.Core/MonoDevelop.Core/UserDataMigrationService.cs
@@ -78,6 +78,7 @@ namespace MonoDevelop.Core
if (args.Change != ExtensionChange.Add)
return;
+ //FIXME: support ranges in SourceVersion
var node = (UserDataMigrationNode) args.ExtensionNode;
if (node.SourceVersion != version)
return;
@@ -86,8 +87,8 @@ namespace MonoDevelop.Core
FilePath target = FilePath.Null;
try {
- source = profile.GetLocation (node.Kind).Combine (node.SourcePath);
- target = UserProfile.Current.GetLocation (node.Kind).Combine (node.TargetPath);
+ source = profile.GetLocation (node.SourceKind).Combine (node.SourcePath);
+ target = UserProfile.Current.GetLocation (node.TargetKind).Combine (node.TargetPath);
bool sourceIsDirectory = Directory.Exists (source);
diff --git a/main/src/core/MonoDevelop.Core/MonoDevelop.Core/UserProfile.cs b/main/src/core/MonoDevelop.Core/MonoDevelop.Core/UserProfile.cs
index 6a0742442e..c7f24c4e72 100644
--- a/main/src/core/MonoDevelop.Core/MonoDevelop.Core/UserProfile.cs
+++ b/main/src/core/MonoDevelop.Core/MonoDevelop.Core/UserProfile.cs
@@ -33,6 +33,13 @@ namespace MonoDevelop.Core
const string APP_ID = "MonoDevelop";
const string CURRENT_PROFILE_VERSION = "2.7";
+ internal static string[] GetMigratableVersions ()
+ {
+ return new[] {
+ "2.6",
+ };
+ }
+
static readonly UserProfile currentProfile = GetCurrentProfile ();
public static UserProfile Current { get { return currentProfile; } }
diff --git a/main/src/core/MonoDevelop.Ide/ExtensionModel/MonoDevelop.Ide.addin.xml b/main/src/core/MonoDevelop.Ide/ExtensionModel/MonoDevelop.Ide.addin.xml
index 0a7647fd9c..8fbb481cb6 100644
--- a/main/src/core/MonoDevelop.Ide/ExtensionModel/MonoDevelop.Ide.addin.xml
+++ b/main/src/core/MonoDevelop.Ide/ExtensionModel/MonoDevelop.Ide.addin.xml
@@ -235,11 +235,19 @@
</Extension>
<Extension path = "/MonoDevelop/Core/UserDataMigration">
- <Migration sourceVersion="2.4" kind="UserData" sourcePath="KeyBindings.xml" targetPath="KeyBindings/Custom.kb.xml" />
- <Migration sourceVersion="2.4" kind="UserData" sourcePath="KeyBindingsMac.xml" targetPath="KeyBindings/Custom.kb-mac.xml" />
- <Migration sourceVersion="2.4" kind="UserData" isDirectory="true" sourcePath="templates/code" targetPath="Snippets" />
- <Migration sourceVersion="2.4" kind="Config" sourcePath="custom-command-modes.xml" />
- <Migration sourceVersion="2.4" kind="Config" sourcePath="MonoDevelop-tools.xml" />
- <Migration sourceVersion="2.4" kind="Config" sourcePath="EditingLayout2.xml" targetPath="EditingLayout.xml"/>
+ <!-- 2.4 -->
+ <Migration sourceVersion="2.4" kind="UserData" path="KeyBindings.xml" targetPath="KeyBindings/Custom.kb.xml" />
+ <Migration sourceVersion="2.4" kind="UserData" path="KeyBindingsMac.xml" targetPath="KeyBindings/Custom.kb-mac.xml" />
+ <Migration sourceVersion="2.4" kind="UserData" path="templates/code" targetPath="Snippets" isDirectory="true" />
+ <Migration sourceVersion="2.4" kind="Config" path="custom-command-modes.xml" />
+ <Migration sourceVersion="2.4" kind="Config" path="MonoDevelop-tools.xml" />
+ <Migration sourceVersion="2.4" kind="Config" path="EditingLayout2.xml" targetPath="EditingLayout.xml"/>
+ <!-- 2.6 -->
+ <Migration sourceVersion="2.6" kind="UserData" path="KeyBindings" isDirectory="true" />
+ <Migration sourceVersion="2.6" kind="UserData" path="Snippets" isDirectory="true" />
+ <Migration sourceVersion="2.6" kind="Config" path="custom-command-modes.xml" />
+ <Migration sourceVersion="2.6" kind="Config" path="MonoDevelop-tools.xml" />
+ <Migration sourceVersion="2.6" kind="Config" path="EditingLayout.xml" />
+ <Migration sourceVersion="2.6" kind="LocalConfig" path="RecentlyUsed.xml" />
</Extension>
</Addin>