private static bool RevertRevisions (Repository vc, string path, Revision revision, bool test, bool toRevision)
		{
			try {
				if (test) {
					return (vc.CanRevert (path));
				}
				
				string question = GettextCatalog.GetString (
				  "Are you sure you want to revert the selected resources to the revision specified (all local changes will be discarded)?");
				
				if (!toRevision)
					question = GettextCatalog.GetString (
					  "Are you sure you want to revert the changes from the revision selected on these resources?");
				
				if (MessageService.AskQuestion (question, 
				                                GettextCatalog.GetString ("Note: The reversion will occur in your working copy, so you will still need to perform a commit to complete it."),
				                                AlertButton.Cancel, AlertButton.Revert) != AlertButton.Revert)
					return false;

				new RevertWorker(vc, path, revision, toRevision).Start();
				return true;
			}
			catch (Exception ex) {
				if (test)
					LoggingService.LogError (ex.ToString ());
				else
					MessageService.ShowException (ex, GettextCatalog.GetString ("Version control command failed."));
				return false;
			}
		}
示例#2
0
		public VersionInfo (FilePath localPath, string repositoryPath, bool isDirectory, VersionStatus status, Revision revision, VersionStatus remoteStatus, Revision remoteRevision)
		{
			this.localPath = localPath;
			this.repositoryPath = repositoryPath;
			this.isDirectory = isDirectory;
			this.status = status;
			this.revision = revision;
			this.remoteStatus = remoteStatus;
			this.remoteRevision = remoteRevision;
		}
		public override string GetTextAtRevision(FilePath repositoryPath, Revision revision)
		{
			throw new NotImplementedException();
		}
		public override void Checkout (FilePath path, Revision rev, bool recurse, IProgressMonitor monitor)
		{
		}
		public Annotation (Revision revision, string author, DateTime date)
		{
			this.Revision = revision;
			this.Author = author;
			this.Date = date;
		}
		public string GetTextAtRevision (FilePath repositoryPath, Revision revision)
		{
			return OnGetTextAtRevision (repositoryPath, revision);
		}
		protected abstract void OnCheckout (FilePath targetLocalPath, Revision rev, bool recurse, ProgressMonitor monitor);
		/// <summary>
		/// Returns the list of changes done in the given revision
		/// </summary>
		/// <param name='revision'>
		/// A revision
		/// </param>
		public RevisionPath[] GetRevisionChanges (Revision revision)
		{
			return OnGetRevisionChanges (revision);
		}
示例#9
0
 public Task <string> GetTextAtRevisionAsync(FilePath repositoryPath, Revision revision, CancellationToken cancellationToken = default)
 {
     return(OnGetTextAtRevisionAsync(repositoryPath, revision, cancellationToken));
 }
示例#10
0
 /// <summary>
 /// Returns a recursive diff set for a revision range.
 /// </summary>
 /// <param name="localPath">
 /// A <see cref="FilePath"/>: A local file path to diff;
 /// directories will be diffed recursively.
 /// </param>
 /// <param name="fromRevision">
 /// A <see cref="Revision"/>: The beginning revision
 /// </param>
 /// <param name="toRevision">
 /// A <see cref="Revision"/>: The ending revision
 /// </param>
 public virtual Task <DiffInfo []> PathDiffAsync(FilePath localPath, Revision fromRevision, Revision toRevision, CancellationToken cancellationToken)
 {
     return(Task.FromResult(Array.Empty <DiffInfo> ()));
 }
示例#11
0
        private static async Task <bool> RevertRevisionsAsync(Repository vc, string path, Revision revision, bool test, bool toRevision, CancellationToken cancellationToken)
        {
            try {
                if (test)
                {
                    if (vc.TryGetVersionInfo(path, out var info))
                    {
                        return(info.CanRevert);
                    }
                    return(false);
                }

                string question = GettextCatalog.GetString(
                    "Are you sure you want to revert the selected resources to the revision specified (all local changes will be discarded)?");

                if (!toRevision)
                {
                    question = GettextCatalog.GetString(
                        "Are you sure you want to revert the changes from the revision selected on these resources?");
                }

                if (MessageService.AskQuestion(question,
                                               GettextCatalog.GetString("Note: The reversion will occur in your working copy, so you will still need to perform a commit to complete it."),
                                               AlertButton.Cancel, AlertButton.Revert) != AlertButton.Revert)
                {
                    return(false);
                }

                await new RevertWorker(vc, path, revision, toRevision).StartAsync(cancellationToken);
                return(true);
            } catch (OperationCanceledException) {
                return(false);
            } catch (Exception ex) {
                if (test)
                {
                    LoggingService.LogError(ex.ToString());
                }
                else
                {
                    MessageService.ShowError(GettextCatalog.GetString("Version control command failed."), ex);
                }
                return(false);
            }
        }
