Browse Source

SubversionAddIn now shows commands in the project pad context menu; TortoiseSvn is used to display the dialogs.

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@1198 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Daniel Grunwald 20 years ago
parent
commit
57e0fd209e
  1. 169
      src/AddIns/Misc/SubversionAddIn/Project/ICSharpCode.Svn.addin
  2. 51
      src/AddIns/Misc/SubversionAddIn/Project/Resources/CommitDialog.xfrm
  3. 146
      src/AddIns/Misc/SubversionAddIn/Project/Resources/ExportDialog.xfrm
  4. 46
      src/AddIns/Misc/SubversionAddIn/Project/Resources/TortoiseSvnNotFoundForm.xfrm
  5. 3
      src/AddIns/Misc/SubversionAddIn/Project/Src/Commands/AutostartCommands.cs
  6. 52
      src/AddIns/Misc/SubversionAddIn/Project/Src/Commands/Checkout/CheckoutCommand.cs
  7. 36
      src/AddIns/Misc/SubversionAddIn/Project/Src/Commands/Checkout/CheckoutDialog.cs
  8. 28
      src/AddIns/Misc/SubversionAddIn/Project/Src/Commands/CheckoutCommands.cs
  9. 45
      src/AddIns/Misc/SubversionAddIn/Project/Src/Commands/Commit/CommitCommand.cs
  10. 41
      src/AddIns/Misc/SubversionAddIn/Project/Src/Commands/Commit/CommitDialog.cs
  11. 62
      src/AddIns/Misc/SubversionAddIn/Project/Src/Commands/Export/ExportCommand.cs
  12. 137
      src/AddIns/Misc/SubversionAddIn/Project/Src/Commands/Export/ExportDialog.cs
  13. 284
      src/AddIns/Misc/SubversionAddIn/Project/Src/Commands/ProjectBrowserCommands.cs
  14. 7
      src/AddIns/Misc/SubversionAddIn/Project/Src/Gui/ProjectBrowserVisitor/OverlayIconManager.cs
  15. 15
      src/AddIns/Misc/SubversionAddIn/Project/Src/Gui/ProjectBrowserVisitor/SvnProjectBrowserVisitor.cs
  16. 227
      src/AddIns/Misc/SubversionAddIn/Project/Src/Gui/SvnGuiWrapper.cs
  17. 33
      src/AddIns/Misc/SubversionAddIn/Project/Src/Gui/TortoiseSvnNotFoundForm.cs
  18. 121
      src/AddIns/Misc/SubversionAddIn/Project/Src/SubversionStateCondition.cs
  19. 19
      src/AddIns/Misc/SubversionAddIn/Project/SubversionAddIn.csproj

169
src/AddIns/Misc/SubversionAddIn/Project/ICSharpCode.Svn.addin

@ -11,7 +11,10 @@ @@ -11,7 +11,10 @@
<Condition name = "Compare" string = "${Platform}" equals = "Win64">
<DisableAddIn message = "This AddIn does not work in the x64 Edition of Windows."/>
</Condition>
<Import assembly = "SubversionAddIn.dll"/>
<Import assembly = "SubversionAddIn.dll">
<ConditionEvaluator name="SubversionState" class="ICSharpCode.Svn.SubversionStateCondition"/>
<ConditionEvaluator name="SubversionIsControlled" class="ICSharpCode.Svn.SubversionIsControlledCondition"/>
</Import>
</Runtime>
<Path name = "/Workspace/Autostart">
@ -27,24 +30,134 @@ @@ -27,24 +30,134 @@
</Path>
<Path name = "/SharpDevelop/Pads/ProjectBrowser/ContextMenu/SubversionItem">
<!-- TODO: Implement menu commands, use conditions
<MenuItem id = "SvnUpdate"
label = "Update"
icon = "Svn.Update"
class = "ICSharpCode.Svn.Commands.UpdateCommand"/>
<MenuItem id = "SvnCommit"
label = "Commit"
icon = "Svn.Commit"
class = "ICSharpCode.Svn.Commands.CommitCommand"/>
<MenuItem id = "SvnRevert"
label = "Revert"
class = "ICSharpCode.Svn.Commands.RevertCommand"/>
<MenuItem id = "SvnCreatePatch"
label = "Create patch"
icon = "Svn.CreatePatch"
class = "ICSharpCode.Svn.Commands.CreatePatchCommand"/>
-->
<Condition name = "SubversionIsControlled">
<MenuItem id = "SvnSeparator" type = "Separator"/>
<Condition name = "SubversionState" state = "Modified;Added;Replaced">
<MenuItem id = "SvnCommit"
label = "Commit..."
icon = "Svn.Commit"
class = "ICSharpCode.Svn.Commands.CommitCommand"/>
</Condition>
<Condition name = "SubversionState" state = "Modified;Conflicted;Added;Replaced">
<Condition name = "SubversionState" state = "Modified" item = "File">
<MenuItem id = "SvnDiff"
label = "Diff"
class = "ICSharpCode.Svn.Commands.DiffCommand"/>
</Condition>
<Condition name = "SubversionState" state = "Conflicted" item = "File">
<MenuItem id = "SvnEditConflicts"
label = "Edit conflicts"
class = "ICSharpCode.Svn.Commands.EditConflictsCommand"/>
<MenuItem id = "SvnResolveConflicts"
label = "Mark conflicts as resolved..."
class = "ICSharpCode.Svn.Commands.ResolveConflictsCommand"/>
</Condition>
<MenuItem id = "SvnRevert"
label = "Revert..."
icon = "Icons.16x16.UndoIcon"
class = "ICSharpCode.Svn.Commands.RevertCommand"/>
</Condition>
<MenuItem id = "SvnMenu" type = "Menu" label = "Subversion">
<ComplexCondition>
<Not>
<Condition name = "SubversionState" state = "Unversioned;Ignored"/>
</Not>
<MenuItem id = "SvnRepoBrowser"
label = "Repo-browser"
class = "ICSharpCode.Svn.Commands.RepoBrowserCommand"/>
<MenuItem id = "SvnRepoStatus"
label = "Check for modifications"
class = "ICSharpCode.Svn.Commands.RepoStatusCommand"/>
<MenuItem id = "SvnRevisionGraph"
label = "Revision graph"
class = "ICSharpCode.Svn.Commands.RevisionGraphCommand"/>
<MenuItem id = "Sep1" type = "Separator"/>
<MenuItem id = "SvnUpdate"
label = "Update"
icon = "Svn.Update"
class = "ICSharpCode.Svn.Commands.UpdateCommand"/>
<MenuItem id = "SvnUpdateToRev"
label = "Update to revision..."
icon = "Svn.Update"
class = "ICSharpCode.Svn.Commands.UpdateToRevisionCommand"/>
<MenuItem id = "SvnShowLog"
label = "Show Log"
class = "ICSharpCode.Svn.Commands.ShowLogCommand"/>
<MenuItem id = "SvnCleanup"
label = "Clean up"
class = "ICSharpCode.Svn.Commands.CleanupCommand"/>
<MenuItem id = "Sep2" type = "Separator"/>
<MenuItem id = "SvnBranch"
label = "Branch/tag..."
class = "ICSharpCode.Svn.Commands.BranchCommand"/>
<MenuItem id = "SvnSwitch"
label = "Switch..."
class = "ICSharpCode.Svn.Commands.SwitchCommand"/>
<MenuItem id = "SvnMerge"
label = "Merge..."
class = "ICSharpCode.Svn.Commands.MergeCommand"/>
<Condition name = "SubversionState" item = "File">
<MenuItem id = "SvnExport"
label = "Export..."
class = "ICSharpCode.Svn.Commands.ExportWorkingCopyCommand"/>
<MenuItem id = "SvnRelocate"
label = "Relocate..."
class = "ICSharpCode.Svn.Commands.RelocateCommand"/>
</Condition>
<MenuItem id = "Sep3" type = "Separator"/>
</ComplexCondition>
<Condition name = "SubversionState" state = "Unversioned;Ignored">
<MenuItem id = "SvnAdd"
label = "Add..."
class = "ICSharpCode.Svn.Commands.AddCommand"/>
</Condition>
<Condition name = "SubversionState" state = "Unversioned">
<MenuItem id = "SvnIgnore"
label = "Add to ignore list"
class = "ICSharpCode.Svn.Commands.IgnoreCommand"/>
</Condition>
<Condition name = "SubversionState" state = "Ignored">
<MenuItem id = "SvnIgnore"
label = "Remove from ignore list"
class = "ICSharpCode.Svn.Commands.UnignoreCommand"/>
</Condition>
<Condition name = "SubversionState" state = "Modified;Normal" item = "File">
<MenuItem id = "SvnBlame"
label = "Blame..."
class = "ICSharpCode.Svn.Commands.BlameCommand"/>
</Condition>
<Condition name = "SubversionState" state = "Modified;Conflicted;Added;Replaced">
<MenuItem id = "SvnCreatePatch"
label = "Create patch..."
icon = "Svn.CreatePatch"
class = "ICSharpCode.Svn.Commands.CreatePatchCommand"/>
</Condition>
<Condition name = "SubversionState" state = "Modified;Normal" item = "Folder">
<MenuItem id = "SvnApplyPatch"
label = "Apply patch..."
icon = "Svn.ApplyPatch"
class = "ICSharpCode.Svn.Commands.ApplyPatchCommand"/>
</Condition>
<MenuItem id = "Sep4" type = "Separator"/>
<MenuItem id = "SvnHelp"
label = "Help"
icon = "Icons.16x16.HelpIcon"
class = "ICSharpCode.Svn.Commands.HelpCommand"/>
<MenuItem id = "SvnSettings"
label = "Settings"
class = "ICSharpCode.Svn.Commands.SettingsCommand"/>
<MenuItem id = "SvnAbout"
label = "About"
class = "ICSharpCode.Svn.Commands.AboutCommand"/>
</MenuItem>
</Condition>
</Path>
<Path name = "/SharpDevelop/Pads/ProjectBrowser/ContextMenu/SolutionNode">
<Include id = "SubversionInclude" path = "/SharpDevelop/Pads/ProjectBrowser/ContextMenu/SubversionItem"/>
</Path>
<Path name = "/SharpDevelop/Pads/ProjectBrowser/ContextMenu/ProjectNode">
@ -72,18 +185,16 @@ @@ -72,18 +185,16 @@
<Path name = "/SharpDevelop/Workbench/MainMenu/Tools">
<MenuItem id = "SvnExport"
label = "Subversion"
insertbefore = "LastSeparator"
type="Menu">
insertbefore = "LastSeparator"
type="Menu">
<MenuItem id = "SvnExport"
label = "Export"
icon = "Svn.Export"
class = "ICSharpCode.Svn.Commands.ExportCommand"/>
label = "Export"
icon = "Svn.Export"
class = "ICSharpCode.Svn.Commands.ExportCommand"/>
<MenuItem id = "SvnCheckout"
label = "Checkout"
icon = "Svn.Checkout"
class = "ICSharpCode.Svn.Commands.CheckoutCommand"/>
label = "Checkout"
icon = "Svn.Checkout"
class = "ICSharpCode.Svn.Commands.CheckoutCommand"/>
</MenuItem>
</Path>
</AddIn>

