[Monodevelop-patches-list] r2620 - in trunk/MonoDevelop/Extras/VersionControl: . AddIn Diff DiffWidget VersionControl
Joshua Tauberer
joshua at mono-cvs.ximian.com
Fri Jul 1 19:56:15 EDT 2005
Author: joshua
Date: 2005-07-01 19:56:15 -0400 (Fri, 01 Jul 2005)
New Revision: 2620
Added:
trunk/MonoDevelop/Extras/VersionControl/AddIn/AddIn.mdp
trunk/MonoDevelop/Extras/VersionControl/AddIn/mds_postbuild.sh
trunk/MonoDevelop/Extras/VersionControl/Diff/Diff.mdp
trunk/MonoDevelop/Extras/VersionControl/DiffWidget/DiffWidget.mdp
trunk/MonoDevelop/Extras/VersionControl/VersionControl.mds
trunk/MonoDevelop/Extras/VersionControl/VersionControl/VersionControl.mdp
Modified:
trunk/MonoDevelop/Extras/VersionControl/AddIn/Addin.cs
trunk/MonoDevelop/Extras/VersionControl/AddIn/VersionControl.addin.xml
trunk/MonoDevelop/Extras/VersionControl/ChangeLog
trunk/MonoDevelop/Extras/VersionControl/VersionControl/Subversion.cs
Log:
* Added MD solution files for VersionControl.
* Project pad overlays now update when files
are modified.
* Project pad context menus enabled for
folders and combines.
* Subversion: Don't report diffs available
for unchanged files.
* This was committed with the addin!
Added: trunk/MonoDevelop/Extras/VersionControl/AddIn/AddIn.mdp
===================================================================
--- trunk/MonoDevelop/Extras/VersionControl/AddIn/AddIn.mdp 2005-07-01 16:47:36 UTC (rev 2619)
+++ trunk/MonoDevelop/Extras/VersionControl/AddIn/AddIn.mdp 2005-07-01 23:56:15 UTC (rev 2620)
@@ -0,0 +1,46 @@
+<Project name="AddIn" fileversion="2.0" language="C#" ctype="DotNetProject">
+ <Configurations>
+ <Configuration name="Debug" ctype="DotNetProjectConfiguration">
+ <Output directory="../../../build/AddIns/VersionControl" assembly="VersionControlAddIn" />
+ <Build executeAfterBuild="./mds_postbuild.sh" debugmode="True" target="Library" />
+ <Execution runwithwarnings="True" consolepause="True" runtime="MsNet" />
+ <CodeGeneration compiler="Csc" warninglevel="4" optimize="True" unsafecodeallowed="False" generateoverflowchecks="True" mainclass="" generatexmldocumentation="False" ctype="CSharpCompilerParameters" />
+ </Configuration>
+ <Configuration name="Release" ctype="DotNetProjectConfiguration">
+ <Output directory="../../../build/AddIns/VersionControl" assembly="VersionControlAddIn" />
+ <Build debugmode="False" target="Library" />
+ <Execution runwithwarnings="True" consolepause="True" runtime="MsNet" />
+ <CodeGeneration compiler="Csc" warninglevel="4" optimize="True" unsafecodeallowed="False" generateoverflowchecks="True" mainclass="" generatexmldocumentation="False" ctype="CSharpCompilerParameters" />
+ </Configuration>
+ </Configurations>
+ <References>
+ <ProjectReference type="Project" localcopy="True" refto="VersionControl" />
+ <ProjectReference type="Project" localcopy="True" refto="DiffWidget" />
+ <ProjectReference type="Project" localcopy="True" refto="Diff" />
+ <ProjectReference type="Gac" localcopy="True" refto="gtk-sharp, Version=2.6.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" />
+ <ProjectReference type="Assembly" localcopy="True" refto="../../../build/bin/MonoDevelop.Base.dll" />
+ <ProjectReference type="Assembly" localcopy="True" refto="../../../build/bin/MonoDevelop.Core.dll" />
+ <ProjectReference type="Assembly" localcopy="True" refto="../../../build/bin/MonoDevelop.Dock.dll" />
+ <ProjectReference type="Assembly" localcopy="True" refto="../../../build/bin/MonoDevelop.exe" />
+ <ProjectReference type="Assembly" localcopy="True" refto="../../../build/bin/MonoDevelop.Gui.Utils.dll" />
+ <ProjectReference type="Assembly" localcopy="True" refto="../../../build/bin/MonoDevelop.Gui.Widgets.dll" />
+ <ProjectReference type="Assembly" localcopy="True" refto="../../../build/bin/MonoDevelop.SourceEditor.dll" />
+ </References>
+ <DeploymentInformation strategy="File">
+ <excludeFiles />
+ </DeploymentInformation>
+ <Contents>
+ <File name="./Addin.cs" subtype="Code" buildaction="Compile" />
+ <File name="./Diffs.cs" subtype="Code" buildaction="Compile" />
+ <File name="./Logs.cs" subtype="Code" buildaction="Compile" />
+ <File name="./Statuses.cs" subtype="Code" buildaction="Compile" />
+ <File name="./Task.cs" subtype="Code" buildaction="Compile" />
+ <File name="./Update.cs" subtype="Code" buildaction="Compile" />
+ <File name="./VersionControl.addin.xml" subtype="Code" buildaction="Nothing" />
+ <File name="./overlay_added.png" subtype="Code" buildaction="EmbedAsResource" />
+ <File name="./overlay_conflicted.png" subtype="Code" buildaction="EmbedAsResource" />
+ <File name="./overlay_locked.png" subtype="Code" buildaction="EmbedAsResource" />
+ <File name="./overlay_modified.png" subtype="Code" buildaction="EmbedAsResource" />
+ <File name="./overlay_normal.png" subtype="Code" buildaction="EmbedAsResource" />
+ </Contents>
+</Project>
\ No newline at end of file
Modified: trunk/MonoDevelop/Extras/VersionControl/AddIn/Addin.cs
===================================================================
--- trunk/MonoDevelop/Extras/VersionControl/AddIn/Addin.cs 2005-07-01 16:47:36 UTC (rev 2619)
+++ trunk/MonoDevelop/Extras/VersionControl/AddIn/Addin.cs 2005-07-01 23:56:15 UTC (rev 2620)
@@ -7,6 +7,7 @@
using MonoDevelop.Gui;
using MonoDevelop.Core;
using MonoDevelop.Gui.Pads;
+using MonoDevelop.Gui.Pads.ProjectPad;
using MonoDevelop.Internal.Project;
using MonoDevelop.Commands;
using MonoDevelop.Services;
@@ -42,48 +43,97 @@
}
public class VersionControlNodeExtension : NodeBuilderExtension {
+ Hashtable projectsWatched = new Hashtable();
+ Hashtable fileStatus = new Hashtable();
+
public override bool CanBuildNode (Type dataType) {
//Console.Error.WriteLine(dataType);
return typeof(ProjectFile).IsAssignableFrom (dataType)
- || typeof(DotNetProject).IsAssignableFrom (dataType);
- // TODO: Folders
+ || typeof(DotNetProject).IsAssignableFrom (dataType)
+ || typeof(ProjectFolder).IsAssignableFrom (dataType)
+ || typeof(Combine).IsAssignableFrom (dataType);
}
public override void BuildNode (ITreeBuilder builder, object dataObject, ref string label, ref Gdk.Pixbuf icon, ref Gdk.Pixbuf closedIcon) {
// Add status overlays
- // TODO: Watch the files in some way to detect
- // when the overlay should be changed.
-
if (!(dataObject is ProjectFile)) return;
if (!builder.Options["ShowVersionControlOverlays"])
return;
ProjectFile file = (ProjectFile) dataObject;
+
+ WatchProject(file.Project);
+
+ // When a file had a status and later has no status,
+ // for whatever reason, it needs to be removed from the hashtable.
+ fileStatus.Remove(file.FilePath);
+
try {
- foreach (VersionControlSystem vc in VersionControlService.Providers) {
- if (vc.IsFileStatusAvailable(file.FilePath)) {
- Node node = vc.GetFileStatus(file.FilePath, false);
-
- Gdk.Pixbuf overlay = VersionControlService.LoadIconForStatus(node.Status);
-
- double scale = (double)(2*icon.Width/3) / (double)overlay.Width;
- int w = (int)(overlay.Width*scale);
- int h = (int)(overlay.Height*scale);
- icon = icon.Copy();
- overlay.Composite(icon,
- icon.Width-w, icon.Height-h,
- w, h,
- icon.Width-w, icon.Height-h,
- scale,scale, Gdk.InterpType.Bilinear, 255);
- break;
- }
- }
+ NodeStatus status = GetStatus(file.FilePath);
+ if (status == NodeStatus.Unknown) return;
+
+ fileStatus[file.FilePath] = status;
+
+ Gdk.Pixbuf overlay = VersionControlService.LoadIconForStatus(status);
+
+ double scale = (double)(2*icon.Width/3) / (double)overlay.Width;
+ int w = (int)(overlay.Width*scale);
+ int h = (int)(overlay.Height*scale);
+ icon = icon.Copy();
+ overlay.Composite(icon,
+ icon.Width-w, icon.Height-h,
+ w, h,
+ icon.Width-w, icon.Height-h,
+ scale,scale, Gdk.InterpType.Bilinear, 255);
} catch (Exception e) {
- Console.Error.WriteLine(e);
}
}
+ NodeStatus GetStatus(string filepath) {
+ foreach (VersionControlSystem vc in VersionControlService.Providers) {
+ if (vc.IsFileStatusAvailable(filepath)) {
+ Node node = vc.GetFileStatus(filepath, false);
+ return node.Status;
+ }
+ }
+ return NodeStatus.Unknown;
+ }
+
+ void WatchProject(Project project) {
+ if (projectsWatched.ContainsKey(project)) return;
+ projectsWatched[project] = projectsWatched;
+ project.FileChangedInProject += new ProjectFileEventHandler(Monitor);
+ }
+
+ void Monitor(object sender, ProjectFileEventArgs args) {
+ // If the status of the file actually changed, then
+ // update the project pad so the overlays are updated.
+
+ string file = args.ProjectFile.FilePath;
+
+ NodeStatus newstatus = GetStatus(file);
+ if (newstatus == NodeStatus.Unknown && !fileStatus.ContainsKey(file))
+ return; // had no status before, has no status now
+
+ if (!fileStatus.ContainsKey(file)
+ || (fileStatus.ContainsKey(file)
+ && (NodeStatus)fileStatus[file] != newstatus)) {
+ // No status before and has status now, or
+ // status changed. Refresh the project pad.
+ ITreeBuilder builder = Context.GetTreeBuilder(args.ProjectFile);
+ if (builder != null)
+ builder.UpdateAll();
+ }
+ }
+
+ public override void Dispose() {
+ foreach (Project p in projectsWatched.Keys)
+ p.FileChangedInProject -= new ProjectFileEventHandler(Monitor);
+ projectsWatched.Clear();
+ }
+
+
public override Type CommandHandlerType {
get { return typeof(AddinCommandHandler); }
}
@@ -144,7 +194,7 @@
private bool RunCommand(Commands cmd, bool test) {
string path;
bool isDir;
-
+
if (CurrentNode.DataItem is ProjectFile) {
ProjectFile file = (ProjectFile)CurrentNode.DataItem;
path = file.FilePath;
@@ -153,6 +203,14 @@
DotNetProject project = (DotNetProject)CurrentNode.DataItem;
path = project.BaseDirectory;
isDir = true;
+ } else if (CurrentNode.DataItem is ProjectFolder) {
+ ProjectFolder f = ((ProjectFolder)CurrentNode.DataItem);
+ path = f.Path;
+ isDir = true;
+ } else if (CurrentNode.DataItem is Combine) {
+ Combine c = ((Combine)CurrentNode.DataItem);
+ path = c.BaseDirectory;
+ isDir = true;
} else {
Console.Error.WriteLine(CurrentNode.DataItem);
return false;
Modified: trunk/MonoDevelop/Extras/VersionControl/AddIn/VersionControl.addin.xml
===================================================================
--- trunk/MonoDevelop/Extras/VersionControl/AddIn/VersionControl.addin.xml 2005-07-01 16:47:36 UTC (rev 2619)
+++ trunk/MonoDevelop/Extras/VersionControl/AddIn/VersionControl.addin.xml 2005-07-01 23:56:15 UTC (rev 2620)
@@ -46,5 +46,10 @@
<CommandItem id = "VersionControlPlugin.Commands.Status"/>
<CommandItem id = "VersionControlPlugin.Commands.Log"/>
</Extension>
+ <Extension path = "/SharpDevelop/Views/ProjectBrowser/ContextMenu/CombineBrowserNode">
+ <CommandItem id = "VersionControlPlugin.Commands.Update"/>
+ <CommandItem id = "VersionControlPlugin.Commands.Status"/>
+ <CommandItem id = "VersionControlPlugin.Commands.Log"/>
+ </Extension>
</AddIn>
Added: trunk/MonoDevelop/Extras/VersionControl/AddIn/mds_postbuild.sh
===================================================================
--- trunk/MonoDevelop/Extras/VersionControl/AddIn/mds_postbuild.sh 2005-07-01 16:47:36 UTC (rev 2619)
+++ trunk/MonoDevelop/Extras/VersionControl/AddIn/mds_postbuild.sh 2005-07-01 23:56:15 UTC (rev 2620)
@@ -0,0 +1,2 @@
+#!/bin/sh
+cp VersionControl.addin.xml ../../../build/AddIns/VersionControl
Property changes on: trunk/MonoDevelop/Extras/VersionControl/AddIn/mds_postbuild.sh
___________________________________________________________________
Name: svn:executable
+ *
Modified: trunk/MonoDevelop/Extras/VersionControl/ChangeLog
===================================================================
--- trunk/MonoDevelop/Extras/VersionControl/ChangeLog 2005-07-01 16:47:36 UTC (rev 2619)
+++ trunk/MonoDevelop/Extras/VersionControl/ChangeLog 2005-07-01 23:56:15 UTC (rev 2620)
@@ -1,3 +1,14 @@
+2005-07-01 Joshua Tauberer <tauberer at for.net>
+
+ * Added MD solution files for VersionControl.
+ * Project pad overlays now update when files
+ are modified.
+ * Project pad context menus enabled for
+ folders and combines.
+ * Subversion: Don't report diffs available
+ for unchanged files.
+ * This was committed with the addin!
+
2005-06-22 Joshua Tauberer <tauberer at for.net>
* Added VersionControl into repo (but sadly the addin
Added: trunk/MonoDevelop/Extras/VersionControl/Diff/Diff.mdp
===================================================================
--- trunk/MonoDevelop/Extras/VersionControl/Diff/Diff.mdp 2005-07-01 16:47:36 UTC (rev 2619)
+++ trunk/MonoDevelop/Extras/VersionControl/Diff/Diff.mdp 2005-07-01 23:56:15 UTC (rev 2620)
@@ -0,0 +1,28 @@
+<Project name="Diff" fileversion="2.0" language="C#" ctype="DotNetProject">
+ <Configurations>
+ <Configuration name="Debug" ctype="DotNetProjectConfiguration">
+ <Output directory="../../../build/AddIns/VersionControl" assembly="Diff" />
+ <Build debugmode="True" target="Library" />
+ <Execution runwithwarnings="True" consolepause="True" runtime="MsNet" />
+ <CodeGeneration compiler="Csc" warninglevel="4" optimize="True" unsafecodeallowed="False" generateoverflowchecks="True" mainclass="" generatexmldocumentation="False" ctype="CSharpCompilerParameters" />
+ </Configuration>
+ <Configuration name="Release" ctype="DotNetProjectConfiguration">
+ <Output directory="../../../build/AddIns/VersionControl" assembly="Diff" />
+ <Build debugmode="False" target="Exe" />
+ <Execution runwithwarnings="True" consolepause="True" runtime="MsNet" />
+ <CodeGeneration compiler="Csc" warninglevel="4" optimize="True" unsafecodeallowed="False" generateoverflowchecks="True" generatexmldocumentation="False" ctype="CSharpCompilerParameters" />
+ </Configuration>
+ </Configurations>
+ <References />
+ <DeploymentInformation strategy="File">
+ <excludeFiles />
+ </DeploymentInformation>
+ <Contents>
+ <File name="./Diff.cs" subtype="Code" buildaction="Compile" />
+ <File name="./Merge.cs" subtype="Code" buildaction="Compile" />
+ <File name="./Patch.cs" subtype="Code" buildaction="Compile" />
+ <File name="./StructuredDiff.cs" subtype="Code" buildaction="Compile" />
+ <File name="./TextDiff.cs" subtype="Code" buildaction="Compile" />
+ <File name="./UnifiedDiff.cs" subtype="Code" buildaction="Compile" />
+ </Contents>
+</Project>
\ No newline at end of file
Added: trunk/MonoDevelop/Extras/VersionControl/DiffWidget/DiffWidget.mdp
===================================================================
--- trunk/MonoDevelop/Extras/VersionControl/DiffWidget/DiffWidget.mdp 2005-07-01 16:47:36 UTC (rev 2619)
+++ trunk/MonoDevelop/Extras/VersionControl/DiffWidget/DiffWidget.mdp 2005-07-01 23:56:15 UTC (rev 2620)
@@ -0,0 +1,26 @@
+<Project name="DiffWidget" fileversion="2.0" language="C#" ctype="DotNetProject">
+ <Configurations>
+ <Configuration name="Debug" ctype="DotNetProjectConfiguration">
+ <Output directory="../../../build/AddIns/VersionControl" assembly="DiffWidget" />
+ <Build debugmode="True" target="Library" />
+ <Execution runwithwarnings="True" consolepause="True" runtime="MsNet" />
+ <CodeGeneration compiler="Csc" warninglevel="4" optimize="True" unsafecodeallowed="False" generateoverflowchecks="True" mainclass="" generatexmldocumentation="False" ctype="CSharpCompilerParameters" />
+ </Configuration>
+ <Configuration name="Release" ctype="DotNetProjectConfiguration">
+ <Output directory="../../../build/AddIns/VersionControl" assembly="DiffWidget" />
+ <Build debugmode="False" target="Library" />
+ <Execution runwithwarnings="True" consolepause="True" runtime="MsNet" />
+ <CodeGeneration compiler="Csc" warninglevel="4" optimize="True" unsafecodeallowed="False" generateoverflowchecks="True" mainclass="" generatexmldocumentation="False" ctype="CSharpCompilerParameters" />
+ </Configuration>
+ </Configurations>
+ <References>
+ <ProjectReference type="Project" localcopy="True" refto="Diff" />
+ <ProjectReference type="Gac" localcopy="True" refto="gtk-sharp, Version=2.6.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" />
+ </References>
+ <DeploymentInformation strategy="File">
+ <excludeFiles />
+ </DeploymentInformation>
+ <Contents>
+ <File name="./widget.cs" subtype="Code" buildaction="Compile" />
+ </Contents>
+</Project>
\ No newline at end of file
Modified: trunk/MonoDevelop/Extras/VersionControl/VersionControl/Subversion.cs
===================================================================
--- trunk/MonoDevelop/Extras/VersionControl/VersionControl/Subversion.cs 2005-07-01 16:47:36 UTC (rev 2619)
+++ trunk/MonoDevelop/Extras/VersionControl/VersionControl/Subversion.cs 2005-07-01 23:56:15 UTC (rev 2620)
@@ -31,7 +31,9 @@
}
public override bool IsDiffAvailable(string sourcefile) {
- return File.Exists(GetTextBase(sourcefile));
+ return File.Exists(GetTextBase(sourcefile))
+ && IsFileStatusAvailable(sourcefile)
+ && GetFileStatus(sourcefile, false).Status == NodeStatus.Modified;
}
public override bool IsHistoryAvailable(string sourcefile) {
@@ -39,7 +41,7 @@
}
public override bool IsFileStatusAvailable(string sourcefile) {
- return IsDiffAvailable(sourcefile);
+ return File.Exists(GetTextBase(sourcefile));
}
public override bool IsDirectoryStatusAvailable(string sourcepath) {
Added: trunk/MonoDevelop/Extras/VersionControl/VersionControl/VersionControl.mdp
===================================================================
--- trunk/MonoDevelop/Extras/VersionControl/VersionControl/VersionControl.mdp 2005-07-01 16:47:36 UTC (rev 2619)
+++ trunk/MonoDevelop/Extras/VersionControl/VersionControl/VersionControl.mdp 2005-07-01 23:56:15 UTC (rev 2620)
@@ -0,0 +1,24 @@
+<Project name="VersionControl" fileversion="2.0" language="C#" ctype="DotNetProject">
+ <Configurations>
+ <Configuration name="Debug" ctype="DotNetProjectConfiguration">
+ <Output directory="../../../build/AddIns/VersionControl" assembly="VersionControl" />
+ <Build debugmode="True" target="Library" />
+ <Execution runwithwarnings="True" consolepause="True" runtime="MsNet" />
+ <CodeGeneration compiler="Csc" warninglevel="4" optimize="True" unsafecodeallowed="False" generateoverflowchecks="True" mainclass="" generatexmldocumentation="False" ctype="CSharpCompilerParameters" />
+ </Configuration>
+ <Configuration name="Release" ctype="DotNetProjectConfiguration">
+ <Output directory="../../../build/AddIns/VersionControl" assembly="VersionControl" />
+ <Build debugmode="False" target="Library" />
+ <Execution runwithwarnings="True" consolepause="True" runtime="MsNet" />
+ <CodeGeneration compiler="Csc" warninglevel="4" optimize="True" unsafecodeallowed="False" generateoverflowchecks="True" mainclass="" generatexmldocumentation="False" ctype="CSharpCompilerParameters" />
+ </Configuration>
+ </Configurations>
+ <References />
+ <DeploymentInformation strategy="File">
+ <excludeFiles />
+ </DeploymentInformation>
+ <Contents>
+ <File name="./Subversion.cs" subtype="Code" buildaction="Compile" />
+ <File name="./VersionControl.cs" subtype="Code" buildaction="Compile" />
+ </Contents>
+</Project>
\ No newline at end of file
Added: trunk/MonoDevelop/Extras/VersionControl/VersionControl.mds
===================================================================
--- trunk/MonoDevelop/Extras/VersionControl/VersionControl.mds 2005-07-01 16:47:36 UTC (rev 2619)
+++ trunk/MonoDevelop/Extras/VersionControl/VersionControl.mds 2005-07-01 23:56:15 UTC (rev 2620)
@@ -0,0 +1,28 @@
+<Combine name="VersionControl" fileversion="2.0">
+ <Configurations>
+ <Configuration name="Debug" ctype="CombineConfiguration">
+ <Entry build="True" name="VersionControl" />
+ <Entry build="True" name="Diff" />
+ <Entry build="True" name="DiffWidget" />
+ <Entry build="True" name="AddIn" />
+ </Configuration>
+ <Configuration name="Release" ctype="CombineConfiguration">
+ <Entry build="True" name="VersionControl" />
+ <Entry build="True" name="Diff" />
+ <Entry build="True" name="DiffWidget" />
+ <Entry build="True" name="AddIn" />
+ </Configuration>
+ </Configurations>
+ <StartMode startupentry="VersionControl" single="True">
+ <Execute type="None" entry="VersionControl" />
+ <Execute type="None" entry="Diff" />
+ <Execute type="None" entry="DiffWidget" />
+ <Execute type="None" entry="AddIn" />
+ </StartMode>
+ <Entries>
+ <Entry filename="./VersionControl/VersionControl.mdp" />
+ <Entry filename="./Diff/Diff.mdp" />
+ <Entry filename="./DiffWidget/DiffWidget.mdp" />
+ <Entry filename="./AddIn/AddIn.mdp" />
+ </Entries>
+</Combine>
\ No newline at end of file
More information about the Monodevelop-patches-list
mailing list