本文整理汇总了C#中MonoDevelop.VersionControl.ChangeSet类的典型用法代码示例。如果您正苦于以下问题:C# ChangeSet类的具体用法?C# ChangeSet怎么用?C# ChangeSet使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ChangeSet类属于MonoDevelop.VersionControl命名空间,在下文中一共展示了ChangeSet类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreatePatch
public static bool CreatePatch (ChangeSet items, bool test)
{
bool can = CanCreatePatch (items);
if (test || !can){ return can; }
Repository repo = items.Repository;
items = items.Clone ();
List<DiffInfo> diffs = new List<DiffInfo> ();
object[] exts = AddinManager.GetExtensionObjects ("/MonoDevelop/VersionControl/CommitDialogExtensions", typeof(CommitDialogExtension), false);
try {
foreach (CommitDialogExtension ext in exts) {
ext.Initialize (items);
ext.OnBeginCommit (items);
}
diffs.AddRange (repo.PathDiff (items, false));
} finally {
foreach (CommitDialogExtension ext in exts) {
ext.OnEndCommit (items, false);
ext.Destroy ();
}
}
string patch = repo.CreatePatch (diffs);
string filename = string.Format ("{0}.diff", ((string)items.BaseLocalPath.FullPath).TrimEnd (Path.DirectorySeparatorChar));
IdeApp.Workbench.NewDocument (filename, "text/x-diff", patch);
return can;
}
示例2: CommitWorker
public CommitWorker (Repository vc, ChangeSet changeSet, CommitDialog dlg)
{
this.vc = vc;
this.changeSet = changeSet;
this.dlg = dlg;
OperationType = VersionControlOperationType.Push;
}
示例3: Commit
public static void Commit (Repository vc, ChangeSet changeSet)
{
try {
if (vc.GetVersionInfo (changeSet.BaseLocalPath).CanCommit) {
if (!VersionControlService.NotifyPrepareCommit (vc, changeSet))
return;
CommitDialog dlg = new CommitDialog (changeSet);
try {
if (MessageService.RunCustomDialog (dlg) == (int) Gtk.ResponseType.Ok) {
if (VersionControlService.NotifyBeforeCommit (vc, changeSet)) {
new CommitWorker (vc, changeSet, dlg).Start();
return;
}
}
dlg.EndCommit (false);
} finally {
dlg.Destroy ();
}
VersionControlService.NotifyAfterCommit (vc, changeSet, false);
}
}
catch (Exception ex) {
MessageService.ShowException (ex, GettextCatalog.GetString ("Version control command failed."));
}
}
示例4: CreatePatch
/// <summary>
/// Creates a patch from a VersionControlItemList
/// </summary>
/// <param name="items">
/// A <see cref="VersionControlItemList"/> from which to create a patch.
/// </param>
/// <param name="test">
/// A <see cref="System.Boolean"/>: Whether this is a test run.
/// </param>
/// <returns>
/// A <see cref="System.Boolean"/>: Whether the patch creation succeeded.
/// </returns>
public static bool CreatePatch (VersionControlItemList items, bool test)
{
bool can = CanCreatePatch (items);
if (test || !can){ return can; }
FilePath basePath = items.FindMostSpecificParent (FilePath.Null);
if (FilePath.Empty == basePath)
return false;
ChangeSet cset = new ChangeSet (items[0].Repository, basePath);
foreach (VersionControlItem item in items) {
cset.AddFile (item.Path);
}
return CreatePatch (cset, test);
}
示例5: Initialize
public override void Initialize (ChangeSet cset)
{
this.cset = cset;
msgLabel = new Label ();
pathLabel = new Label ();
msgLabel.Xalign = 0;
pathLabel.Xalign = 0;
vbox.PackStart (msgLabel, false, false, 0);
vbox.PackStart (pathLabel, false, false, 3);
GenerateLogEntries ();
if (enabled) {
ShowAll ();
UpdateStatus ();
}
}
示例6: Commit
public static bool Commit (Repository vc, ChangeSet changeSet, bool test)
{
try {
if (changeSet.IsEmpty) {
if (!test)
MessageService.ShowMessage (GettextCatalog.GetString ("There are no changes to be committed."));
return false;
}
if (vc.GetVersionInfo (changeSet.BaseLocalPath).CanCommit) {
if (test)
return true;
if (!VersionControlService.NotifyPrepareCommit (vc, changeSet))
return false;
CommitDialog dlg = new CommitDialog (changeSet);
try {
if (MessageService.RunCustomDialog (dlg) == (int) Gtk.ResponseType.Ok) {
if (VersionControlService.NotifyBeforeCommit (vc, changeSet)) {
new CommitWorker (vc, changeSet, dlg).Start();
return true;
}
}
dlg.EndCommit (false);
} finally {
dlg.Destroy ();
}
VersionControlService.NotifyAfterCommit (vc, changeSet, false);
}
return false;
}
catch (Exception ex) {
if (test)
LoggingService.LogError (ex.ToString ());
else
MessageService.ShowException (ex, GettextCatalog.GetString ("Version control command failed."));
return false;
}
}
示例7: Commit
public static void Commit (Repository vc, ChangeSet changeSet)
{
try {
VersionControlService.NotifyPrepareCommit (vc, changeSet);
CommitDialog dlg = new CommitDialog (changeSet);
try {
if (MessageService.RunCustomDialog (dlg) == (int) Gtk.ResponseType.Ok) {
VersionControlService.NotifyBeforeCommit (vc, changeSet);
new CommitWorker (vc, changeSet, dlg).Start();
return;
}
dlg.EndCommit (false);
} finally {
dlg.Destroy ();
dlg.Dispose ();
}
VersionControlService.NotifyAfterCommit (vc, changeSet, false);
}
catch (Exception ex) {
MessageService.ShowError (GettextCatalog.GetString ("Version control command failed."), ex);
}
}
示例8: PathDiff
// Returns a diff description between local files and the remote files.
// baseLocalPath is the root path of the diff. localPaths is optional and
// it can be a list of files to compare.
public DiffInfo[] PathDiff (ChangeSet cset, bool remoteDiff)
{
return PathDiff (cset.BaseLocalPath, cset.Items.Select (i => i.LocalPath).ToArray (), remoteDiff);
}
示例9: OnCommit
protected abstract void OnCommit (ChangeSet changeSet, ProgressMonitor monitor);
示例10: CanCreatePatch
/// <summary>
/// Determines whether a patch can be created
/// from a ChangeSet.
/// </summary>
public static bool CanCreatePatch (ChangeSet items)
{
if (null == items || 0 == items.Count){ return false; }
var vinfos = items.Repository.GetVersionInfo (items.Items.Select (i => i.LocalPath));
return vinfos.All (i => i.CanRevert);
}
示例11: OnEndCommit
public override void OnEndCommit (ChangeSet changeSet, bool success)
{
if (!enabled)
return;
if (!success)
RollbackMakefiles ();
else
DeleteBackupFiles ();
}
示例12: Commit
public override void Commit(ChangeSet changeSet, IProgressMonitor monitor)
{
throw new NotImplementedException();
}
示例13: NotifyAfterCommit
internal static bool NotifyAfterCommit (Repository repo, ChangeSet changeSet, bool success)
{
if (EndCommit != null) {
try {
EndCommit (null, new CommitEventArgs (repo, changeSet, success));
} catch (Exception ex) {
MessageService.ShowException (ex);
return false;
}
}
if (success) {
foreach (ChangeSetItem it in changeSet.Items)
SetCommitComment (it.LocalPath, null, false);
SaveComments ();
}
return true;
}
示例14: OnEndCommit
/// <summary>
/// Called when the commit operation ends
/// </summary>
/// <param name='changeSet'>
/// The changeSet being committed
/// </param>
/// <param name='success'>
/// True if the commit succeeded.
/// </param>
public virtual void OnEndCommit (ChangeSet changeSet, bool success)
{
}
示例15: OnBeginCommit
/// <summary>
/// Called when the commit operation starts.
/// </summary>
/// <param name='changeSet'>
/// The changeSet being committed
/// </param>
/// <returns>
/// False if the commit cannot continue.
/// </returns>
public virtual bool OnBeginCommit (ChangeSet changeSet)
{
return true;
}