51
src/AddIns/Misc/SubversionAddIn/Project/Resources/CommitDialog.xfrm

@ -1,51 +0,0 @@ @@ -1,51 +0,0 @@
<Components version="1.0">
<System.Windows.Forms.Form>
<Name value="XmlForm1" />
<ShowInTaskbar value="False" />
<FormBorderStyle value="FixedDialog" />
<ClientSize value="{Width=370, Height=216}" />
<MinimizeBox value="False" />
<DockPadding value="" />
<Text value="Commit" />
<AcceptButton value="okButton [System.Windows.Forms.Button], Text: OK" />
<CancelButton value="cancelButton [System.Windows.Forms.Button], Text: Cancel" />
<MaximizeBox value="False" />
<Controls>
<System.Windows.Forms.TextBox>
<Name value="logMessageTextBox" />
<TabIndex value="1" />
<Location value="{X=8,Y=24}" />
<AcceptsReturn value="True" />
<Size value="{Width=352, Height=152}" />
<Multiline value="True" />
<WordWrap value="False" />
<Text value="" />
</System.Windows.Forms.TextBox>
<System.Windows.Forms.Button>
<Name value="cancelButton" />
<Location value="{X=288,Y=184}" />
<Text value="Cancel" />
<Anchor value="Bottom, Right" />
<TabIndex value="3" />
<DialogResult value="Cancel" />
</System.Windows.Forms.Button>
<System.Windows.Forms.Button>
<Name value="okButton" />
<Location value="{X=208,Y=184}" />
<Text value="OK" />
<Anchor value="Bottom, Right" />
<TabIndex value="2" />
<DialogResult value="OK" />
</System.Windows.Forms.Button>
<System.Windows.Forms.Label>
<Name value="logMessageLabel" />
<Text value="&amp;Log message:" />
<TextAlign value="BottomLeft" />
<Anchor value="Top, Left, Right" />
<TabIndex value="0" />
<Size value="{Width=352, Height=23}" />
<Location value="{X=8,Y=0}" />
</System.Windows.Forms.Label>
</Controls>
</System.Windows.Forms.Form>
</Components>

146
src/AddIns/Misc/SubversionAddIn/Project/Resources/ExportDialog.xfrm