示例#12
0
 public static Task <bool> RevertToRevisionAsync(Repository vc, string path, Revision revision, bool test, CancellationToken cancellationToken = default)
 {
     return(RevertRevisionsAsync(vc, path, revision, test, true, cancellationToken));
 }
 public VersionInfo(FilePath localPath, string repositoryPath, bool isDirectory, VersionStatus status, Revision revision, VersionStatus remoteStatus, Revision remoteRevision)
 {
     this.localPath      = localPath;
     this.repositoryPath = repositoryPath;
     this.isDirectory    = isDirectory;
     this.status         = status;
     this.revision       = revision;
     this.remoteStatus   = remoteStatus;
     this.remoteRevision = remoteRevision;
 }
示例#14
0
 public abstract string GetTextAtRevision(FilePath repositoryPath, Revision revision);
示例#15
0
		// Returns the revision history of a file
		public abstract Revision[] GetHistory (FilePath localFile, Revision since);
示例#16
0
		public abstract void RevertToRevision (FilePath localPath, Revision revision, IProgressMonitor monitor);
示例#17
0
 protected abstract Task <string> OnGetTextAtRevisionAsync(FilePath repositoryPath, Revision revision, CancellationToken cancellationToken);
		protected abstract Revision[] OnGetHistory (FilePath localFile, Revision since);
示例#19
0
 /// <summary>
 /// Retrieves annotations for a given path in the repository.
 /// </summary>
 /// <param name="repositoryPath">
 /// A <see cref="FilePath"/>
 /// </param>
 /// <param name="since">
 /// A <see cref="Revision"/>
 /// </param>
 /// <returns>
 /// A <see cref="Annotation"/> corresponding to each line
 /// of the file to which repositoryPath points.
 /// </returns>
 public virtual Task <Annotation []> GetAnnotationsAsync(FilePath repositoryPath, Revision since, CancellationToken cancellationToken = default)
 {
     return(Task.FromResult(new Annotation[0]));
 }
		protected abstract void OnRevertToRevision (FilePath localPath, Revision revision, ProgressMonitor monitor);
示例#21
0
 /// <summary>
 /// Returns the list of changes done in the given revision
 /// </summary>
 /// <param name='revision'>
 /// A revision
 /// </param>
 protected abstract Task <RevisionPath []> OnGetRevisionChangesAsync(Revision revision, CancellationToken cancellationToken);
		/// <summary>
		/// Retrieves annotations for a given path in the repository.
		/// </summary>
		/// <param name="repositoryPath">
		/// A <see cref="FilePath"/>
		/// </param>
		/// <param name="since">
		/// A <see cref="Revision"/>
		/// </param>
		/// <returns>
		/// A <see cref="Annotation"/> corresponding to each line 
		/// of the file to which repositoryPath points.
		/// </returns>
		public virtual Annotation [] GetAnnotations (FilePath repositoryPath, Revision since)
		{
			return new Annotation[0];
		}
示例#23
0
 public Annotation(Revision revision, string author, DateTime date, string email) : this(revision, author, date, email, null)
 {
 }
示例#24
0
		public override string GetTextAtRevision (FilePath repositoryPath, Revision revision)
		{
			return null;
		}
示例#25
0
 protected abstract Task <Revision []> OnGetHistoryAsync(FilePath localFile, Revision since, CancellationToken cancellationToken);
		public override void Checkout(FilePath targetLocalPath, Revision rev, bool recurse, IProgressMonitor monitor)
		{
			throw new NotImplementedException();
		}
示例#27
0
 protected abstract Task OnCheckoutAsync(FilePath targetLocalPath, Revision rev, bool recurse, ProgressMonitor monitor);
示例#28
0
 public abstract void RevertToRevision(FilePath localPath, Revision revision, IProgressMonitor monitor);
示例#29
0
 protected abstract Task OnRevertToRevisionAsync(FilePath localPath, Revision revision, ProgressMonitor monitor);
			public RevertWorker(Repository vc, string path, Revision revision, bool toRevision) {
				this.vc = vc;
				this.path = path;
				this.revision = revision;
				this.toRevision = toRevision;
			}
示例#31
0
 /// <summary>
 /// Returns the list of changes done in the given revision
 /// </summary>
 /// <param name='revision'>
 /// A revision
 /// </param>
 public RevisionPath[] GetRevisionChanges(Revision revision)
 {
     return(OnGetRevisionChanges(revision));
 }
示例#32
0
		public abstract void Checkout (FilePath targetLocalPath, Revision rev, bool recurse, IProgressMonitor monitor);
示例#33
0
 // Returns the revision history of a file
 public Revision[] GetHistory(FilePath localFile, Revision since)
 {
     return(OnGetHistory(localFile, since));
 }
示例#34
0
		public abstract string GetTextAtRevision (FilePath repositoryPath, Revision revision);