@ -1,146 +0,0 @@ @@ -1,146 +0,0 @@
<Components version="1.0">
<System.Windows.Forms.Form>
<Name value="XmlForm1" />
<ShowInTaskbar value="False" />
<FormBorderStyle value="FixedDialog" />
<StartPosition value="CenterParent" />
<ClientSize value="{Width=338, Height=280}" />
<MinimizeBox value="False" />
<DockPadding value="" />
<Text value="Export" />
<AcceptButton value="okButton [System.Windows.Forms.Button], Text: OK" />
<CancelButton value="cancelButton [System.Windows.Forms.Button], Text: Cancel" />
<MaximizeBox value="False" />
<Controls>
<System.Windows.Forms.Label>
<Name value="label2" />
<Text value="&amp;Destination directory:" />
<TextAlign value="BottomLeft" />
<TabIndex value="7" />
<Size value="{Width=344, Height=23}" />
<Location value="{X=8,Y=176}" />
</System.Windows.Forms.Label>
<System.Windows.Forms.Label>
<Name value="urlLabel" />
<Text value="URL/LocalDir:" />
<TextAlign value="BottomLeft" />
<TabIndex value="4" />
<Size value="{Width=344, Height=23}" />
<Location value="{X=8,Y=128}" />
</System.Windows.Forms.Label>
<System.Windows.Forms.Label>
<Name value="label1" />
<Text value="&amp;Revision:" />
<TextAlign value="BottomLeft" />
<Anchor value="Top, Left, Right" />
<TabIndex value="1" />
<Size value="{Width=320, Height=23}" />
<Location value="{X=8,Y=80}" />
</System.Windows.Forms.Label>
<System.Windows.Forms.Button>
<Name value="cancelButton" />
<Location value="{X=256,Y=248}" />
<Text value="Cancel" />
<Anchor value="Top, Right" />
<TabIndex value="12" />
<DialogResult value="Cancel" />
</System.Windows.Forms.Button>
<System.Windows.Forms.Button>
<Name value="okButton" />
<Location value="{X=176,Y=248}" />
<Text value="OK" />
<Anchor value="Top, Right" />
<TabIndex value="11" />
<DialogResult value="OK" />
</System.Windows.Forms.Button>
<System.Windows.Forms.CheckBox>
<Name value="nonRecursiveCheckBox" />
<Location value="{X=8,Y=224}" />
<Size value="{Width=320, Height=24}" />
<Text value="&amp;Non-recursive" />
<Anchor value="Top, Left, Right" />
<TabIndex value="10" />
</System.Windows.Forms.CheckBox>
<System.Windows.Forms.GroupBox>
<Name value="groupBox1" />
<TabIndex value="0" />
<Location value="{X=8,Y=8}" />
<Anchor value="Top, Left, Right" />
<Size value="{Width=322, Height=72}" />
<Text value="Export source" />
<Controls>
<System.Windows.Forms.RadioButton>
<Name value="fromUrlRadioButton" />
<Location value="{X=8,Y=41}" />
<Size value="{Width=306, Height=24}" />
<Text value="Fr&amp;om URL" />
<Anchor value="Top, Left, Right" />
<TabIndex value="1" />
</System.Windows.Forms.RadioButton>
<System.Windows.Forms.RadioButton>
<Name value="fromLocalDirRadioButton" />
<Location value="{X=8,Y=17}" />
<Size value="{Width=306, Height=24}" />
<Text value="&amp;From local directory" />
<Anchor value="Top, Left, Right" />
<TabIndex value="0" />
</System.Windows.Forms.RadioButton>
</Controls>
</System.Windows.Forms.GroupBox>
<System.Windows.Forms.ComboBox>
<Name value="revisionComboBox" />
<Anchor value="Top, Left, Right" />
<TabIndex value="2" />
<Location value="{X=8,Y=104}" />
<Size value="{Width=202, Height=21}" />
</System.Windows.Forms.ComboBox>
<System.Windows.Forms.DateTimePicker>
<Name value="dateTimePicker" />
<Anchor value="Top, Right" />
<TabIndex value="3" />
<Size value="{Width=104, Height=21}" />
<Location value="{X=224,Y=104}" />
</System.Windows.Forms.DateTimePicker>
<System.Windows.Forms.TextBox>
<Name value="sourceDirectoryTextBox" />
<Anchor value="Top, Left, Right" />
<TabIndex value="5" />
<Location value="{X=8,Y=152}" />
<Size value="{Width=280, Height=21}" />
<Text value="" />
</System.Windows.Forms.TextBox>
<System.Windows.Forms.Button>
<Name value="sourceDirectoryBrowseButton" />
<Location value="{X=296,Y=152}" />
<Size value="{Width=32, Height=21}" />
<Text value="..." />
<Anchor value="Top, Right" />
<TabIndex value="6" />
</System.Windows.Forms.Button>
<System.Windows.Forms.TextBox>
<Name value="urlTextBox" />
<Anchor value="Top, Left, Right" />
<TabIndex value="5" />
<Location value="{X=8,Y=152}" />
<Size value="{Width=320, Height=21}" />
<Text value="" />
</System.Windows.Forms.TextBox>
<System.Windows.Forms.TextBox>
<Name value="localDirectoryTextBox" />
<Anchor value="Top, Left, Right" />
<TabIndex value="8" />
<Location value="{X=8,Y=200}" />
<Size value="{Width=280, Height=21}" />
<Text value="" />
</System.Windows.Forms.TextBox>
<System.Windows.Forms.Button>
<Name value="localDirectoryBrowseButton" />
<Location value="{X=296,Y=200}" />
<Size value="{Width=32, Height=21}" />
<Text value="..." />
<Anchor value="Top, Right" />
<TabIndex value="9" />
</System.Windows.Forms.Button>
</Controls>
</System.Windows.Forms.Form>
</Components>

46
src/AddIns/Misc/SubversionAddIn/Project/Resources/TortoiseSvnNotFoundForm.xfrm

@ -0,0 +1,46 @@ @@ -0,0 +1,46 @@
<Components version="1.0">
<System.Windows.Forms.Form>
<Name value="TortoiseSvnNotFoundForm" />
<FormBorderStyle value="SizableToolWindow" />
<AcceptButton value="okButton [System.Windows.Forms.Button], Text: OK" />
<MinimizeBox value="False" />
<StartPosition value="CenterParent" />
<MinimumSize value="{Width=365, Height=147}" />
<Text value="SharpDevelop" />
<MaximizeBox value="False" />
<ClientSize value="{Width=357, Height=121}" />
<CancelButton value="okButton [System.Windows.Forms.Button], Text: OK" />
<Controls>
<System.Windows.Forms.PictureBox>
<Name value="iconPictureBox" />
<Location value="{X=10,Y=11}" />
<Size value="{Width=32, Height=32}" />
</System.Windows.Forms.PictureBox>
<System.Windows.Forms.Button>
<Name value="okButton" />
<DialogResult value="OK" />
<Location value="{X=142,Y=82}" />
<Text value="${res:Global.OKButtonText}" />
<Anchor value="Bottom" />
<UseVisualStyleBackColor value="True" />
<Size value="{Width=73, Height=29}" />
<TabIndex value="1" />
</System.Windows.Forms.Button>
<System.Windows.Forms.LinkLabel>
<Name value="linkLabel" />
<Size value="{Width=93, Height=26}" />
<TabIndex value="1" />
<Text value="tortoisesvn.tigris.org" />
<Location value="{X=12,Y=86}" />
<Anchor value="Bottom, Left" />
</System.Windows.Forms.LinkLabel>
<System.Windows.Forms.Label>
<Name value="messageLabel" />
<Location value="{X=48,Y=11}" />
<Anchor value="Top, Bottom, Left, Right" />
<Size value="{Width=302, Height=68}" />
<TabIndex value="2" />
</System.Windows.Forms.Label>
</Controls>
</System.Windows.Forms.Form>
</Components>

3
src/AddIns/Misc/SubversionAddIn/Project/Src/Commands/AutostartCommands.cs

@ -48,7 +48,7 @@ namespace ICSharpCode.Svn.Commands @@ -48,7 +48,7 @@ namespace ICSharpCode.Svn.Commands
node.AcceptVisitor(visitor, null);
}
bool CanBeVersionControlled(string fileName)
internal static bool CanBeVersionControlled(string fileName)
{
string svnDir = Path.Combine(Path.GetDirectoryName(fileName), ".svn");
return Directory.Exists(svnDir);
@ -63,6 +63,7 @@ namespace ICSharpCode.Svn.Commands @@ -63,6 +63,7 @@ namespace ICSharpCode.Svn.Commands
FileNode node = pad.ProjectBrowserControl.FindFileNode(fileName);
if (node == null) return;
OverlayIconManager.Enqueue(node);
SubversionStateCondition.ResetCache();
}
void FileAdded(object sender, FileEventArgs e)

52
src/AddIns/Misc/SubversionAddIn/Project/Src/Commands/Checkout/CheckoutCommand.cs

@ -1,52 +0,0 @@ @@ -1,52 +0,0 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Mike Krüger" email="mike@icsharpcode.net"/>
// <version>$Revision$</version>
// </file>
using System;
using System.Threading;
using System.Windows.Forms;
using ICSharpCode.Core;
using ICSharpCode.SharpDevelop;
using NSvn.Common;
using NSvn.Core;
namespace ICSharpCode.Svn.Commands
{
public class CheckoutCommand : AbstractMenuCommand
{
string from = String.Empty;
string to = String.Empty;
bool recurse;
Revision revision = null;
void DoCheckoutCommand()
{
try {
SvnClient.Instance.Client.Checkout(from, to, revision, recurse);
} catch (SvnClientException ex) {
MessageService.ShowError(ex.Message);
}
}
/// <summary>
/// Starts the command
/// </summary>
public override void Run()
{
using (CheckoutDialog checkoutDialog = new CheckoutDialog()) {
if (checkoutDialog.ShowDialog(ICSharpCode.SharpDevelop.Gui.WorkbenchSingleton.MainForm) == DialogResult.OK) {
from = checkoutDialog.Source;
to = checkoutDialog.Destination;
revision = checkoutDialog.Revision;
recurse = !checkoutDialog.NonRecursive;
SvnClient.Instance.OperationStart("Checkout", new ThreadStart(DoCheckoutCommand));
SvnClient.Instance.WaitForOperationEnd();
}
}
}
}
}

36
src/AddIns/Misc/SubversionAddIn/Project/Src/Commands/Checkout/CheckoutDialog.cs

@ -1,36 +0,0 @@ @@ -1,36 +0,0 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Mike Krüger" email="mike@icsharpcode.net"/>
// <version>$Revision$</version>
// </file>
using System;
using System.Reflection;
using System.Drawing;
using System.Text;
using System.Threading;
using System.IO;
using System.Windows.Forms;
using ICSharpCode.SharpDevelop.Gui;
using NSvn.Common;
using NSvn.Core;
using ICSharpCode.SharpDevelop.Gui.XmlForms;
namespace ICSharpCode.Svn.Commands
{
/// <summary>
/// Description of Form1.
/// </summary>
public class CheckoutDialog : ExportDialog
{
public CheckoutDialog()
{
this.Text = "Checkout";
ControlDictionary["groupBox1"].Text = "Repository location";
Get<RadioButton>("fromLocalDir").Text = "&Local repository";
Get<RadioButton>("fromUrl").Checked = true;
Get<RadioButton>("fromUrl").Text = "&Remote repository";
}
}
}

28
src/AddIns/Misc/SubversionAddIn/Project/Src/Commands/CheckoutCommands.cs

@ -0,0 +1,28 @@ @@ -0,0 +1,28 @@
/*
* Created by SharpDevelop.
* User: Daniel Grunwald
* Date: 03.03.2006
* Time: 20:46
*/
using System;
using ICSharpCode.Core;
namespace ICSharpCode.Svn.Commands
{
public class ExportCommand : AbstractMenuCommand
{
public override void Run()
{
SvnGuiWrapper.ShowExportDialog(null);
}
}
public class CheckoutCommand : AbstractMenuCommand
{
public override void Run()
{
SvnGuiWrapper.ShowCheckoutDialog(null);
}
}
}

45
src/AddIns/Misc/SubversionAddIn/Project/Src/Commands/Commit/CommitCommand.cs

@ -1,45 +0,0 @@ @@ -1,45 +0,0 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Mike Krüger" email="mike@icsharpcode.net"/>
// <version>$Revision$</version>
// </file>
using System;
using System.Text;
using System.IO;
using System.Threading;
using System.Drawing;
using System.Drawing.Printing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Diagnostics;
using ICSharpCode.Core;
using ICSharpCode.SharpDevelop;
using ICSharpCode.SharpDevelop.Gui;
using NSvn.Common;
using NSvn.Core;
using ICSharpCode.Svn.Gui;
namespace ICSharpCode.Svn.Commands
{
public class CommitCommand : SubversionCommand
{
protected override bool StartOperation()
{
using (CommitDialog commitDialog = new CommitDialog()) {
commitDialog.LogMessage = AddInOptions.DefaultLogMessage;
if (commitDialog.ShowDialog(ICSharpCode.SharpDevelop.Gui.WorkbenchSingleton.MainForm) == DialogResult.OK) {
SvnClient.Instance.LogMessage = commitDialog.LogMessage;
MessageService.ShowMessage("Not implemented.");
//SvnClient.Instance.OperationStart("Commit", new ThreadStart(DoCommit));
}
}
return false;
}
}
}

41
src/AddIns/Misc/SubversionAddIn/Project/Src/Commands/Commit/CommitDialog.cs

@ -1,41 +0,0 @@ @@ -1,41 +0,0 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Mike Krüger" email="mike@icsharpcode.net"/>
// <version>$Revision$</version>
// </file>
using System;
using System.Reflection;
using System.Drawing;
using System.Text;
using System.Threading;
using System.IO;
using System.Windows.Forms;
using ICSharpCode.SharpDevelop.Gui;
using NSvn.Common;
using NSvn.Core;
using ICSharpCode.SharpDevelop.Gui.XmlForms;
namespace ICSharpCode.Svn.Commands
{
/// <summary>
/// Description of Form1.
/// </summary>
public class CommitDialog : BaseSharpDevelopForm
{
public string LogMessage {
get {
return ControlDictionary["logMessageTextBox"].Text;
}
set {
ControlDictionary["logMessageTextBox"].Text = value;
}
}
public CommitDialog()
{
SetupFromXmlStream(Assembly.GetExecutingAssembly().GetManifestResourceStream("ICSharpCode.Svn.Resources.CommitDialog.xfrm"));
}
}
}

62
src/AddIns/Misc/SubversionAddIn/Project/Src/Commands/Export/ExportCommand.cs