示例#35
0
 protected abstract Revision[] OnGetHistory(FilePath localFile, Revision since);
		// Returns the revision history of a file
		public Revision[] GetHistory (FilePath localFile, Revision since)
		{
			return OnGetHistory (localFile, since);
		}
示例#37
0
 public void Checkout(FilePath targetLocalPath, Revision rev, bool recurse, IProgressMonitor monitor)
 {
     ClearCachedVersionInfo(targetLocalPath);
     OnCheckout(targetLocalPath, rev, recurse, monitor);
 }
		public void Checkout (FilePath targetLocalPath, Revision rev, bool recurse, ProgressMonitor monitor)
		{
			ClearCachedVersionInfo (targetLocalPath);
			OnCheckout (targetLocalPath, rev, recurse, monitor);
		}
示例#39
0
 protected abstract void OnCheckout(FilePath targetLocalPath, Revision rev, bool recurse, IProgressMonitor monitor);
		public void RevertToRevision (FilePath localPath, Revision revision, ProgressMonitor monitor)
		{
			ClearCachedVersionInfo (localPath);
			OnRevertToRevision (localPath, revision, monitor);
		}
示例#41
0
 public void RevertToRevision(FilePath localPath, Revision revision, IProgressMonitor monitor)
 {
     ClearCachedVersionInfo(localPath);
     OnRevertToRevision(localPath, revision, monitor);
 }
		/// <summary>
		/// Returns a recursive diff set for a revision range.
		/// </summary>
		/// <param name="localPath">
		/// A <see cref="FilePath"/>: A local file path to diff; 
		/// directories will be diffed recursively.
		/// </param>
		/// <param name="fromRevision">
		/// A <see cref="Revision"/>: The beginning revision
		/// </param>
		/// <param name="toRevision">
		/// A <see cref="Revision"/>: The ending revision
		/// </param>
		public virtual DiffInfo[] PathDiff (FilePath localPath, Revision fromRevision, Revision toRevision)
		{
			return new DiffInfo [0];
		}
示例#43
0
 protected abstract void OnRevertToRevision(FilePath localPath, Revision revision, IProgressMonitor monitor);
		protected abstract string OnGetTextAtRevision (FilePath repositoryPath, Revision revision);
示例#45
0
 /// <summary>
 /// Returns a recursive diff set for a revision range.
 /// </summary>
 /// <param name="localPath">
 /// A <see cref="FilePath"/>: A local file path to diff;
 /// directories will be diffed recursively.
 /// </param>
 /// <param name="fromRevision">
 /// A <see cref="Revision"/>: The beginning revision
 /// </param>
 /// <param name="toRevision">
 /// A <see cref="Revision"/>: The ending revision
 /// </param>
 public virtual DiffInfo[] PathDiff(FilePath localPath, Revision fromRevision, Revision toRevision)
 {
     return(new DiffInfo [0]);
 }
		/// <summary>
		/// Returns the list of changes done in the given revision
		/// </summary>
		/// <param name='revision'>
		/// A revision
		/// </param>
		protected abstract RevisionPath[] OnGetRevisionChanges (Revision revision);
示例#47
0
 public string GetTextAtRevision(FilePath repositoryPath, Revision revision)
 {
     return(OnGetTextAtRevision(repositoryPath, revision));
 }
		public Annotation (Revision revision, string author, DateTime date, string email, string text)
		{
			this.Revision = revision;
			this.Author = author;
			this.Date = date;
			this.Email = email;
			this.text = text;
		}
示例#49
0
 protected abstract string OnGetTextAtRevision(FilePath repositoryPath, Revision revision);
示例#50
0
		public override Revision[] GetHistory (FilePath sourcefile, Revision since)
		{
			return null;
		}
示例#51
0
 /// <summary>
 /// Returns the list of changes done in the given revision
 /// </summary>
 /// <param name='revision'>
 /// A revision
 /// </param>
 protected abstract RevisionPath[] OnGetRevisionChanges(Revision revision);
示例#52
0
		public override void RevertToRevision (FilePath localPath, Revision revision, IProgressMonitor monitor)
		{
		}
 public static bool RevertToRevision(Repository vc, string path, Revision revision, bool test)
 {
     return(RevertRevisions(vc, path, revision, test, true));
 }
		public override Revision[] GetHistory(FilePath localFile, Revision since)
		{
			throw new NotImplementedException();
		}
		public static bool RevertToRevision (Repository vc, string path, Revision revision, bool test)
		{
			return RevertRevisions (vc, path, revision, test, true);
		}
		public override void RevertToRevision(FilePath localPath, Revision revision, IProgressMonitor monitor)
		{
			throw new NotImplementedException();
		}
示例#57
0
 // Returns the revision history of a file
 public abstract Revision[] GetHistory(FilePath localFile, Revision since);