@ -1,62 +0,0 @@ @@ -1,62 +0,0 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Mike Krüger" email="mike@icsharpcode.net"/>
// <version>$Revision$</version>
// </file>
using System;
using System.Threading;
using System.Windows.Forms;
using ICSharpCode.Core;
using ICSharpCode.SharpDevelop;
using NSvn.Common;
using NSvn.Core;
namespace ICSharpCode.Svn.Commands
{
/// <summary>
/// Description of ExportCommand
/// </summary>
public class ExportCommand : AbstractMenuCommand
{
string from = String.Empty;
string to = String.Empty;
Revision revision = null;
/// <summary>
/// Creates a new ExportCommand
/// </summary>
public ExportCommand()
{
// You can enable/disable the menu command using the
// IsEnabled property of the AbstractMenuCommand class
}
void DoExportCommand()
{
try {
SvnClient.Instance.Client.Export(from, to, revision, false);
} catch (SvnClientException ex) {
MessageService.ShowError(ex.Message);
}
}
/// <summary>
/// Starts the command
/// </summary>
public override void Run()
{
using (ExportDialog exportDialog = new ExportDialog()) {
if (exportDialog.ShowDialog(ICSharpCode.SharpDevelop.Gui.WorkbenchSingleton.MainForm) == DialogResult.OK) {
from = exportDialog.Source;
to = exportDialog.Destination;
revision = exportDialog.Revision;
SvnClient.Instance.OperationStart("Export", new ThreadStart(DoExportCommand));
SvnClient.Instance.WaitForOperationEnd();
}
}
}
}
}

137
src/AddIns/Misc/SubversionAddIn/Project/Src/Commands/Export/ExportDialog.cs

@ -1,137 +0,0 @@ @@ -1,137 +0,0 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Mike Krüger" email="mike@icsharpcode.net"/>
// <version>$Revision$</version>
// </file>
using System;
using System.Reflection;
using System.Drawing;
using System.Text;
using System.Threading;
using System.IO;
using System.Windows.Forms;
using ICSharpCode.SharpDevelop.Gui;
using NSvn.Common;
using NSvn.Core;
using ICSharpCode.SharpDevelop.Gui.XmlForms;
namespace ICSharpCode.Svn.Commands
{
/// <summary>
/// Description of Form1.
/// </summary>
public class ExportDialog : BaseSharpDevelopForm
{
public Revision Revision {
get {
if (ControlDictionary["revisionComboBox"].Text == "Date") {
return Revision.FromDate(((DateTimePicker)ControlDictionary["dateTimePicker"]).Value);
}
return Revision.Parse(ControlDictionary["revisionComboBox"].Text);
}
}
public bool SourceIsLocalDirectory {
get {
return ((RadioButton)ControlDictionary["fromLocalDirRadioButton"]).Checked;
}
}
public string Source {
get {
return SourceIsLocalDirectory ? ConvertPathToURL(ControlDictionary["sourceDirectoryTextBox"].Text) : ControlDictionary["urlTextBox"].Text;
}
}
string ConvertPathToURL(string path)
{
if (path.Length == 0)
return "";
return "file:///" + path.Replace('\\', '/');
}
public string Destination {
get {
return ControlDictionary["localDirectoryTextBox"].Text;
}
}
public bool NonRecursive {
get {
return ((CheckBox)ControlDictionary["nonRecursiveCheckBox"]).Checked;
}
}
public ExportDialog()
{
SetupFromXmlStream(Assembly.GetExecutingAssembly().GetManifestResourceStream("ICSharpCode.Svn.Resources.ExportDialog.xfrm"));
((ComboBox)ControlDictionary["revisionComboBox"]).Items.AddRange(new string[] {
"Head",
"Committed",
"Base",
"Previous",
"Working",
"Date"
});
((ComboBox)ControlDictionary["revisionComboBox"]).Text = "Head";
((ComboBox)ControlDictionary["revisionComboBox"]).TextChanged += new EventHandler(RevisionComboBoxTextChanged);
RevisionComboBoxTextChanged(this, EventArgs.Empty);
Get<RadioButton>("fromLocalDir").Checked = true;
Get<RadioButton>("fromLocalDir").CheckedChanged += new EventHandler(FromLocalDirRadioButtonCheckedChanged);
FromLocalDirRadioButtonCheckedChanged(this, EventArgs.Empty);
ControlDictionary["sourceDirectoryBrowseButton"].Click += new EventHandler(SourceDirectoryBrowseButtonClick);
ControlDictionary["localDirectoryBrowseButton"].Click += new EventHandler(LocalDirectoryBrowseButtonClick);
ControlDictionary["sourceDirectoryTextBox"].TextChanged += UrlChanged;
ControlDictionary["urlTextBox"].TextChanged += UrlChanged;
ControlDictionary["localDirectoryTextBox"].TextChanged += UrlChanged;
UrlChanged(null, null);
}
void UrlChanged(object sender, EventArgs e)
{
Get<Button>("ok").Enabled = Source.Length > 0 && Destination.Length > 0;
}
void RevisionComboBoxTextChanged(object sender, EventArgs e)
{
ControlDictionary["dateTimePicker"].Enabled = ControlDictionary["revisionComboBox"].Text == "Date";
}
void FromLocalDirRadioButtonCheckedChanged(object sender, EventArgs e)
{
ControlDictionary["urlTextBox"].Visible = !SourceIsLocalDirectory;
ControlDictionary["sourceDirectoryTextBox"].Visible = ControlDictionary["sourceDirectoryBrowseButton"].Visible = SourceIsLocalDirectory;
if (SourceIsLocalDirectory) {
ControlDictionary["urlLabel"].Text = "&Source directory:";
} else {
ControlDictionary["urlLabel"].Text = "&URL:";
}
UrlChanged(null, null);
}
void SourceDirectoryBrowseButtonClick(object sender, EventArgs e)
{
FolderDialog fdiag = new FolderDialog();
if (fdiag.DisplayDialog("Select source directory.") == DialogResult.OK) {
ControlDictionary["sourceDirectoryTextBox"].Text = fdiag.Path;
}
}
void LocalDirectoryBrowseButtonClick(object sender, EventArgs e)
{
FolderDialog fdiag = new FolderDialog();
if (fdiag.DisplayDialog("Select destination directory.") == DialogResult.OK) {
ControlDictionary["localDirectoryTextBox"].Text = fdiag.Path;
}
}
}
}

284
src/AddIns/Misc/SubversionAddIn/Project/Src/Commands/ProjectBrowserCommands.cs

@ -18,6 +18,7 @@ using System.Diagnostics; @@ -18,6 +18,7 @@ using System.Diagnostics;
using ICSharpCode.Core;
using ICSharpCode.SharpDevelop;
using ICSharpCode.SharpDevelop.Gui;
using ICSharpCode.SharpDevelop.Project;
using NSvn.Common;
@ -27,109 +28,260 @@ namespace ICSharpCode.Svn.Commands @@ -27,109 +28,260 @@ namespace ICSharpCode.Svn.Commands
{
public abstract class SubversionCommand : AbstractMenuCommand
{
protected string fileName;
public override void Run()
{
AbstractProjectBrowserTreeNode node = ProjectBrowserPad.Instance.SelectedNode;
if (node != null) {
fileName = null;
if (node is DirectoryNode) {
fileName = ((DirectoryNode)node).Directory;
Run(((DirectoryNode)node).Directory);
} else if (node is FileNode) {
fileName = ((FileNode)node).FileName;
}
if (fileName == null) {
return;
}
if (StartOperation()) {
SvnClient.Instance.WaitForOperationEnd();
OperationFinished();
OverlayIconManager.EnqueueRecursive(node);
Run(((FileNode)node).FileName);
} else if (node is SolutionNode) {
Run(((SolutionNode)node).Solution.Directory);
}
}
}
protected abstract bool StartOperation();
protected void Callback()
{
WorkbenchSingleton.SafeThreadAsyncCall((MethodInvoker)CallbackInvoked);
}
protected virtual void OperationFinished()
void CallbackInvoked()
{
//if (AddInOptions.AutomaticallyReloadProject) {
// projectService.ReloadCombine();
//}
SubversionStateCondition.ResetCache();
AbstractProjectBrowserTreeNode node = ProjectBrowserPad.Instance.SelectedNode;
if (node != null) {
OverlayIconManager.EnqueueRecursive(node);
}
}
protected abstract void Run(string filename);
}
public class UpdateCommand : SubversionCommand
{
void DoUpdateCommand()
protected override void Run(string filename)
{
SvnClient.Instance.Client.Update(Directory.Exists(fileName) ? fileName : Path.GetDirectoryName(fileName), Revision.Head, true);
SvnGuiWrapper.Update(filename, Callback);
}
protected override bool StartOperation()
}
public class UpdateToRevisionCommand : SubversionCommand
{
protected override void Run(string filename)
{
SvnClient.Instance.OperationStart("Update", new ThreadStart(DoUpdateCommand));
return true;
SvnGuiWrapper.UpdateToRevision(filename, Callback);
}
}
public class RevertCommand : SubversionCommand
{
void DoRevertCommand()
protected override void Run(string filename)
{
SvnClient.Instance.Client.Revert(new string[] { fileName }, true);
SvnGuiWrapper.Revert(filename, Callback);
}
protected override bool StartOperation()
}
public class CreatePatchCommand : SubversionCommand
{
protected override void Run(string filename)
{
if (MessageService.AskQuestion("Revert removes all your local modifications to this file. Are you sure?", "Subversion revert")) {
SvnClient.Instance.OperationStart("Revert", new ThreadStart(DoRevertCommand));
return true;
}
return false;
SvnGuiWrapper.CreatePatch(filename, null);
}
}
/// <summary>
/// Description of CreatePatchCommand
/// </summary>
public class CreatePatchCommand : SubversionCommand
public class ApplyPatchCommand : SubversionCommand
{
string output;
void DoCreatePatchCommand()
{
try {
MemoryStream outStream = new MemoryStream();
MemoryStream errStream = new MemoryStream();
SvnClient.Instance.Client.Diff(new string [] {} ,
fileName,
Revision.Committed,
fileName,
Revision.Working,
true,
false,
true,
outStream,
errStream);
output = Encoding.Default.GetString(outStream.ToArray());
ICSharpCode.SharpDevelop.Gui.WorkbenchSingleton.SafeThreadAsyncCall(this, "DisplayPatch");
} catch (Exception e) {
MessageService.ShowError(e);
protected override void Run(string filename)
{
SvnGuiWrapper.ApplyPatch(filename, null);
}
}
public class CommitCommand : SubversionCommand
{
protected override void Run(string filename)
{
SvnGuiWrapper.Commit(filename, Callback);
}
}
public class AddCommand : SubversionCommand
{
protected override void Run(string filename)
{
SvnGuiWrapper.Add(filename, Callback);
}
}
public class IgnoreCommand : SubversionCommand
{
protected override void Run(string filename)
{
SvnGuiWrapper.Ignore(filename, Callback);
}
}
public class BlameCommand : SubversionCommand
{
protected override void Run(string filename)
{
SvnGuiWrapper.Blame(filename, Callback);
}
}
public class UnignoreCommand : SubversionCommand
{
protected override void Run(string filename)
{
PropertyDictionary pd = SvnClient.Instance.Client.PropGet("svn:ignore", Path.GetDirectoryName(filename), Revision.Working, false);
if (pd != null) {
string shortFileName = Path.GetFileName(filename);
foreach (Property p in pd.Values) {
StringBuilder b = new StringBuilder();
using (StreamReader r = new StreamReader(new MemoryStream(p.Data))) {
string line;
while ((line = r.ReadLine()) != null) {
if (!string.Equals(line, shortFileName, StringComparison.InvariantCultureIgnoreCase)) {
b.AppendLine(line);
}
}
}
SvnClient.Instance.Client.PropSet(new Property(p.Name, b.ToString()),
Path.GetDirectoryName(filename), false);
}
MessageService.ShowMessage(shortFileName + " was removed from the ignore list.");
Callback();
}
}
void DisplayPatch()
}
public class HelpCommand : AbstractMenuCommand
{
public override void Run()
{
FileService.NewFile(Path.GetFileName(fileName) + ".patch", "patch", output);
SvnGuiWrapper.ShowSvnHelp();
}
protected override bool StartOperation()
}
public class SettingsCommand : AbstractMenuCommand
{
public override void Run()
{
SvnGuiWrapper.ShowSvnSettings();
}
}
public class AboutCommand : AbstractMenuCommand
{
public override void Run()
{
SvnGuiWrapper.ShowSvnAbout();
}
}
public class DiffCommand : SubversionCommand
{
protected override void Run(string filename)
{
SvnGuiWrapper.Diff(filename, Callback);
}
}
public class EditConflictsCommand : SubversionCommand
{
protected override void Run(string filename)
{
SvnGuiWrapper.ConflictEditor(filename, Callback);
}
}
public class ResolveConflictsCommand : SubversionCommand
{
protected override void Run(string filename)
{
SvnGuiWrapper.ResolveConflict(filename, Callback);
}
}
public class ShowLogCommand : SubversionCommand
{
protected override void Run(string filename)
{
SvnGuiWrapper.ShowLog(filename, Callback);
}
}
public class CleanupCommand : SubversionCommand
{
protected override void Run(string filename)
{
SvnGuiWrapper.Cleanup(filename, Callback);
}
}
public class RepoBrowserCommand : SubversionCommand
{
protected override void Run(string filename)
{
SvnGuiWrapper.RepoBrowser(filename, Callback);
}
}
public class RepoStatusCommand : SubversionCommand
{
protected override void Run(string filename)
{
SvnGuiWrapper.RepoStatus(filename, Callback);
}
}
public class RevisionGraphCommand : SubversionCommand
{
protected override void Run(string filename)
{
SvnGuiWrapper.RevisionGraph(filename, Callback);
}
}
public class BranchCommand : SubversionCommand
{
protected override void Run(string filename)
{
SvnGuiWrapper.Branch(filename, Callback);
}
}
public class SwitchCommand : SubversionCommand
{
protected override void Run(string filename)
{
SvnGuiWrapper.Switch(filename, Callback);
}
}
public class MergeCommand : SubversionCommand
{
protected override void Run(string filename)
{
SvnGuiWrapper.Merge(filename, Callback);
}
}
public class ExportWorkingCopyCommand : SubversionCommand
{
protected override void Run(string filename)
{
SvnGuiWrapper.Export(filename, Callback);
}
}
public class RelocateCommand : SubversionCommand
{
protected override void Run(string filename)
{
SvnClient.Instance.OperationStart("CreatePatch", new ThreadStart(DoCreatePatchCommand));
return true;
SvnGuiWrapper.Relocate(filename, Callback);
}
}
}

7
src/AddIns/Misc/SubversionAddIn/Project/Src/Gui/ProjectBrowserVisitor/OverlayIconManager.cs

@ -160,7 +160,12 @@ namespace ICSharpCode.Svn @@ -160,7 +160,12 @@ namespace ICSharpCode.Svn
if (directoryNode != null) {
status = client.SingleStatus(directoryNode.Directory);
} else {
return;
SolutionNode solNode = node as SolutionNode;
if (solNode != null) {
status = client.SingleStatus(solNode.Solution.Directory);
} else {
return;
}
}
}
if (node.TreeView != null) {

15
src/AddIns/Misc/SubversionAddIn/Project/Src/Gui/ProjectBrowserVisitor/SvnProjectBrowserVisitor.cs

@ -19,19 +19,10 @@ namespace ICSharpCode.Svn @@ -19,19 +19,10 @@ namespace ICSharpCode.Svn
{
public override object Visit(SolutionNode node, object data)
{
return node.AcceptChildren(this, data);
/*
string fileName = node.FileName;
NodeStatus nodeStatus = NodeStatus.None;
if (fileName != null && fileName.Length > 0) {
Status status = client.SingleStatus(Path.GetFullPath(fileName));
nodeStatus = GetNodeStatus(status.TextStatus);
if (Directory.Exists(Path.Combine(node.Solution.Directory, ".svn"))) {
OverlayIconManager.Enqueue(node);
}
NodeStatusInformer nsi = new NodeStatusInformer(nodeStatus);
object back = node.AcceptChildren(this, nsi);
node.NodeStatus = nsi.NodeStatus;
return back;*/
return node.AcceptChildren(this, data);
}
public override object Visit(ProjectNode node, object data)

227
src/AddIns/Misc/SubversionAddIn/Project/Src/Gui/SvnGuiWrapper.cs

@ -0,0 +1,227 @@ @@ -0,0 +1,227 @@
/*
* Created by SharpDevelop.
* User: Daniel Grunwald
* Date: 03.03.2006
* Time: 20:27
*/
using System;
using System.IO;
using System.Text;
using System.Diagnostics;
using System.Windows.Forms;
using Microsoft.Win32;
using ICSharpCode.Core;
namespace ICSharpCode.Svn
{
/// <summary>
/// Wraps commands opening a dialog window.
/// The current implementation launches TortoiseSVN.
/// </summary>
public static class SvnGuiWrapper
{
static string GetPathFromRegistry(RegistryKey key, string valueName)
{
if (key == null) return null;
using (key) {
return key.GetValue(valueName) as string;
}
}
static string GetPathFromRegistry(string valueName)
{
string r = GetPathFromRegistry(Registry.CurrentUser.OpenSubKey("SOFTWARE\\TortoiseSVN"), valueName);
if (r != null) return r;
return GetPathFromRegistry(Registry.LocalMachine.OpenSubKey("SOFTWARE\\TortoiseSVN"), valueName);
}
static void Proc(string command, string fileName, MethodInvoker callback)
{
Proc(command, fileName, callback, null);
}
static void Proc(string command, string fileName, MethodInvoker callback, string argument)
{
string path = GetPathFromRegistry("ProcPath");
if (path == null) {
using (TortoiseSvnNotFoundForm form = new TortoiseSvnNotFoundForm()) {
form.ShowDialog();
}
} else {
try {
StringBuilder arguments = new StringBuilder();
arguments.Append("/command:");
arguments.Append(command);
if (fileName != null) {
arguments.Append(" /notempfile ");
arguments.Append(" /path:\"");
arguments.Append(fileName);
arguments.Append('"');
}
if (argument != null) {
arguments.Append(' ');
arguments.Append(argument);
}
Process p = new Process();
p.StartInfo.FileName = path;
p.StartInfo.Arguments = arguments.ToString();
p.StartInfo.RedirectStandardError = true;
p.StartInfo.RedirectStandardOutput = true;
p.StartInfo.UseShellExecute = false;
p.EnableRaisingEvents = true;
p.Exited += delegate {
p.Dispose();
if (callback != null) { callback(); }
};
p.OutputDataReceived += delegate(object sender, DataReceivedEventArgs e) {
SvnClient.Instance.SvnCategory.AppendText(e.Data);
};
p.ErrorDataReceived += delegate(object sender, DataReceivedEventArgs e) {
SvnClient.Instance.SvnCategory.AppendText(e.Data);
};
p.Start();
} catch (Exception ex) {
MessageService.ShowError(ex.Message);
}
}
}
public static void ShowCheckoutDialog(MethodInvoker callback)
{
Proc("checkout", null, callback);
}
public static void ShowExportDialog(MethodInvoker callback)
{
Proc("export", null, callback);
}
public static void Update(string fileName, MethodInvoker callback)
{
Proc("update", fileName, callback);
}
public static void ApplyPatch(string fileName, MethodInvoker callback)
{
//Proc("applypatch", fileName, callback);
// TODO: Applying patches is not implemented.
MessageService.ShowMessage("Applying patches is not implemented.");
}
public static void CreatePatch(string fileName, MethodInvoker callback)
{
Proc("createpatch", fileName, callback);
}
public static void Revert(string fileName, MethodInvoker callback)
{
Proc("revert", fileName, callback);
}
public static void Commit(string fileName, MethodInvoker callback)
{
Proc("commit", fileName, callback);
}
public static void Add(string fileName, MethodInvoker callback)
{
Proc("add", fileName, callback);
}
public static void Ignore(string fileName, MethodInvoker callback)
{
Proc("ignore", fileName, callback);
}
public static void ShowSvnHelp()
{
Proc("help", null, null);
}
public static void ShowSvnSettings()
{
Proc("settings", null, null);
}
public static void ShowSvnAbout()
{
Proc("about", null, null);
}
public static void Diff(string fileName, MethodInvoker callback)
{
Proc("diff", fileName, callback);
}
public static void ConflictEditor(string fileName, MethodInvoker callback)
{
Proc("conflicteditor", fileName, callback);
}
public static void ResolveConflict(string fileName, MethodInvoker callback)
{
Proc("resolve", fileName, callback);
}
public static void ShowLog(string fileName, MethodInvoker callback)
{
Proc("log", fileName, callback);
}
public static void Cleanup(string fileName, MethodInvoker callback)
{
Proc("cleanup", fileName, callback);
}
public static void RevisionGraph(string fileName, MethodInvoker callback)
{
Proc("revisiongraph", fileName, callback);
}
public static void RepoStatus(string fileName, MethodInvoker callback)
{
Proc("repostatus", fileName, callback);
}
public static void RepoBrowser(string fileName, MethodInvoker callback)
{
Proc("repobrowser", fileName, callback);
}
public static void UpdateToRevision(string fileName, MethodInvoker callback)
{
Proc("update", fileName, callback, "/rev");
}
public static void Export(string fileName, MethodInvoker callback)
{
Proc("export", fileName, callback);
}
public static void Branch(string fileName, MethodInvoker callback)
{
Proc("copy", fileName, callback);
}
public static void Blame(string fileName, MethodInvoker callback)
{
Proc("blame", fileName, callback);
}
public static void Switch(string fileName, MethodInvoker callback)
{
Proc("switch", fileName, callback);
}
public static void Merge(string fileName, MethodInvoker callback)
{
Proc("merge", fileName, callback);
}
public static void Relocate(string fileName, MethodInvoker callback)
{
Proc("relocate", fileName, callback);
}
}
}

33
src/AddIns/Misc/SubversionAddIn/Project/Src/Gui/TortoiseSvnNotFoundForm.cs

@ -0,0 +1,33 @@ @@ -0,0 +1,33 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Matthew Ward" email="mrward@users.sourceforge.net"/>
// <version>$Revision$</version>
// </file>
using ICSharpCode.Core;
using ICSharpCode.SharpDevelop;
using ICSharpCode.SharpDevelop.Gui.XmlForms;
using System;
using System.Diagnostics;
using System.Windows.Forms;
namespace ICSharpCode.Svn
{
public class TortoiseSvnNotFoundForm : XmlForm
{
public TortoiseSvnNotFoundForm()
{
SetupFromXmlStream(this.GetType().Assembly.GetManifestResourceStream("ICSharpCode.Svn.Resources.TortoiseSvnNotFoundForm.xfrm"));
((Label)ControlDictionary["messageLabel"]).Text = StringParser.Parse("TortoiseSVN needs to be installed to execute this action.");
((PictureBox)ControlDictionary["iconPictureBox"]).Image = ResourceService.GetBitmap("Icons.32x32.Information");
((LinkLabel)ControlDictionary["linkLabel"]).Click += LinkLabelClicked;
}
void LinkLabelClicked(object sender, EventArgs e)
{
Process.Start("http://tortoisesvn.tigris.org");
}
}
}

121
src/AddIns/Misc/SubversionAddIn/Project/Src/SubversionStateCondition.cs

@ -0,0 +1,121 @@ @@ -0,0 +1,121 @@
/*
* Created by SharpDevelop.
* User: Daniel Grunwald
* Date: 03.03.2006
* Time: 20:54
*/
using System;
using System.IO;
using System.Text;
using ICSharpCode.Core;
using ICSharpCode.SharpDevelop.Project;
using ICSharpCode.Svn.Commands;
using NSvn.Core;
using NSvn.Common;
namespace ICSharpCode.Svn
{
/// <summary>
/// Gets if a folder is under version control
/// </summary>
public class SubversionIsControlledCondition : IConditionEvaluator
{
public bool IsValid(object caller, Condition condition)
{
FileNode node = ProjectBrowserPad.Instance.SelectedNode as FileNode;
if (node != null) {
return RegisterEventsCommand.CanBeVersionControlled(node.FileName);
}
DirectoryNode dir = ProjectBrowserPad.Instance.SelectedNode as DirectoryNode;
if (dir != null) {
return Directory.Exists(Path.Combine(dir.Directory, ".svn"));
}
SolutionNode sol = ProjectBrowserPad.Instance.SelectedNode as SolutionNode;
if (sol != null) {
return Directory.Exists(Path.Combine(sol.Solution.Directory, ".svn"));
}
return false;
}
}
public class SubversionStateCondition : IConditionEvaluator
{
public bool IsValid(object caller, Condition condition)
{
FileNode node = ProjectBrowserPad.Instance.SelectedNode as FileNode;
if (node != null) {
if (condition.Properties["item"] == "Folder") {
return false;
}
return Test(condition, node.FileName);
}
DirectoryNode dir = ProjectBrowserPad.Instance.SelectedNode as DirectoryNode;
if (dir != null) {
if (condition.Properties["item"] == "File") {
return false;
}
if (condition.Properties["state"].Contains("Modified")) {
// Directories are not checked recursively yet.
return true;
}
return Test(condition, dir.Directory);
}
SolutionNode sol = ProjectBrowserPad.Instance.SelectedNode as SolutionNode;
if (sol != null) {
if (condition.Properties["item"] == "File") {
return false;
}
if (condition.Properties["state"].Contains("Modified")) {
// Directories are not checked recursively yet.
return true;
}
return Test(condition, sol.Solution.Directory);
}
return false;
}
static string lastTestFileName;
static string lastTestStatus;
internal static void ResetCache()
{
lastTestFileName = null;
}
bool Test(Condition condition, string fileName)
{
string[] allowedStatus = condition.Properties["state"].Split(';');
if (allowedStatus.Length == 0) {
return true;
}
string status;
if (fileName == lastTestFileName) {
status = lastTestStatus;
} else {
status = SvnClient.Instance.Client.SingleStatus(fileName).TextStatus.ToString();
if (status == "Unversioned") {
PropertyDictionary pd = SvnClient.Instance.Client.PropGet("svn:ignore", Path.GetDirectoryName(fileName), Revision.Working, false);
if (pd != null) {
string shortFileName = Path.GetFileName(fileName);
foreach (Property p in pd.Values) {
using (StreamReader r = new StreamReader(new MemoryStream(p.Data))) {
string line;
while ((line = r.ReadLine()) != null) {
if (string.Equals(line, shortFileName, StringComparison.InvariantCultureIgnoreCase)) {
status = "Ignored";
break;
}
}
}
}
}
}
LoggingService.Debug("Status of " + fileName + " is " + status);
lastTestFileName = fileName;
lastTestStatus = status;
}
return Array.IndexOf(allowedStatus, status) >= 0;
}
}
}

19
src/AddIns/Misc/SubversionAddIn/Project/SubversionAddIn.csproj

@ -52,25 +52,11 @@ @@ -52,25 +52,11 @@
<Compile Include="Configuration\AssemblyInfo.cs" />
<EmbeddedResource Include="Resources\ClientCertDialog.xfrm" />
<EmbeddedResource Include="Resources\ClientCertPassphraseDialog.xfrm" />
<EmbeddedResource Include="Resources\CommitDialog.xfrm" />
<EmbeddedResource Include="Resources\InfoPanel.xfrm" />
<EmbeddedResource Include="Resources\DiffPanel.xfrm" />
<EmbeddedResource Include="Resources\ExportDialog.xfrm" />
<EmbeddedResource Include="Resources\LoginDialog.xfrm" />
<EmbeddedResource Include="Resources\SslServerTrustDialog.xfrm" />
<EmbeddedResource Include="Resources\SubversionOptionsPanel.xfrm" />
<Compile Include="Src\Commands\Checkout\CheckoutCommand.cs" />
<Compile Include="Src\Commands\Checkout\CheckoutDialog.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Src\Commands\Commit\CommitCommand.cs" />
<Compile Include="Src\Commands\Commit\CommitDialog.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Src\Commands\Export\ExportCommand.cs" />
<Compile Include="Src\Commands\Export\ExportDialog.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Src\Commands\AutostartCommands.cs" />
<Compile Include="Src\Commands\ProjectBrowserCommands.cs" />
<Compile Include="Src\Gui\AuthentificationDialogs\ClientCertDialog.cs">
@ -101,6 +87,10 @@ @@ -101,6 +87,10 @@
<SubType>UserControl</SubType>
</Compile>
<Compile Include="Src\Gui\ProjectBrowserVisitor\OverlayIconManager.cs" />
<Compile Include="Src\Gui\SvnGuiWrapper.cs" />
<Compile Include="Src\Gui\TortoiseSvnNotFoundForm.cs" />
<Compile Include="Src\Commands\CheckoutCommands.cs" />
<Compile Include="Src\SubversionStateCondition.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\..\Main\Base\Project\ICSharpCode.SharpDevelop.csproj">
@ -121,6 +111,7 @@ @@ -121,6 +111,7 @@
<Link>msvcr70.dll</Link>
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="Resources\TortoiseSvnNotFoundForm.xfrm" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" />
</Project>
Loading…
Cancel
Save